]> de.git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
take 'warnreturn' into account, don't ignore the parsewarnin's Werror status
authorWolfgang (Blub) Bumiller <blub@speed.at>
Sun, 19 Aug 2012 18:32:07 +0000 (20:32 +0200)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Sun, 19 Aug 2012 18:32:07 +0000 (20:32 +0200)
parser.c

index e608223925eee933c3650ca8e77e82c7a87fcf7a..06f6d7a37705f29dd8a217c56ec10e90924411bb 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -1749,12 +1749,15 @@ 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 (warnreturn && 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");
+                if (parsewarning(parser, WARN_MISSING_RETURN_VALUES, "control reaches end of non-void function")) {
+                    block = NULL;
+                    goto cleanup;
+                }
             }
         }
         (void)parser_next(parser);