From b7b9f9f51170bd1616ee56acfef9c6bf20b9cf3f Mon Sep 17 00:00:00 2001 From: seyko Date: Tue, 3 Mar 2015 14:25:57 +0300 Subject: A gcc preprocessor option -dD added With this option on a defines are included into the output (inside comments). This will allow to debug a problems like: In file included from math.c:8: In file included from /usr/include/math.h:43: /usr/include/bits/nan.h:52: warning: NAN redefined --- tcc.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tcc.c') diff --git a/tcc.c b/tcc.c index 7b19114..ce03d3b 100644 --- a/tcc.c +++ b/tcc.c @@ -47,6 +47,7 @@ static void help(void) " -Usym undefine 'sym'\n" " -P do not output a #line directive\n" " -P1 use a #line directive in output instead of the gcc style\n" + " -dD put a define directive in the output (inside a comment)\n" "Linker options:\n" " -Ldir add library path 'dir'\n" " -llib link with dynamic or static library 'lib'\n" @@ -307,6 +308,8 @@ int main(int argc, char **argv) start_time = getclock_us(); tcc_set_output_type(s, s->output_type); + if (s->output_type == TCC_OUTPUT_PREPROCESS) + print_defines(); /* compile or add each files or library */ for(i = ret = 0; i < s->nb_files && ret == 0; i++) { -- cgit v1.3.1