From: Wolfgang (Blub) Bumiller Date: Thu, 23 Aug 2012 18:56:05 +0000 (+0200) Subject: use the expression's linenumber for the 'statement has no effect' warning rather... X-Git-Tag: 0.1-rc1~58 X-Git-Url: https://git.xonotic.org/?a=commitdiff_plain;h=41d1ef37d25a81d5cb25bc1523656d6305a2c244;p=xonotic%2Fgmqcc.git use the expression's linenumber for the 'statement has no effect' warning rather than the current one because that one's usually the line below... --- diff --git a/parser.c b/parser.c index b9e2d82..5bdb7e7 100644 --- a/parser.c +++ b/parser.c @@ -1626,7 +1626,7 @@ static bool parser_parse_for(parser_t *parser, ast_block *block, ast_expression !ast_istype(increment, ast_call) && !ast_istype(increment, ast_binstore)) { - if (parsewarning(parser, WARN_EFFECTLESS_STATEMENT, "statement has no effect")) + if (genwarning(ast_ctx(increment), WARN_EFFECTLESS_STATEMENT, "statement has no effect")) goto onerr; } } @@ -1779,7 +1779,7 @@ static bool parser_parse_statement(parser_t *parser, ast_block *block, ast_expre !ast_istype(exp, ast_call) && !ast_istype(exp, ast_binstore)) { - if (parsewarning(parser, WARN_EFFECTLESS_STATEMENT, "statement has no effect")) + if (genwarning(ast_ctx(exp), WARN_EFFECTLESS_STATEMENT, "statement has no effect")) return false; } return true;