citrun

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

commit e707793205905a718ac1fcccf73fcb5f17829ace
parent fe93c5909587736741467c0cdca068a6b6a08abf
Author: Kyle Milz <kyle@0x30.net>
Date:   Thu, 15 Dec 2016 20:14:50 -0700

src: merge version file into rt.h

Diffstat:
Msrc/inst_action.cc | 4+---
Msrc/process_file.cc | 3+--
Msrc/rt.c | 3+--
Msrc/rt.h | 3+++
Dsrc/version.h | 2--
Mt/inst_preamble.sh | 5++++-
Mt/utils.subr | 2+-
7 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/inst_action.cc b/src/inst_action.cc @@ -15,7 +15,6 @@ // #include "inst_action.h" #include "rt_h.h" -#include "version.h" // citrun_major, citrun_minor #include <clang/Frontend/CompilerInstance.h> #include <err.h> @@ -86,8 +85,7 @@ InstrumentAction::EndSourceFileAction() preamble << "};\n"; preamble << "__attribute__((constructor)) static void\n" << "citrun_constructor() {\n" - << " citrun_node_add(" << citrun_major << ", " - << citrun_minor << ", &_citrun);\n" + << " citrun_node_add(citrun_major, citrun_minor, &_citrun);\n" << "}\n"; preamble << "#ifdef __cplusplus\n" << "}\n" diff --git a/src/process_file.cc b/src/process_file.cc @@ -27,8 +27,7 @@ #include <unistd.h> // getpagesize #include "process_file.h" -#include "rt.h" // struct citrun_{node,header} -#include "version.h" // citrun_major +#include "rt.h" // citrun_major, struct citrun_{node,header} // diff --git a/src/rt.c b/src/rt.c @@ -25,8 +25,7 @@ #include <string.h> /* str{l,n}cpy */ #include <unistd.h> /* lseek get{cwd,pid,ppid,pgrp} */ -#include "rt.h" /* struct citrun_{header,node} */ -#include "version.h" +#include "rt.h" /* citrun_*, struct citrun_{header,node} */ static int shm_fd = 0; diff --git a/src/rt.h b/src/rt.h @@ -1,3 +1,6 @@ +static const unsigned int citrun_major = 0; +static const unsigned int citrun_minor = 0; + struct citrun_header { char magic[4]; unsigned int major; diff --git a/src/version.h b/src/version.h @@ -1,2 +0,0 @@ -static const unsigned int citrun_major = 0; -static const unsigned int citrun_minor = 0; diff --git a/t/inst_preamble.sh b/t/inst_preamble.sh @@ -16,6 +16,9 @@ cat <<EOF > preamble.c.good #ifdef __cplusplus extern "" { #endif +static const unsigned int citrun_major = 0; +static const unsigned int citrun_minor = 0; + struct citrun_header { char magic[4]; unsigned int major; @@ -40,7 +43,7 @@ static struct citrun_node _citrun = { }; __attribute__((constructor)) static void citrun_constructor() { - citrun_node_add(0, 0, &_citrun); + citrun_node_add(citrun_major, citrun_minor, &_citrun); } #ifdef __cplusplus } diff --git a/t/utils.subr b/t/utils.subr @@ -1,7 +1,7 @@ strip_preamble() { file="${1}" - tail -n +33 $file.citrun > $file.citrun_nohdr + tail -n +36 $file.citrun > $file.citrun_nohdr } strip_log()