shithub: scc

Download patch

ref: a004412434813b0500807d46d09c2d0cef13205d
parent: 989b26202e9264b37237371f85a19630ec4f1b0a
author: Roberto E. Vargas Caballero <[email protected]>
date: Fri Nov 19 02:57:28 EST 2021

cc1: Compare against EOFTOK instead of EOF

When EOF is found the lexer returns EOFTO and not EOF. This
confuccion mas making that the if was not true ever and it
generated very confusing error messages.

--- a/src/cmd/cc/cc1/lex.c
+++ b/src/cmd/cc/cc1/lex.c
@@ -774,7 +774,7 @@
 	else
 		yytoken = operator();
 
-	if (yytoken == EOF) {
+	if (yytoken == EOFTOK) {
 		strcpy(yytext, "<EOF>");
 		if (cppctx)
 			errorp("#endif expected");