From 80322adaa0544eedc7198ed4c529a41856f66f43 Mon Sep 17 00:00:00 2001 From: seyko Date: Wed, 13 May 2015 12:16:00 +0300 Subject: 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" --- libtcc.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'libtcc.c') diff --git a/libtcc.c b/libtcc.c index fb78c37..df98bb0 100644 --- a/libtcc.c +++ b/libtcc.c @@ -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 */ -- cgit v1.3.1