forked from github/verilator
Fix error message continuations to avoid linenumber repetition
This commit is contained in:
parent
13a20c5ee9
commit
dacf45fea9
@ -1411,6 +1411,7 @@ public:
|
||||
string warnContextPrimary() const { return fileline()->warnContextPrimary(); }
|
||||
string warnContextSecondary() const { return fileline()->warnContextSecondary(); }
|
||||
string warnMore() const { return fileline()->warnMore(); }
|
||||
string warnOther() const { return fileline()->warnOther(); }
|
||||
|
||||
virtual void dump(std::ostream& str=std::cout);
|
||||
void dumpGdb(); // For GDB only
|
||||
|
@ -1228,7 +1228,7 @@ private:
|
||||
AstNode* errorp = simvis.whyNotNodep(); if (!errorp) errorp = nodep;
|
||||
nodep->v3error("Expecting expression to be constant, but can't determine constant for "
|
||||
<<nodep->prettyTypeName()<<endl
|
||||
<<errorp->warnMore()<<"... Location of non-constant "
|
||||
<<errorp->warnOther()<<"... Location of non-constant "
|
||||
<<errorp->prettyTypeName()<<": "<<simvis.whyNotMessage());
|
||||
replaceZero(nodep); VL_DANGLING(nodep);
|
||||
} else {
|
||||
|
@ -165,9 +165,9 @@ private:
|
||||
varrefp->varp()->v3warn(
|
||||
MULTIDRIVEN, "Signal has multiple driving blocks with different clocking: "
|
||||
<<varrefp->varp()->prettyName()<<endl
|
||||
<<varrefp->warnMore()<<"... Location of first driving block"<<endl
|
||||
<<varrefp->warnOther()<<"... Location of first driving block"<<endl
|
||||
<<varrefp->varp()->warnContextPrimary()<<endl
|
||||
<<oldactivep->warnMore()<<"... Location of other driving block"<<endl
|
||||
<<oldactivep->warnOther()<<"... Location of other driving block"<<endl
|
||||
<<oldactivep->warnContextSecondary()
|
||||
);
|
||||
varrefp->varp()->user2(true);
|
||||
|
@ -247,6 +247,13 @@ void FileLine::v3errorEnd(std::ostringstream& str) {
|
||||
}
|
||||
|
||||
string FileLine::warnMore() const {
|
||||
if (m_lineno) {
|
||||
return V3Error::warnMore()+string(ascii().size(), ' ')+": ";
|
||||
} else {
|
||||
return V3Error::warnMore();
|
||||
}
|
||||
}
|
||||
string FileLine::warnOther() const {
|
||||
if (m_lineno) {
|
||||
return V3Error::warnMore()+ascii()+": ";
|
||||
} else {
|
||||
@ -261,7 +268,7 @@ string FileLine::warnContext(bool secondary) const {
|
||||
if (!secondary) { // Avoid printing long paths on informational part of error
|
||||
for (FileLine* parentFl = parent(); parentFl; parentFl = parentFl->parent()) {
|
||||
if (parentFl->filenameIsGlobal()) break;
|
||||
out += parentFl->warnMore()+"... note: In file included from "
|
||||
out += parentFl->warnOther()+"... note: In file included from "
|
||||
+parentFl->filebasename()+"\n";
|
||||
}
|
||||
}
|
||||
|
@ -188,7 +188,11 @@ public:
|
||||
void v3errorEnd(std::ostringstream& str);
|
||||
void v3errorEndFatal(std::ostringstream& str);
|
||||
/// When building an error, prefix for printing continuation lines
|
||||
/// e.g. information referring to the same FileLine as before
|
||||
string warnMore() const;
|
||||
/// When building an error, prefix for printing secondary information
|
||||
/// from a different FileLine than the original error
|
||||
string warnOther() const;
|
||||
/// When building an error, current location in include etc
|
||||
/// If not used in a given error, automatically pasted at end of error
|
||||
string warnContextPrimary() const { return warnContext(false); }
|
||||
|
@ -822,9 +822,9 @@ void GateVisitor::warnSignals() {
|
||||
vscp->varp()->user2(true); // Warn only once per signal
|
||||
vscp->v3warn(SYNCASYNCNET, "Signal flopped as both synchronous and async: "
|
||||
<<vscp->prettyName()<<endl
|
||||
<<ap->warnMore()<<"... Location of async usage"<<endl
|
||||
<<ap->warnOther()<<"... Location of async usage"<<endl
|
||||
<<ap->warnContextPrimary()<<endl
|
||||
<<sp->warnMore()<<"... Location of sync usage"<<endl
|
||||
<<sp->warnOther()<<"... Location of sync usage"<<endl
|
||||
<<sp->warnContextSecondary());
|
||||
}
|
||||
}
|
||||
|
@ -466,7 +466,7 @@ private:
|
||||
nodep->v3warn(MODDUP, "Duplicate declaration of module: "
|
||||
<<nodep->prettyName()<<endl
|
||||
<<nodep->warnContextPrimary()<<endl
|
||||
<<foundp->warnMore()<<"... Location of original declaration"<<endl
|
||||
<<foundp->warnOther()<<"... Location of original declaration"<<endl
|
||||
<<foundp->warnContextSecondary());
|
||||
}
|
||||
nodep->unlinkFrBack();
|
||||
|
@ -228,14 +228,14 @@ public:
|
||||
nodep->v3error("Duplicate declaration of "<<nodeTextType(fnodep)
|
||||
<<": "<<nodep->prettyName()<<endl
|
||||
<<nodep->warnContextPrimary()<<endl
|
||||
<<fnodep->warnMore()<<"... Location of original declaration\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->prettyName()<<endl
|
||||
<<nodep->warnContextPrimary()<<endl
|
||||
<<fnodep->warnMore()<<"... Location of original declaration\n"
|
||||
<<fnodep->warnOther()<<"... Location of original declaration\n"
|
||||
<<fnodep->warnContextSecondary());
|
||||
}
|
||||
}
|
||||
@ -949,7 +949,7 @@ class LinkDotFindVisitor : public AstNVisitor {
|
||||
? nodep->warnMore()+"... note: ANSI ports must have type declared with the I/O (IEEE 2017 23.2.2.2)\n"
|
||||
: "")
|
||||
<<nodep->warnContextPrimary()<<endl
|
||||
<<findvarp->warnMore()<<"... Location of original declaration"<<endl
|
||||
<<findvarp->warnOther()<<"... Location of original declaration"<<endl
|
||||
<<findvarp->warnContextSecondary());
|
||||
// Combining most likely reduce other errors
|
||||
findvarp->combineType(nodep);
|
||||
@ -979,7 +979,7 @@ class LinkDotFindVisitor : public AstNVisitor {
|
||||
nodep->v3warn(VARHIDDEN, "Declaration of signal hides declaration in upper scope: "
|
||||
<<nodep->prettyName()<<endl
|
||||
<<nodep->warnContextPrimary()<<endl
|
||||
<<foundp->nodep()->warnMore()
|
||||
<<foundp->nodep()->warnOther()
|
||||
<<"... Location of original declaration\n"
|
||||
<<foundp->nodep()->warnContextSecondary());
|
||||
}
|
||||
@ -1056,7 +1056,7 @@ class LinkDotFindVisitor : public AstNVisitor {
|
||||
&& !foundp->imported()) { // and not from package
|
||||
nodep->v3error("Duplicate declaration of enum value: "<<nodep->prettyName()<<endl
|
||||
<<nodep->warnContextPrimary()<<endl
|
||||
<<findvarp->warnMore()<<"... Location of original declaration\n"
|
||||
<<findvarp->warnOther()<<"... Location of original declaration\n"
|
||||
<<findvarp->warnContextSecondary());
|
||||
} else {
|
||||
// User can disable the message at either point
|
||||
@ -1065,7 +1065,7 @@ class LinkDotFindVisitor : public AstNVisitor {
|
||||
nodep->v3warn(VARHIDDEN, "Declaration of enum value hides declaration in upper scope: "
|
||||
<<nodep->prettyName()<<endl
|
||||
<<nodep->warnContextPrimary()<<endl
|
||||
<<foundp->nodep()->warnMore()
|
||||
<<foundp->nodep()->warnOther()
|
||||
<<"... Location of original declaration\n"
|
||||
<<nodep->warnContextSecondary());
|
||||
}
|
||||
@ -1243,7 +1243,7 @@ private:
|
||||
if (refp->user4()) {
|
||||
nodep->v3error("Duplicate declaration of port: "<<nodep->prettyName()<<endl
|
||||
<<nodep->warnContextPrimary()<<endl
|
||||
<<refp->warnMore()<<"... Location of original declaration\n"
|
||||
<<refp->warnOther()<<"... Location of original declaration\n"
|
||||
<<refp->warnContextSecondary());
|
||||
}
|
||||
refp->user4(true);
|
||||
@ -1675,7 +1675,7 @@ private:
|
||||
if (refp->user5p() && refp->user5p()!=nodep) {
|
||||
nodep->v3error("Duplicate "<<whatp<<" connection: "<<nodep->prettyName()<<endl
|
||||
<<nodep->warnContextPrimary()<<endl
|
||||
<<refp->user5p()->warnMore()
|
||||
<<refp->user5p()->warnOther()
|
||||
<<"... Location of original "<<whatp<<" connection\n"
|
||||
<<nodep->warnContextSecondary());
|
||||
} else {
|
||||
|
@ -117,12 +117,12 @@ static bool domainsExclusive(const AstSenTree* fromp, const AstSenTree* top);
|
||||
void OrderGraph::loopsVertexCb(V3GraphVertex* vertexp) {
|
||||
if (debug()) cout<<"-Info-Loop: "<<vertexp<<" "<<endl;
|
||||
if (OrderLogicVertex* vvertexp = dynamic_cast<OrderLogicVertex*>(vertexp)) {
|
||||
std::cerr<<vvertexp->nodep()->fileline()->warnMore()
|
||||
std::cerr<<vvertexp->nodep()->fileline()->warnOther()
|
||||
<<" Example path: "
|
||||
<<vvertexp->nodep()->typeName()<<endl;
|
||||
}
|
||||
if (OrderVarVertex* vvertexp = dynamic_cast<OrderVarVertex*>(vertexp)) {
|
||||
std::cerr<<vvertexp->varScp()->fileline()->warnMore()
|
||||
std::cerr<<vvertexp->varScp()->fileline()->warnOther()
|
||||
<<" Example path: "
|
||||
<<vvertexp->varScp()->prettyName()<<endl;
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ public:
|
||||
nodep->v3warn(IMPURE, "Unsupported: External variable referenced by non-inlined function/task: "
|
||||
<<nodep->prettyName()<<endl
|
||||
<<nodep->warnContextPrimary()<<endl
|
||||
<<vxp->impureNode()->warnMore()<<"... Location of the external reference: "
|
||||
<<vxp->impureNode()->warnOther()<<"... Location of the external reference: "
|
||||
<<vxp->impureNode()->prettyName()<<endl
|
||||
<<vxp->impureNode()->warnContextSecondary());
|
||||
}
|
||||
@ -844,7 +844,7 @@ private:
|
||||
<<nodep->prettyName()<<endl
|
||||
<<nodep->warnContextPrimary()<<endl
|
||||
<<nodep->warnMore()<<"... New prototype: "<<dpiproto<<endl
|
||||
<<iter->second.first->warnMore()<<"... Original prototype: "
|
||||
<<iter->second.first->warnOther()<<"... Original prototype: "
|
||||
<<iter->second.second<<endl
|
||||
<<iter->second.first->warnContextSecondary());
|
||||
return true;
|
||||
|
@ -457,7 +457,7 @@ class TristateVisitor : public TristateBaseVisitor {
|
||||
if (oldpullp->direction() != pullp->direction()) {
|
||||
pullp->v3error("Unsupported: Conflicting pull directions.\n"
|
||||
<<pullp->warnContextPrimary()<<endl
|
||||
<<oldpullp->warnMore()<<"... Location of conflicting pull.\n"
|
||||
<<oldpullp->warnOther()<<"... Location of conflicting pull.\n"
|
||||
<<oldpullp->warnContextSecondary());
|
||||
}
|
||||
}
|
||||
|
@ -1389,7 +1389,7 @@ private:
|
||||
AstNode* otherp = inits.find(num)->second;
|
||||
itemp->v3error("Overlapping enumeration value: "<<itemp->prettyName()<<endl
|
||||
<<itemp->warnContextPrimary()<<endl
|
||||
<<otherp->warnMore()
|
||||
<<otherp->warnOther()
|
||||
<<"... Location of original declaration\n"
|
||||
<<otherp->warnContextSecondary());
|
||||
} else {
|
||||
|
@ -1,4 +1,4 @@
|
||||
%Error: t/t_dpi_dup_bad.v:12: Duplicate declaration of DPI function with different formal arguments: t.oth_f_int2
|
||||
t/t_dpi_dup_bad.v:12: ... New prototype: pure int dpii_fa_bit (int, int)
|
||||
: ... New prototype: pure int dpii_fa_bit (int, int)
|
||||
t/t_dpi_dup_bad.v:11: ... Original prototype: int dpii_fa_bit (int)
|
||||
%Error: Exiting due to
|
||||
|
@ -1,5 +1,5 @@
|
||||
%Warning-MULTITOP: t/t_flag_topmodule.v:14: Multiple top level modules: a2 and a
|
||||
t/t_flag_topmodule.v:14: ... Suggest see manual; fix the duplicates, or use --top-module to select top.
|
||||
: ... Suggest see manual; fix the duplicates, or use --top-module to select top.
|
||||
... Use "/* verilator lint_off MULTITOP */" and lint_on around source to disable this message.
|
||||
%Warning-MULTITOP: t/t_flag_topmodule.v:21: Multiple top level modules: b and a2
|
||||
%Error: Exiting due to
|
||||
|
@ -1,4 +1,4 @@
|
||||
%Error: t/t_lint_pkg_colon_bad.v:6: syntax error, unexpected ::, expecting ')' or ','
|
||||
t/t_lint_pkg_colon_bad.v:6: ... Perhaps 'mispkg' is a package which needs to be predeclared? (IEEE 2017 26.3)
|
||||
: ... Perhaps 'mispkg' is a package which needs to be predeclared? (IEEE 2017 26.3)
|
||||
%Error: t/t_lint_pkg_colon_bad.v:7: syntax error, unexpected ::, expecting ',' or ';'
|
||||
%Error: Exiting due to
|
||||
|
@ -2,5 +2,5 @@
|
||||
t/t_mod_dup_bad.v:6: ... Location of original declaration
|
||||
... Use "/* verilator lint_off MODDUP */" and lint_on around source to disable this message.
|
||||
%Warning-MULTITOP: t/t_mod_dup_bad.v:16: Multiple top level modules: b and test
|
||||
t/t_mod_dup_bad.v:16: ... Suggest see manual; fix the duplicates, or use --top-module to select top.
|
||||
: ... Suggest see manual; fix the duplicates, or use --top-module to select top.
|
||||
%Error: Exiting due to
|
||||
|
@ -1,5 +1,5 @@
|
||||
%Warning-MULTITOP: t/t_multitop_sig.v:14: Multiple top level modules: b and a
|
||||
t/t_multitop_sig.v:14: ... Suggest see manual; fix the duplicates, or use --top-module to select top.
|
||||
: ... Suggest see manual; fix the duplicates, or use --top-module to select top.
|
||||
... Use "/* verilator lint_off MULTITOP */" and lint_on around source to disable this message.
|
||||
%Warning-MULTITOP: t/t_multitop_sig.v:22: Multiple top level modules: c and b
|
||||
%Error: Exiting due to
|
||||
|
@ -1,5 +1,5 @@
|
||||
%Error: t/t_var_dup2_bad.v:12: Duplicate declaration of signal: bad_o_w
|
||||
t/t_var_dup2_bad.v:12: ... note: ANSI ports must have type declared with the I/O (IEEE 2017 23.2.2.2)
|
||||
: ... note: ANSI ports must have type declared with the I/O (IEEE 2017 23.2.2.2)
|
||||
t/t_var_dup2_bad.v:9: ... Location of original declaration
|
||||
%Error: t/t_var_dup2_bad.v:13: Duplicate declaration of signal: bad_o_r
|
||||
t/t_var_dup2_bad.v:10: ... Location of original declaration
|
||||
|
Loading…
Reference in New Issue
Block a user