]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
handling the noops flag better now
authorWolfgang (Blub) Bumiller <blub@speed.at>
Fri, 16 Nov 2012 18:32:02 +0000 (19:32 +0100)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Fri, 16 Nov 2012 18:32:02 +0000 (19:32 +0100)
ftepp.c

diff --git a/ftepp.c b/ftepp.c
index 51a83a15563908adfee19fb31a63c5a04ae38c32..664516650f00bfe7359201ea27f87ed919f50ea1 100644 (file)
--- a/ftepp.c
+++ b/ftepp.c
@@ -207,7 +207,6 @@ static bool ftepp_if_expr(ftepp_t *ftepp, bool *out)
         case TOKEN_TYPENAME:
         case TOKEN_KEYWORD:
             if (!strcmp(ftepp_tokval(ftepp), "defined")) {
-                ftepp->lex->flags.noops = true;
                 ftepp_next(ftepp);
                 if (!ftepp_skipspace(ftepp))
                     return false;
@@ -215,7 +214,6 @@ static bool ftepp_if_expr(ftepp_t *ftepp, bool *out)
                     ftepp_error(ftepp, "`defined` keyword in #if requires a macro name in parenthesis");
                     return false;
                 }
-                ftepp->lex->flags.noops = false;
                 ftepp_next(ftepp);
                 if (!ftepp_skipspace(ftepp))
                     return false;
@@ -281,9 +279,11 @@ static bool ftepp_if_expr(ftepp_t *ftepp, bool *out)
             return false;
     }
 
+    ftepp->lex->flags.noops = false;
     ftepp_next(ftepp);
     if (!ftepp_skipspace(ftepp))
         return false;
+    ftepp->lex->flags.noops = true;
 
     if (ftepp->token == ')')
         return true;
@@ -317,8 +317,6 @@ static bool ftepp_if(ftepp_t *ftepp, ppcondition *cond)
 {
     bool result = false;
 
-    ftepp->lex->flags.noops = false;
-
     memset(cond, 0, sizeof(*cond));
     (void)ftepp_next(ftepp);
 
@@ -331,7 +329,6 @@ static bool ftepp_if(ftepp_t *ftepp, ppcondition *cond)
 
     if (!ftepp_if_expr(ftepp, &result))
         return false;
-    ftepp->lex->flags.noops = true;
 
     cond->on = result;
     return true;
@@ -507,6 +504,7 @@ static bool ftepp_preprocess(ftepp_t *ftepp)
     bool newline = true;
 
     ftepp->lex->flags.preprocessing = true;
+    ftepp->lex->flags.noops = true;
 
     ftepp_next(ftepp);
     do