diff --git a/tools/qfcc/include/def.h b/tools/qfcc/include/def.h index f21d2e4cb..75aca5ab0 100644 --- a/tools/qfcc/include/def.h +++ b/tools/qfcc/include/def.h @@ -43,6 +43,7 @@ typedef struct def_s { struct reloc_s *refs; // for relocations unsigned initialized:1; // for uninit var detection + unsigned suppress:1; // for uninit var detection suppression unsigned set:1; // uninit var auto-inited unsigned constant:1; // 1 when a declaration included "= immediate" unsigned freed:1; // already freed from the scope diff --git a/tools/qfcc/source/expr.c b/tools/qfcc/source/expr.c index c8bbab53e..3c80349a1 100644 --- a/tools/qfcc/source/expr.c +++ b/tools/qfcc/source/expr.c @@ -306,9 +306,9 @@ check_initialized (expr_t *e) && !e->e.def->external && !e->e.def->initialized) { name = e->e.def->name; - if (options.warnings.uninited_variable) + if (options.warnings.uninited_variable && !e->e.def->suppress) warning (e, "%s may be used uninitialized", name); - e->e.def->initialized = 1; // only warn once + e->e.def->suppress = 1; // only warn once if (options.traditional && !e->e.def->set) { e->e.def->set = 1; // only auto-init once e = assign_expr (e, new_nil_expr ());