shithub: scc

Download patch

ref: c484ab23ccfb44b48143d8dd77e8f281ba8b012b
parent: 18bc293eda5e66a9cd3f86d9dcb1c987de599779
author: Roberto E. Vargas Caballero <[email protected]>
date: Mon Oct 5 12:41:58 EDT 2015

Fix defined() parsing

primary() was calling after notdefined(), which consumed all the
tokens for 'defined(macro)'.

--- a/cc1/expr.c
+++ b/cc1/expr.c
@@ -534,7 +534,6 @@
 	sym = yylval.sym;
 	switch (yytoken) {
 	case CONSTANT:
-	constant:
 		np = constnode(sym);
 		next();
 		break;
@@ -541,8 +540,10 @@
 	case IDEN:
 		if ((sym->flags & ISDECLARED) == 0)
 			sym = notdefined(sym);
-		if (sym->flags & ISCONSTANT)
-			goto constant;
+		if (sym->flags & ISCONSTANT) {
+			np = constnode(sym);
+			break;
+		}
 		sym->flags |= ISUSED;
 		np = varnode(sym);
 		next();