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

View File

@ -1656,6 +1656,7 @@ enum {
TCC_OPTION_b,
TCC_OPTION_g,
TCC_OPTION_c,
TCC_OPTION_d,
TCC_OPTION_float_abi,
TCC_OPTION_static,
TCC_OPTION_shared,
@ -1709,6 +1710,7 @@ static const TCCOption tcc_options[] = {
#endif
{ "g", TCC_OPTION_g, TCC_OPTION_HAS_ARG | TCC_OPTION_NOSEP },
{ "c", TCC_OPTION_c, 0 },
{ "d", TCC_OPTION_d, TCC_OPTION_HAS_ARG | TCC_OPTION_NOSEP },
#ifdef TCC_TARGET_ARM
{ "mfloat-abi", TCC_OPTION_float_abi, TCC_OPTION_HAS_ARG },
#endif
@ -1848,6 +1850,14 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv)
tcc_warning("-c: some compiler action already specified (%d)", s->output_type);
s->output_type = TCC_OUTPUT_OBJ;
break;
case TCC_OPTION_d:
if (*optarg != 'D') {
if (s->warn_unsupported)
goto unsupported_option;
tcc_error("invalid option -- '%s'", r);
}
s->dflag = 1;
break;
#ifdef TCC_TARGET_ARM
case TCC_OPTION_float_abi:
/* tcc doesn't support soft float yet */