]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
Don't warn about uninitialized stuff in accessors - remove the liferanges calculated...
authorWolfgang (Blub) Bumiller <blub@speed.at>
Sun, 2 Dec 2012 17:09:59 +0000 (18:09 +0100)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Sun, 2 Dec 2012 17:09:59 +0000 (18:09 +0100)
ast.c
gmqcc.h
main.c

diff --git a/ast.c b/ast.c
index f388eb396924d9201bad77404cdff956c0fa18b8..31df700d2b0e0e1e21235bc9f5380786270af9b7 100644 (file)
--- a/ast.c
+++ b/ast.c
@@ -1403,6 +1403,7 @@ error: /* clean up */
 bool ast_generate_accessors(ast_value *self, ir_builder *ir)
 {
     size_t i;
+    bool warn = OPTS_WARN(WARN_USED_UNINITIALIZED);
     if (!self->setter || !self->getter)
         return true;
     for (i = 0; i < self->expression.count; ++i) {
@@ -1419,12 +1420,15 @@ bool ast_generate_accessors(ast_value *self, ir_builder *ir)
             return false;
         }
     }
+
+    options_set(opts_warn, WARN_USED_UNINITIALIZED, false);
     if (self->setter) {
         if (!ast_global_codegen  (self->setter, ir, false) ||
             !ast_function_codegen(self->setter->constval.vfunc, ir) ||
             !ir_function_finalize(self->setter->constval.vfunc->ir_func))
         {
             compile_error(ast_ctx(self), "internal error: failed to generate setter for `%s`", self->name);
+            options_set(opts_warn, WARN_USED_UNINITIALIZED, warn);
             return false;
         }
     }
@@ -1434,9 +1438,14 @@ bool ast_generate_accessors(ast_value *self, ir_builder *ir)
             !ir_function_finalize(self->getter->constval.vfunc->ir_func))
         {
             compile_error(ast_ctx(self), "internal error: failed to generate getter for `%s`", self->name);
+            options_set(opts_warn, WARN_USED_UNINITIALIZED, warn);
             return false;
         }
     }
+    for (i = 0; i < self->expression.count; ++i) {
+        vec_free(self->ir_values[i]->life);
+    }
+    options_set(opts_warn, WARN_USED_UNINITIALIZED, warn);
     return true;
 }
 
diff --git a/gmqcc.h b/gmqcc.h
index 2253c9ed9e96a57358045c071962dd38ca2fefac..c7d034eea4e12f42a8ff83257eff6925d0cd2dac 100644 (file)
--- a/gmqcc.h
+++ b/gmqcc.h
@@ -946,4 +946,6 @@ extern uint32_t opts_flags       [1 + (COUNT_FLAGS         / 32)];
 extern uint32_t opts_warn        [1 + (COUNT_WARNINGS      / 32)];
 extern uint32_t opts_optimization[1 + (COUNT_OPTIMIZATIONS / 32)];
 
+void options_set(uint32_t *flags, size_t idx, bool on);
+
 #endif
diff --git a/main.c b/main.c
index 220a2e390b85803daed1c2efcbbdd3e96e347598..4e4aa33c270d4479b1c2b9531d5b7b26294ea8f5 100644 (file)
--- a/main.c
+++ b/main.c
@@ -169,7 +169,7 @@ static bool options_long_gcc(const char *optname, int *argc_, char ***argv_, cha
     return options_long_witharg_all(optname, argc_, argv_, out, 1, false);
 }
 
-static void options_set(uint32_t *flags, size_t idx, bool on)
+void options_set(uint32_t *flags, size_t idx, bool on)
 {
     longbit lb = LONGBIT(idx);
 #if 0