Fix duplicate name check on extern symbols

This commit is contained in:
Wilson Snyder 2023-01-28 11:55:44 -05:00
parent 93517b8378
commit bea225e191
2 changed files with 5 additions and 3 deletions

View File

@ -273,14 +273,16 @@ public:
UINFO(4, "Var2 " << fnodep << endl);
if (nodep->type() == fnodep->type()) {
nodep->v3error("Duplicate declaration of "
<< nodeTextType(fnodep) << ": " << nodep->prettyNameQ() << '\n'
<< nodeTextType(fnodep) << ": " << AstNode::prettyNameQ(name)
<< '\n'
<< nodep->warnContextPrimary() << '\n'
<< fnodep->warnOther() << "... Location of original declaration\n"
<< fnodep->warnContextSecondary());
} else {
nodep->v3error("Unsupported in C: "
<< ucfirst(nodeTextType(nodep)) << " has the same name as "
<< nodeTextType(fnodep) << ": " << nodep->prettyNameQ() << '\n'
<< nodeTextType(fnodep) << ": " << AstNode::prettyNameQ(name)
<< '\n'
<< nodep->warnContextPrimary() << '\n'
<< fnodep->warnOther() << "... Location of original declaration\n"
<< fnodep->warnContextSecondary());

View File

@ -1,4 +1,4 @@
%Error: t/t_class_extern_bad.v:9:16: Duplicate declaration of task: 'nodef'
%Error: t/t_class_extern_bad.v:9:16: Duplicate declaration of task: 'extern nodef'
9 | extern task nodef();
| ^~~~~
t/t_class_extern_bad.v:8:16: ... Location of original declaration