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.
This commit is contained in:
Vlad Vissoultchev
2016-04-06 18:57:11 +03:00
parent 0691b7630b
commit e946eb2a41
4 changed files with 14 additions and 8 deletions

3
tcc.c
View File

@ -301,6 +301,9 @@ int main(int argc, char **argv)
if (!s->ppfp)
tcc_error("could not write '%s'", s->outfile);
}
s->dffp = s->ppfp;
if (s->dflag == 'M')
s->ppfp = NULL;
}
tcc_set_output_type(s, s->output_type);