From: Wolfgang (Blub) Bumiller Date: Thu, 23 Aug 2012 15:22:13 +0000 (+0200) Subject: it's not the IR's job to fail when a local of the same name is created twice... X-Git-Tag: 0.1-rc1~72 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f9746a59ae2d39df53d1526527297b52121581cf;p=xonotic%2Fgmqcc.git it's not the IR's job to fail when a local of the same name is created twice... --- diff --git a/ast.c b/ast.c index be3f93b..365803b 100644 --- a/ast.c +++ b/ast.c @@ -995,8 +995,11 @@ bool ast_block_codegen(ast_block *self, ast_function *func, bool lvalue, ir_valu /* generate locals */ for (i = 0; i < self->locals_count; ++i) { - if (!ast_local_codegen(self->locals[i], func->ir_func, false)) + if (!ast_local_codegen(self->locals[i], func->ir_func, false)) { + if (opts_debug) + asterror(ast_ctx(self), "failed to generate local `%s`", self->locals[i]->name); return false; + } } for (i = 0; i < self->exprs_count; ++i) diff --git a/ir.c b/ir.c index 47b9adc..4dc7914 100644 --- a/ir.c +++ b/ir.c @@ -138,7 +138,7 @@ static bool irwarning(lex_ctx ctx, int warntype, const char *fmt, ...) va_list ap; int lvl = LVL_WARNING; - if (!OPTS_WARN(warntype)) + if (warntype && !OPTS_WARN(warntype)) return false; if (opts_werror) @@ -426,10 +426,12 @@ ir_value* ir_function_get_local(ir_function *self, const char *name) ir_value* ir_function_create_local(ir_function *self, const char *name, int vtype, bool param) { - ir_value *ve = ir_function_get_local(self, name); - if (ve) { + ir_value *ve; + + /* + if (ir_function_get_local(self, name)) return NULL; - } + */ if (param && self->locals_count &&