redo of the -dD option

functionality was broken some time ago and was removed
    by the "tccpp: fix issues, add tests"

    fix: LINE_MACRO_OUTPUT_FORMAT_NONE in pp_line()
    means: output '\n' and not "don't output at all"
This commit is contained in:
seyko
2015-05-13 12:16:00 +03:00
parent cf92f7aacb
commit 80322adaa0
4 changed files with 119 additions and 61 deletions

View File

@ -1567,6 +1567,10 @@ LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type)
put_extern_sym(sym, NULL, 0, 0);
}
#endif
if (s->output_type == TCC_OUTPUT_PREPROCESS)
print_defines();
return 0;
}
@ -1843,6 +1847,7 @@ enum {
TCC_OPTION_g,
TCC_OPTION_c,
TCC_OPTION_dumpversion,
TCC_OPTION_d,
TCC_OPTION_float_abi,
TCC_OPTION_static,
TCC_OPTION_std,
@ -1899,6 +1904,7 @@ static const TCCOption tcc_options[] = {
{ "g", TCC_OPTION_g, TCC_OPTION_HAS_ARG | TCC_OPTION_NOSEP },
{ "c", TCC_OPTION_c, 0 },
{ "dumpversion", TCC_OPTION_dumpversion, 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
@ -2066,10 +2072,19 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv)
s->do_debug = 1;
break;
case TCC_OPTION_c:
if (s->output_type)
if (s->output_type)
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')
s->dflag = 1;
else {
if (s->warn_unsupported)
goto unsupported_option;
tcc_error("invalid option -- '%s'", r);
}
break;
#ifdef TCC_TARGET_ARM
case TCC_OPTION_float_abi:
/* tcc doesn't support soft float yet */