ref: 88a258358e1ee162f40fb0174cb2137096ff8c48
parent: ca159744ce0e57a00d89f49dcd3617a1ef7e4761
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Wed Mar 16 16:15:33 EDT 2022
cpp: Add null preprocesor clause A preprocessor line containing only a new line is considered a null preprocessor clause and it must be ignored.
--- a/src/cmd/cc/cc1/cpp.c
+++ b/src/cmd/cc/cc1/cpp.c
@@ -783,11 +783,14 @@
next();
namespace = NS_IDEN;
+ if (yytoken == '\n')
+ goto ret;
+
for (bp = clauses; bp->token && bp->token != yytoken; ++bp)
;
if (!bp->token) {
errorp("incorrect preprocessor directive '%s'", yytext);
- goto error;
+ goto ret;
}
DBG("CPP %s", yytext);
@@ -805,7 +808,7 @@
if (yytoken != '\n' && !cppoff && bp->token != INCLUDE)
errorp("trailing characters after preprocessor directive");
-error:
+ret:
disescape = 0;
disexpand = 0;
lexmode = CCMODE;