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 --- libtcc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'libtcc.c') diff --git a/libtcc.c b/libtcc.c index 3581ffb..72524eb 100644 --- a/libtcc.c +++ b/libtcc.c @@ -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 */ -- cgit v1.3.1