-Wmissing-return-values, off by default, ignored with -std=gmqcc because in that standard it'll error

This commit is contained in:
Wolfgang (Blub) Bumiller 2012-08-18 20:19:43 +02:00
parent 588cd5018f
commit 6223d78ee3
2 changed files with 5 additions and 1 deletions

View file

@ -1616,6 +1616,9 @@ static bool parser_parse_statement(parser_t *parser, ast_block *block, ast_expre
if (!parser_next(parser)) if (!parser_next(parser))
parseerror(parser, "parse error"); parseerror(parser, "parse error");
if (expected->expression.next->expression.vtype != TYPE_VOID) { if (expected->expression.next->expression.vtype != TYPE_VOID) {
if (opts_standard != COMPILER_GMQCC)
parsewarning(parser, WARN_MISSING_RETURN_VALUES, "return without value");
else
parseerror(parser, "return without value"); parseerror(parser, "return without value");
} }
ret = ast_return_new(parser_ctx(parser), NULL); ret = ast_return_new(parser_ctx(parser), NULL);

View file

@ -7,3 +7,4 @@ GMQCC_DEFINE_FLAG(UNUSED_VARIABLE)
GMQCC_DEFINE_FLAG(UNKNOWN_CONTROL_SEQUENCE) GMQCC_DEFINE_FLAG(UNKNOWN_CONTROL_SEQUENCE)
GMQCC_DEFINE_FLAG(EXTENSIONS) GMQCC_DEFINE_FLAG(EXTENSIONS)
GMQCC_DEFINE_FLAG(FIELD_REDECLARED) GMQCC_DEFINE_FLAG(FIELD_REDECLARED)
GMQCC_DEFINE_FLAG(MISSING_RETURN_VALUES)