Report declaration position when warning about declaration after use.

This commit is contained in:
Martin Whitaker 2026-03-21 18:26:53 +00:00
parent 29e128ed94
commit dc0d162fa9
1 changed files with 6 additions and 0 deletions

View File

@ -175,6 +175,8 @@ bool symbol_search(const LineInfo*li, Design*des, NetScope*scope,
cerr << li->get_fileline()
<< ": warning: net `" << path_tail.name
<< "` used before declaration." << endl;
cerr << net->get_fileline()
<< ": : the net is declared here." << endl;
// suppress further warnings for this net
net->lexical_pos(lexical_pos);
}
@ -195,6 +197,8 @@ bool symbol_search(const LineInfo*li, Design*des, NetScope*scope,
cerr << li->get_fileline()
<< ": warning: event `" << path_tail.name
<< "` used before declaration." << endl;
cerr << eve->get_fileline()
<< ": : the event is declared here." << endl;
// suppress further warnings for this event
eve->lexical_pos(lexical_pos);
}
@ -216,6 +220,8 @@ bool symbol_search(const LineInfo*li, Design*des, NetScope*scope,
cerr << li->get_fileline()
<< ": warning: parameter `" << path_tail.name
<< "` used before declaration." << endl;
cerr << par->get_fileline()
<< ": : the parameter is declared here." << endl;
// suppress further warnings for this parameter
scope->set_parameter_lexical_pos(path_tail.name, lexical_pos);
}