[hackers] [scc] Fix defined() parsing || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Mon, 5 Oct 2015 16:44:23 +0200 (CEST)

commit c484ab23ccfb44b48143d8dd77e8f281ba8b012b
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Mon Oct 5 16:41:58 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Mon Oct 5 16:41:58 2015 +0200

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

diff --git a/cc1/expr.c b/cc1/expr.c
index 6ec964b..3b106a0 100644
--- a/cc1/expr.c
+++ b/cc1/expr.c
_AT_@ -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();
Received on Mon Oct 05 2015 - 16:44:23 CEST

This archive was generated by hypermail 2.3.0 : Mon Oct 05 2015 - 16:48:11 CEST