use the def's declaration line rather than the function's when reporting auto-initialization
This commit is contained in:
parent
c560744270
commit
966c337bf5
|
@ -310,10 +310,11 @@ check_initialized (expr_t *e)
|
||||||
warning (e, "%s may be used uninitialized", name);
|
warning (e, "%s may be used uninitialized", name);
|
||||||
e->e.def->suppress = 1; // only warn once
|
e->e.def->suppress = 1; // only warn once
|
||||||
if (options.traditional && !e->e.def->set) {
|
if (options.traditional && !e->e.def->set) {
|
||||||
|
def_t *def = e->e.def;
|
||||||
e->e.def->set = 1; // only auto-init once
|
e->e.def->set = 1; // only auto-init once
|
||||||
e = assign_expr (e, new_nil_expr ());
|
e = assign_expr (e, new_nil_expr ());
|
||||||
e->file = current_func->s_file;
|
e->file = def->file;
|
||||||
e->line = current_func->def->line;
|
e->line = def->line;
|
||||||
e->next = current_func->var_init;
|
e->next = current_func->var_init;
|
||||||
current_func->var_init = e;
|
current_func->var_init = e;
|
||||||
notice (e, "auto-initializing %s", name);
|
notice (e, "auto-initializing %s", name);
|
||||||
|
|
Loading…
Reference in New Issue