scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit 841af350dcde75e0199deda9939a5824c249f864
parent d6e853477e7e2ac5c96765369d6482822510e459
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Thu,  2 Feb 2023 15:30:40 +0100

cc1: Generate endif errors only in actual EOF

The pushup strategy used in the preprocessor generates
EOF tokens in macro expansions that don't mean the end
of the input stream. When that situation what happening
(a macro expansion with parameters inside of a ifdef)
it generated a '#endif expected', when this should happen
only when no more input is available.

Diffstat:
Msrc/cmd/cc/cc1/lex.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/cmd/cc/cc1/lex.c b/src/cmd/cc/cc1/lex.c @@ -902,7 +902,7 @@ next(void) if (yytoken == EOFTOK) { strcpy(yytext, "<EOF>"); - if (cppctx) + if (cppctx && !input) errorp("#endif expected"); }