mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-01-31 03:50:36 +00:00
set -Wmissing-return-values to on by default, new warning: control reaches end of non-void...
This commit is contained in:
parent
66ec592f94
commit
7ef248aadb
2 changed files with 9 additions and 0 deletions
1
main.c
1
main.c
|
@ -382,6 +382,7 @@ int main(int argc, char **argv) {
|
|||
options_set(opts_warn, WARN_EXTENSIONS, true);
|
||||
options_set(opts_warn, WARN_FIELD_REDECLARED, true);
|
||||
options_set(opts_warn, WARN_TOO_FEW_PARAMETERS, true);
|
||||
options_set(opts_warn, WARN_MISSING_RETURN_VALUES, true);
|
||||
|
||||
if (!options_parse(argc, argv)) {
|
||||
return usage();
|
||||
|
|
8
parser.c
8
parser.c
|
@ -1749,6 +1749,14 @@ static bool parser_parse_block_into(parser_t *parser, ast_block *block, bool war
|
|||
if (parser->tok != '}') {
|
||||
block = NULL;
|
||||
} else {
|
||||
if (parser->function->vtype->expression.next->expression.vtype != TYPE_VOID)
|
||||
{
|
||||
if (!block->exprs_count ||
|
||||
!ast_istype(block->exprs[block->exprs_count-1], ast_return))
|
||||
{
|
||||
parsewarning(parser, WARN_MISSING_RETURN_VALUES, "control reaches end of non-void function");
|
||||
}
|
||||
}
|
||||
(void)parser_next(parser);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue