From bea225e191393c71d18a758484d4d05c6f5309be Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sat, 28 Jan 2023 11:55:44 -0500 Subject: [PATCH] Fix duplicate name check on extern symbols --- src/V3LinkDot.cpp | 6 ++++-- test_regress/t/t_class_extern_bad.out | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/V3LinkDot.cpp b/src/V3LinkDot.cpp index 5301de451..d5019866b 100644 --- a/src/V3LinkDot.cpp +++ b/src/V3LinkDot.cpp @@ -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()); diff --git a/test_regress/t/t_class_extern_bad.out b/test_regress/t/t_class_extern_bad.out index e324308c0..96a3e2bb1 100644 --- a/test_regress/t/t_class_extern_bad.out +++ b/test_regress/t/t_class_extern_bad.out @@ -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