[hackers] [scc] Emit newlines in onlycpp mode || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Mon, 5 Oct 2015 17:43:26 +0200 (CEST)

commit 92c212afb9da93c192deddd2f44aaed198af192c
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Mon Oct 5 17:40:02 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Mon Oct 5 17:40:02 2015 +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.

diff --git a/cc1/cc1.h b/cc1/cc1.h
index 27a0d9a..2c6f37b 100644
--- a/cc1/cc1.h
+++ b/cc1/cc1.h
_AT_@ -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
index 0fd977a..36a0c60 100644
--- a/cc1/lex.c
+++ b/cc1/lex.c
_AT_@ -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
index c20f485..93b7af3 100644
--- a/cc1/main.c
+++ b/cc1/main.c
_AT_@ -13,7 +13,7 @@ int warnings;
 jmp_buf recover;
 
 static char *output;
-static int onlycpp;
+int onlycpp;
 
 static void
 clean(void)
Received on Mon Oct 05 2015 - 17:43:26 CEST

This archive was generated by hypermail 2.3.0 : Mon Oct 05 2015 - 17:48:10 CEST