From e946eb2a4109e0de5f8514457f851897a4824c3e Mon Sep 17 00:00:00 2001 From: Vlad Vissoultchev Date: Wed, 6 Apr 2016 18:57:11 +0300 Subject: Implement -dM preprocessor option as in gcc There was already support for -dD option but in contrast -dM dumps only `#define` directives w/o actual preprocessor output. The original -dD output differs from gcc output by additional comment in front of `#define`s so this quirk is left for -dM as well. --- tccpp.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'tccpp.c') diff --git a/tccpp.c b/tccpp.c index 70a2258..80c7dd8 100644 --- a/tccpp.c +++ b/tccpp.c @@ -1092,7 +1092,7 @@ static void pp_line(TCCState *s1, BufferedFile *f, int level) static void tok_print(const char *msg, const int *str) { - FILE *pr = tcc_state->ppfp; + FILE *pr = tcc_state->dffp; int t; CValue cval; @@ -1108,13 +1108,13 @@ static void tok_print(const char *msg, const int *str) static int define_print_prepared(Sym *s) { - if (!s || !tcc_state->ppfp || tcc_state->dflag == 0) + if (!s || !tcc_state->dffp || tcc_state->dflag == 0) return 0; if (s->v < TOK_IDENT || s->v >= tok_ident) return 0; - if (file) { + if (file && tcc_state->dflag == 'D') { file->line_num--; pp_line(tcc_state, file, 0); file->line_ref = ++file->line_num; @@ -1124,7 +1124,7 @@ static int define_print_prepared(Sym *s) static void define_print(int v) { - FILE *pr = tcc_state->ppfp; + FILE *pr = tcc_state->dffp; Sym *s, *a; s = define_find(v); @@ -1149,7 +1149,7 @@ static void define_print(int v) static void undef_print(int v) { - FILE *pr = tcc_state->ppfp; + FILE *pr = tcc_state->dffp; Sym *s; s = define_find(v); -- cgit v1.3.1