shithub: scc

Download patch

ref: 92c212afb9da93c192deddd2f44aaed198af192c
parent: e71640c89e83818cd86e00ed63e0db88ec70feb8
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Mon Oct 5 13:40:02 EDT 2015

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.

--- a/cc1/cc1.h
+++ b/cc1/cc1.h
@@ -411,7 +411,7 @@
 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;
 
--- a/cc1/lex.c
+++ b/cc1/lex.c
@@ -226,6 +226,8 @@
 		goto repeat;
 	}
 
+	if (onlycpp)
+		putchar('\n');
 	input->begin = input->p;
 	return 1;
 }
--- a/cc1/main.c
+++ b/cc1/main.c
@@ -13,7 +13,7 @@
 jmp_buf recover;
 
 static char *output;
-static int onlycpp;
+int onlycpp;
 
 static void
 clean(void)