From cb604603cac4975438274356b17560b4a8807aa3 Mon Sep 17 00:00:00 2001 From: "Wolfgang (Blub) Bumiller" Date: Thu, 23 Aug 2012 20:54:24 +0200 Subject: [PATCH] -Weffectless-statement now also triggers on effectless incrementors in for-loops, if an incrementor was specified --- parser.c | 7 +++++++ 1 file changed, 7 insertions(+) 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 */ -- 2.39.2