diff options
| author | seyko <seyko2@gmail.com> | 2016-04-15 17:15:11 +0300 |
|---|---|---|
| committer | seyko <seyko2@gmail.com> | 2016-04-15 17:15:11 +0300 |
| commit | c6dc756d4e6905df8498596f5bd0c5a6aa1c6d24 (patch) | |
| tree | 06ee2a1b3b170b689f3b063c4b17e1ac60e3a19d /libtcc.c | |
| parent | 16cbca281fe5d22cd3e6f548cae59d19c31d30ac (diff) | |
| download | tinycc-c6dc756d4e6905df8498596f5bd0c5a6aa1c6d24.tar.gz tinycc-c6dc756d4e6905df8498596f5bd0c5a6aa1c6d24.tar.bz2 | |
preprocessor oprtion -C (keep comments)
This is done by impression of the pcc -C option.
Usual execution path and speed are not changed.
Diffstat (limited to 'libtcc.c')
| -rw-r--r-- | libtcc.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -1604,6 +1604,21 @@ LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type) { s->output_type = output_type; + if (s->output_type == TCC_OUTPUT_PREPROCESS) { + if (!s->outfile) { + s->ppfp = stdout; + } else { + s->ppfp = fopen(s->outfile, "w"); + if (!s->ppfp) + tcc_error("could not write '%s'", s->outfile); + } + s->dffp = s->ppfp; + if (s->dflag == 'M') + s->ppfp = NULL; + } + if (s->option_C && !s->ppfp) + s->option_C = 0; + if (!s->nostdinc) { /* default include paths */ /* -isystem paths have already been handled */ @@ -1946,6 +1961,7 @@ enum { TCC_OPTION_b, TCC_OPTION_g, TCC_OPTION_c, + TCC_OPTION_C, TCC_OPTION_dumpversion, TCC_OPTION_d, TCC_OPTION_float_abi, @@ -2003,6 +2019,7 @@ static const TCCOption tcc_options[] = { #endif { "g", TCC_OPTION_g, TCC_OPTION_HAS_ARG | TCC_OPTION_NOSEP }, { "c", TCC_OPTION_c, 0 }, + { "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 @@ -2191,6 +2208,9 @@ ST_FUNC int tcc_parse_args1(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_C: + s->option_C = 1; + break; case TCC_OPTION_d: if (*optarg == 'D' || *optarg == 'M') s->dflag = *optarg; |
