mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-02-20 18:32:01 +00:00
-Weffectless-statement, on by default, creates 'statement has no effect' warning
This commit is contained in:
parent
dff6328c9e
commit
45388202c4
3 changed files with 9 additions and 0 deletions
1
main.c
1
main.c
|
@ -402,6 +402,7 @@ int main(int argc, char **argv) {
|
|||
options_set(opts_warn, WARN_VARIADIC_FUNCTION, true);
|
||||
options_set(opts_warn, WARN_FRAME_MACROS, true);
|
||||
options_set(opts_warn, WARN_UNUSED_VARIABLE, true);
|
||||
options_set(opts_warn, WARN_EFFECTLESS_STATEMENT, true);
|
||||
|
||||
if (!options_parse(argc, argv)) {
|
||||
return usage();
|
||||
|
|
7
parser.c
7
parser.c
|
@ -1768,6 +1768,13 @@ static bool parser_parse_statement(parser_t *parser, ast_block *block, ast_expre
|
|||
if (!exp)
|
||||
return false;
|
||||
*out = exp;
|
||||
if (!ast_istype(exp, ast_store) &&
|
||||
!ast_istype(exp, ast_call) &&
|
||||
!ast_istype(exp, ast_binstore))
|
||||
{
|
||||
if (parsewarning(parser, WARN_EFFECTLESS_STATEMENT, "statement has no effect"))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,3 +16,4 @@ GMQCC_DEFINE_FLAG(VOID_VARIABLES)
|
|||
GMQCC_DEFINE_FLAG(IMPLICIT_FUNCTION_POINTER)
|
||||
GMQCC_DEFINE_FLAG(VARIADIC_FUNCTION)
|
||||
GMQCC_DEFINE_FLAG(FRAME_MACROS)
|
||||
GMQCC_DEFINE_FLAG(EFFECTLESS_STATEMENT)
|
||||
|
|
Loading…
Reference in a new issue