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
This commit is contained in:
seyko
2015-03-03 14:25:57 +03:00
parent 50cdccf3ef
commit b7b9f9f511
4 changed files with 84 additions and 22 deletions

3
tcc.c
View File

@ -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++) {