commit 6650268eca2441b777636a3aad411b2d70e23281
parent 5510ac1ca190a4bacb6330ca37a7ab5f0b347225
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Fri, 21 Aug 2015 13:04:15 +0200
Basic support for -E flag
This flag makes compilation stop after preprocessor. This version
is only a draft of how it must work.
Diffstat:
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/cc1/main.c b/cc1/main.c
@@ -13,6 +13,7 @@ int warnings;
jmp_buf recover;
static char *output;
+static int onlycpp;
static void
clean(void)
@@ -46,6 +47,9 @@ main(int argc, char *argv[])
case 'w':
warnings = 1;
break;
+ case 'E':
+ onlycpp = 1;
+ break;
case 'o':
if (!*++argv || argv[0][0] == '-')
usage();
@@ -67,8 +71,13 @@ main(int argc, char *argv[])
ikeywords();
ilex(*argv);
- for (next(); yytoken != EOFTOK; decl())
- /* nothing */;
+ if (onlycpp) {
+ for (next(); yytoken != EOFTOK; next())
+ printf("%s ", yytext);
+ } else {
+ for (next(); yytoken != EOFTOK; decl())
+ /* nothing */;
+ }
return 0;
}