scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit c484ab23ccfb44b48143d8dd77e8f281ba8b012b
parent 18bc293eda5e66a9cd3f86d9dcb1c987de599779
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon,  5 Oct 2015 16:41:58 +0200

Fix defined() parsing

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

Diffstat:
Mcc1/expr.c | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/cc1/expr.c b/cc1/expr.c @@ -534,15 +534,16 @@ primary(void) sym = yylval.sym; switch (yytoken) { case CONSTANT: - constant: np = constnode(sym); next(); break; 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();