aboutsummaryrefslogtreecommitdiff
path: root/libtcc.c
diff options
context:
space:
mode:
authorseyko <seyko2@gmail.com>2015-03-03 14:19:14 +0300
committerseyko <seyko2@gmail.com>2015-03-03 14:19:14 +0300
commit50cdccf3efaa13dd11d1533b73fb34e0429d5cd6 (patch)
tree0239fe1588a10cc4d70c80a2e2aba9f1ca185f4a /libtcc.c
parent40418f87c7da9d3358363769fb13c558b43f2847 (diff)
downloadtinycc-50cdccf3efaa13dd11d1533b73fb34e0429d5cd6.tar.gz
tinycc-50cdccf3efaa13dd11d1533b73fb34e0429d5cd6.tar.bz2
Added a gcc preprocessor options -P, -P1
tcc -E -P do not output a #line directive, a gcc compatible option tcc -E -P1 don't follow a gcc preprocessor style and do output a standard #line directive. In such case we don't lose a location info when we going to compile a resulting file wtith a compiler not understanding a gnu style line info.
Diffstat (limited to 'libtcc.c')
-rw-r--r--libtcc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libtcc.c b/libtcc.c
index c68221e..3581ffb 100644
--- a/libtcc.c
+++ b/libtcc.c
@@ -1647,6 +1647,7 @@ enum {
TCC_OPTION_I,
TCC_OPTION_D,
TCC_OPTION_U,
+ TCC_OPTION_P,
TCC_OPTION_L,
TCC_OPTION_B,
TCC_OPTION_l,
@@ -1695,6 +1696,7 @@ static const TCCOption tcc_options[] = {
{ "I", TCC_OPTION_I, TCC_OPTION_HAS_ARG },
{ "D", TCC_OPTION_D, TCC_OPTION_HAS_ARG },
{ "U", TCC_OPTION_U, TCC_OPTION_HAS_ARG },
+ { "P", TCC_OPTION_P, TCC_OPTION_HAS_ARG | TCC_OPTION_NOSEP },
{ "L", TCC_OPTION_L, TCC_OPTION_HAS_ARG },
{ "B", TCC_OPTION_B, TCC_OPTION_HAS_ARG },
{ "l", TCC_OPTION_l, TCC_OPTION_HAS_ARG | TCC_OPTION_NOSEP },
@@ -1930,6 +1932,9 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv)
tcc_warning("-E: some compiler action already specified (%d)", s->output_type);
s->output_type = TCC_OUTPUT_PREPROCESS;
break;
+ case TCC_OPTION_P:
+ s->Pflag = atoi(optarg) + 1;
+ break;
case TCC_OPTION_MD:
s->gen_deps = 1;
break;