From: Wolfgang (Blub) Bumiller Date: Thu, 23 Aug 2012 18:54:24 +0000 (+0200) Subject: -Weffectless-statement now also triggers on effectless incrementors in for-loops... X-Git-Tag: 0.1-rc1~59 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=cb604603cac4975438274356b17560b4a8807aa3;p=xonotic%2Fgmqcc.git -Weffectless-statement now also triggers on effectless incrementors in for-loops, if an incrementor was specified --- diff --git a/parser.c b/parser.c index 892ef2f..b9e2d82 100644 --- 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 */