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...

This commit is contained in:
Wolfgang (Blub) Bumiller 2012-08-23 20:56:05 +02:00
parent cb604603ca
commit 41d1ef37d2

View file

@ -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_call) &&
!ast_istype(increment, ast_binstore)) !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; 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_call) &&
!ast_istype(exp, ast_binstore)) !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 false;
} }
return true; return true;