From 6223d78ee346a262d4535c4f561b804b5f4bfaab Mon Sep 17 00:00:00 2001 From: "Wolfgang (Blub) Bumiller" Date: Sat, 18 Aug 2012 20:19:43 +0200 Subject: [PATCH] -Wmissing-return-values, off by default, ignored with -std=gmqcc because in that standard it'll error --- parser.c | 5 ++++- warns.def | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/parser.c b/parser.c index 7ef5c9b..1e88517 100644 --- a/parser.c +++ b/parser.c @@ -1616,7 +1616,10 @@ static bool parser_parse_statement(parser_t *parser, ast_block *block, ast_expre if (!parser_next(parser)) parseerror(parser, "parse error"); if (expected->expression.next->expression.vtype != TYPE_VOID) { - parseerror(parser, "return without value"); + if (opts_standard != COMPILER_GMQCC) + parsewarning(parser, WARN_MISSING_RETURN_VALUES, "return without value"); + else + parseerror(parser, "return without value"); } ret = ast_return_new(parser_ctx(parser), NULL); } diff --git a/warns.def b/warns.def index 3136956..030e938 100644 --- a/warns.def +++ b/warns.def @@ -7,3 +7,4 @@ GMQCC_DEFINE_FLAG(UNUSED_VARIABLE) GMQCC_DEFINE_FLAG(UNKNOWN_CONTROL_SEQUENCE) GMQCC_DEFINE_FLAG(EXTENSIONS) GMQCC_DEFINE_FLAG(FIELD_REDECLARED) +GMQCC_DEFINE_FLAG(MISSING_RETURN_VALUES)