]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
Unary NOT in #if
authorWolfgang (Blub) Bumiller <blub@speed.at>
Fri, 16 Nov 2012 19:02:27 +0000 (20:02 +0100)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Fri, 16 Nov 2012 19:02:27 +0000 (20:02 +0100)
ftepp.c

diff --git a/ftepp.c b/ftepp.c
index 664516650f00bfe7359201ea27f87ed919f50ea1..a240643046e0827c2a42a1b98820cae6e7730ce8 100644 (file)
--- a/ftepp.c
+++ b/ftepp.c
@@ -198,10 +198,18 @@ static bool ftepp_define(ftepp_t *ftepp)
 static bool ftepp_if_expr(ftepp_t *ftepp, bool *out)
 {
     ppmacro *macro;
+    bool     wasnot = false;
 
     if (!ftepp_skipspace(ftepp))
         return false;
 
+    while (ftepp->token == '!') {
+        wasnot = true;
+        ftepp_next(ftepp);
+        if (!ftepp_skipspace(ftepp))
+            return false;
+    }
+
     switch (ftepp->token) {
         case TOKEN_IDENT:
         case TOKEN_TYPENAME:
@@ -278,6 +286,8 @@ static bool ftepp_if_expr(ftepp_t *ftepp, bool *out)
             ftepp_error(ftepp, "junk in #if");
             return false;
     }
+    if (wasnot)
+        *out = !*out;
 
     ftepp->lex->flags.noops = false;
     ftepp_next(ftepp);