citrun

watch C/C++ source code execute
Log | Files | Refs | LICENSE

commit 223a80a29a8b055678c775e088e43d7b10773bfa
parent d55a1d68a694bbb6a2df8c86ecaa347292141708
Author: Kyle Milz <kyle@0x30.net>
Date:   Sat, 20 Aug 2016 13:18:44 -0600

src: use strings from -D instead of insane STR macro

Diffstat:
Msrc/Jamfile | 5++---
Msrc/inst_frontend.cc | 5+----
Msrc/inst_main.cc | 8+++-----
3 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/src/Jamfile b/src/Jamfile @@ -47,7 +47,6 @@ Stringize demo_vshader_glsl.h : demo_vshader.glsl ; Stringize demo_fshader_glsl.h : demo_fshader.glsl ; ObjectC++Flags $(GL_SRCS) : `pkg-config $(PKG_CONFIG_LIBS) --cflags` ; -ObjectC++Flags $(GL_SRCS) : -I/usr/local/include ; LINKLIBS on citrun-gl += `pkg-config $(PKG_CONFIG_LIBS) --libs` ; LinkLibraries citrun-gl : libglyphy ; @@ -67,8 +66,8 @@ INST_SRCS = Stringize runtime_h.h : runtime.h ; ObjectC++Flags $(INST_SRCS) : `llvm-config --cxxflags` ; -ObjectC++Flags $(INST_SRCS) : -DCITRUN_SHARE=$(CITRUN_SHARE) - -DCITRUN_COVERAGE=$(CITRUN_COVERAGE) ; +ObjectDefines $(INST_SRCS) : CITRUN_SHARE=\\\"$(CITRUN_SHARE)\\\" + CITRUN_COVERAGE=$(CITRUN_COVERAGE) ; LINKFLAGS on citrun-inst = `llvm-config --ldflags` ; diff --git a/src/inst_frontend.cc b/src/inst_frontend.cc @@ -30,9 +30,6 @@ #include <sstream> // ostringstream #include <unistd.h> // execvp, fork, getpid, unlink -#define STR_EXPAND(tok) #tok -#define STR(tok) STR_EXPAND(tok) - static llvm::cl::OptionCategory ToolingCategory("citrun-inst options"); InstrumentFrontend::InstrumentFrontend(int argc, char *argv[], @@ -127,7 +124,7 @@ InstrumentFrontend::if_link_add_runtime(bool object_arg, bool compile_arg) // Needed because libcitrun.a will be instrumented with gcov. m_args.push_back(const_cast<char *>("-coverage")); #endif - m_args.push_back(const_cast<char *>(STR(CITRUN_SHARE) "/libcitrun.a")); + m_args.push_back(const_cast<char *>(CITRUN_SHARE "/libcitrun.a")); *m_log << m_args.back() << "' to command line.\n"; } diff --git a/src/inst_main.cc b/src/inst_main.cc @@ -24,8 +24,6 @@ #include <libgen.h> // basename #include <sstream> // stringstream -#define STR_EXPAND(tok) #tok -#define STR(tok) STR_EXPAND(tok) int clean_PATH(InstrumentLogger &llog) @@ -46,7 +44,7 @@ clean_PATH(InstrumentLogger &llog) bool found_citrun_path = 0; while (std::getline(path_ss, component, ':')) { - if (component.compare(STR(CITRUN_SHARE)) == 0) { + if (component.compare(CITRUN_SHARE) == 0) { found_citrun_path = 1; continue; } @@ -60,7 +58,7 @@ clean_PATH(InstrumentLogger &llog) } if (!found_citrun_path) { - llog << "Error: '" << STR(CITRUN_SHARE) << "' not in PATH.\n"; + llog << "Error: '" << CITRUN_SHARE << "' not in PATH.\n"; return 1; } @@ -88,7 +86,7 @@ print_toolinfo(InstrumentLogger &llog, const char *argv0) } llog << "Tool called as '" << argv0 << "'.\n"; - llog << "Resource directory is '" << STR(CITRUN_SHARE) << "'\n"; + llog << "Resource directory is '" << CITRUN_SHARE << "'\n"; } int