]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
-Weffectless-statement now also triggers on effectless incrementors in for-loops...
authorWolfgang (Blub) Bumiller <blub@speed.at>
Thu, 23 Aug 2012 18:54:24 +0000 (20:54 +0200)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Thu, 23 Aug 2012 18:54:24 +0000 (20:54 +0200)
parser.c

index 892ef2f3c829c5f8efeb4c0d32efdc623689f437..b9e2d82e62d18175c0e1f23369944bf7156cd31c 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -1622,6 +1622,13 @@ static bool parser_parse_for(parser_t *parser, ast_block *block, ast_expression
         increment = parser_expression_leave(parser, false);
         if (!increment)
             goto onerr;
+        if (!ast_istype(increment, ast_store) &&
+            !ast_istype(increment, ast_call) &&
+            !ast_istype(increment, ast_binstore))
+        {
+            if (parsewarning(parser, WARN_EFFECTLESS_STATEMENT, "statement has no effect"))
+                goto onerr;
+        }
     }
 
     /* closing paren */