]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
actually removing -Wmissing-return-values from parser.c and enabling the ast code...
authorWolfgang (Blub) Bumiller <blub@speed.at>
Fri, 30 Nov 2012 11:11:36 +0000 (12:11 +0100)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Fri, 30 Nov 2012 11:11:36 +0000 (12:11 +0100)
ast.c
parser.c

diff --git a/ast.c b/ast.c
index 188dcec1b27e0e8440e9dc1b01a581976a94a00a..604e6a0c12534ca6db484206d97126ea36b1bd07 100644 (file)
--- a/ast.c
+++ b/ast.c
@@ -1446,14 +1446,15 @@ bool ast_function_codegen(ast_function *self, ir_builder *ir)
     /* TODO: check return types */
     if (!self->curblock->is_return)
     {
+        /*
         return ir_block_create_return(self->curblock, NULL);
-        /* From now on the parser has to handle this situation */
+        */
         if (!self->vtype->expression.next ||
             self->vtype->expression.next->expression.vtype == TYPE_VOID)
         {
             return ir_block_create_return(self->curblock, NULL);
         }
-        else
+        else if (vec_size(self->curblock->entries))
         {
             /* error("missing return"); */
             if (compile_warning(ast_ctx(self), WARN_MISSING_RETURN_VALUES,
index c771dd6d6fb3d5223b663c3a854cd28d38771db4..0c25a23f413a5fe8a91ad3f65768a5ff996f34f8 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -2514,17 +2514,6 @@ static bool parse_block_into(parser_t *parser, ast_block *block, bool warnreturn
     if (parser->tok != '}') {
         block = NULL;
     } else {
-        if (warnreturn && parser->function->vtype->expression.next->expression.vtype != TYPE_VOID)
-        {
-            if (!vec_size(block->exprs) ||
-                !ast_istype(vec_last(block->exprs), ast_return))
-            {
-                if (parsewarning(parser, WARN_MISSING_RETURN_VALUES, "control reaches end of non-void function")) {
-                    block = NULL;
-                    goto cleanup;
-                }
-            }
-        }
         (void)parser_next(parser);
     }