shithub: scc

Download patch

ref: 2498915ac3402a2fc4cd4557aa3e1ea3bf24858d
parent: dfb4776b82942448a8daa298b2ba280117f4ddce
author: Roberto E. Vargas Caballero <[email protected]>
date: Thu Aug 13 13:53:50 EDT 2015

Avoid error() in cpp directives

Error() tries to recover from error and this is something
you don't want in a directive preprocessor.

--- a/cc1/cpp.c
+++ b/cc1/cpp.c
@@ -329,8 +329,10 @@
 
 	setnamespace(NS_CPP);
 	next();
-	if (yytoken != IDEN)
-		error("macro names must be identifiers");
+	if (yytoken != IDEN) {
+		cpperror("macro names must be identifiers");
+		return;
+	}
 	sym = yylval.sym;
 	if (sym->flags & ISDECLARED) {
 		warn("'%s' redefined", yytext);