scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 92c212afb9da93c192deddd2f44aaed198af192c
parent e71640c89e83818cd86e00ed63e0db88ec70feb8
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon,  5 Oct 2015 17:40:02 +0200

Emit newlines in onlycpp mode

In this mode we were printing a sequence of tokens, but
it was not very useful, because we are losing all the
information about lines. With this patch the situation
is not far better, but at least no everything is in
only one line.

Diffstat:
Mcc1/cc1.h | 2+-
Mcc1/lex.c | 2++
Mcc1/main.c | 2+-
3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/cc1/cc1.h b/cc1/cc1.h @@ -411,7 +411,7 @@ extern unsigned short yylen; extern int cppoff, disexpand; extern unsigned cppctx; extern Input *input; -extern int lexmode, namespace; +extern int lexmode, namespace, onlycpp; extern unsigned curctx; extern Symbol *curfun, *zero, *one; diff --git a/cc1/lex.c b/cc1/lex.c @@ -226,6 +226,8 @@ repeat: goto repeat; } + if (onlycpp) + putchar('\n'); input->begin = input->p; return 1; } diff --git a/cc1/main.c b/cc1/main.c @@ -13,7 +13,7 @@ int warnings; jmp_buf recover; static char *output; -static int onlycpp; +int onlycpp; static void clean(void)