forked from github/verilator
Internals: Add warnMore() for all continued messages.
This commit is contained in:
parent
7ab91e660f
commit
53f50463bc
@ -1044,6 +1044,11 @@ void AstNode::v3errorEnd(ostringstream& str) const {
|
||||
}
|
||||
}
|
||||
|
||||
string AstNode::warnMore() const {
|
||||
if (this) return this->fileline()->warnMore();
|
||||
else return V3Error::warnMore();
|
||||
}
|
||||
|
||||
//======================================================================
|
||||
// Data type conversion
|
||||
|
||||
|
@ -1079,6 +1079,7 @@ public:
|
||||
|
||||
// METHODS - dump and error
|
||||
void v3errorEnd(ostringstream& str) const;
|
||||
string warnMore() const;
|
||||
virtual void dump(ostream& str=cout);
|
||||
void dumpGdb(); // For GDB only
|
||||
void dumpGdbHeader() const;
|
||||
|
@ -94,8 +94,9 @@ private:
|
||||
int lsb = isArray ? arrayp->lsb() : 0;
|
||||
if (isArray && ((msb - lsb + 1) > DETECTARRAY_MAX_INDEXES)) {
|
||||
vscp->v3warn(E_DETECTARRAY, "Unsupported: Can't detect more than "<<cvtToStr(DETECTARRAY_MAX_INDEXES)
|
||||
<<" array indexes (probably with UNOPTFLAT warning suppressed): "<<varp->prettyName());
|
||||
vscp->v3warn(E_DETECTARRAY, "... Could recompile with DETECTARRAY_MAX_INDEXES increased to at least "<<cvtToStr(msb-lsb+1));
|
||||
<<" array indexes (probably with UNOPTFLAT warning suppressed): "<<varp->prettyName()<<endl
|
||||
<<vscp->warnMore()
|
||||
<<"... Could recompile with DETECTARRAY_MAX_INDEXES increased to at least "<<cvtToStr(msb-lsb+1));
|
||||
} else if (!isArray
|
||||
&& !varp->dtypeSkipRefp()->castBasicDType()) {
|
||||
if (debug()) varp->dumpTree(cout,"-DETECTARRAY-");
|
||||
|
@ -977,7 +977,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
|
||||
<<V3Error::msgPrefix(V3ErrorCode::EC_ERROR,false)<<errorp->fileline()<<"... Location of non-constant "
|
||||
<<errorp->warnMore()<<"... Location of non-constant "
|
||||
<<errorp->prettyTypeName()<<": "<<simvis.whyNotMessage());
|
||||
replaceZero(nodep); nodep=NULL;
|
||||
} else {
|
||||
|
@ -158,9 +158,9 @@ private:
|
||||
if (oldactivep->sensesp() != m_activep->sensesp()) {
|
||||
if (!varrefp->varp()->fileline()->warnIsOff(V3ErrorCode::MULTIDRIVEN)
|
||||
&& !varrefp->varp()->user2()) {
|
||||
varrefp->varp()->v3warn(MULTIDRIVEN,"Signal has multiple driving blocks: "<<varrefp->varp()->prettyName());
|
||||
varrefp->v3warn(MULTIDRIVEN,"... Location of first driving block");
|
||||
oldactivep->v3warn(MULTIDRIVEN,"... Location of other driving block");
|
||||
varrefp->varp()->v3warn(MULTIDRIVEN,"Signal has multiple driving blocks: "<<varrefp->varp()->prettyName()<<endl
|
||||
<<varrefp->warnMore()<<"... Location of first driving block"<<endl
|
||||
<<oldactivep->warnMore()<<"... Location of other driving block");
|
||||
varrefp->varp()->user2(true);
|
||||
}
|
||||
UINFO(4,"AssignDupDlyVar: "<<varrefp<<endl);
|
||||
|
@ -265,6 +265,14 @@ void FileLine::v3errorEnd(ostringstream& str) {
|
||||
}
|
||||
}
|
||||
|
||||
string FileLine::warnMore() const {
|
||||
if (this && m_lineno) {
|
||||
return V3Error::warnMore()+ascii()+": ";
|
||||
} else {
|
||||
return V3Error::warnMore();
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef VL_LEAK_CHECKS
|
||||
typedef set<FileLine*> FileLineCheckSet;
|
||||
FileLineCheckSet fileLineLeakChecks;
|
||||
@ -370,7 +378,9 @@ bool V3Error::isError(V3ErrorCode code, bool supp) {
|
||||
else return false;
|
||||
}
|
||||
|
||||
string V3Error::msgPrefix(V3ErrorCode code, bool supp) {
|
||||
string V3Error::msgPrefix() {
|
||||
V3ErrorCode code=s_errorCode;
|
||||
bool supp=s_errorSuppressed;
|
||||
if (supp) return "-arning-suppressed: ";
|
||||
else if (code==V3ErrorCode::EC_INFO) return "-Info: ";
|
||||
else if (code==V3ErrorCode::EC_FATAL) return "%Error: ";
|
||||
@ -395,18 +405,6 @@ void V3Error::vlAbort () {
|
||||
//======================================================================
|
||||
// Global Functions
|
||||
|
||||
string V3Error::v3sform (const char* format, ...) {
|
||||
static char msg[1000] = "";
|
||||
|
||||
va_list ap;
|
||||
va_start(ap,format);
|
||||
vsprintf(msg,format,ap);
|
||||
va_end(ap);
|
||||
|
||||
string out = msg;
|
||||
return out;
|
||||
}
|
||||
|
||||
void V3Error::suppressThisWarning() {
|
||||
if (s_errorCode>=V3ErrorCode::EC_MIN) {
|
||||
V3Stats::addStatSum(string("Warnings, Suppressed ")+s_errorCode.ascii(), 1);
|
||||
@ -414,6 +412,10 @@ void V3Error::suppressThisWarning() {
|
||||
}
|
||||
}
|
||||
|
||||
string V3Error::warnMore() {
|
||||
return msgPrefix();
|
||||
}
|
||||
|
||||
void V3Error::v3errorEnd (ostringstream& sstr) {
|
||||
#if defined(__COVERITY__) || defined(__cppcheck__)
|
||||
if (s_errorCode==V3ErrorCode::EC_FATAL) __coverity_panic__(x);
|
||||
|
@ -196,7 +196,7 @@ class V3Error {
|
||||
// ACCESSORS
|
||||
static void debugDefault(int level) { s_debugDefault = level; }
|
||||
static int debugDefault() { return s_debugDefault; }
|
||||
static string msgPrefix(V3ErrorCode code=s_errorCode, bool supp=s_errorSuppressed); // returns %Error/%Warn
|
||||
static string msgPrefix(); // returns %Error/%Warn
|
||||
static int errorCount() { return s_errCount; }
|
||||
static int warnCount() { return s_warnCount; }
|
||||
static int errorOrWarnCount() { return errorCount()+warnCount(); }
|
||||
@ -209,15 +209,17 @@ class V3Error {
|
||||
static void suppressThisWarning(); // Suppress next %Warn if user has it off
|
||||
static void pretendError(V3ErrorCode code, bool flag) { s_pretendError[code]=flag; }
|
||||
static bool isError(V3ErrorCode code, bool supp);
|
||||
static string v3sform (const char* format, ...);
|
||||
static string lineStr (const char* filename, int lineno);
|
||||
static V3ErrorCode errorCode() { return s_errorCode; }
|
||||
|
||||
// When printing an error/warning, print prefix for multiline message
|
||||
static string warnMore();
|
||||
|
||||
// Internals for v3error()/v3fatal() macros only
|
||||
// Error end takes the string stream to output, be careful to seek() as needed
|
||||
static ostringstream& v3errorPrep (V3ErrorCode code) {
|
||||
s_errorStr.str(""); s_errorCode=code; s_errorSuppressed=false; return s_errorStr; }
|
||||
static ostringstream& v3errorStr () { return s_errorStr; }
|
||||
static void v3errorPrep(V3ErrorCode code) {
|
||||
s_errorStr.str(""); s_errorCode=code; s_errorSuppressed=false; }
|
||||
static ostringstream& v3errorStr() { return s_errorStr; }
|
||||
static void vlAbort();
|
||||
static void v3errorEnd(ostringstream& sstr); // static, but often overridden in classes.
|
||||
};
|
||||
@ -228,7 +230,9 @@ inline void v3errorEnd(ostringstream& sstr) { V3Error::v3errorEnd(sstr); }
|
||||
|
||||
// These allow errors using << operators: v3error("foo"<<"bar");
|
||||
// Careful, you can't put () around msg, as you would in most macro definitions
|
||||
#define v3warnCode(code,msg) v3errorEnd(((V3Error::v3errorPrep(code)<<msg),V3Error::v3errorStr()));
|
||||
// Note the commas are the comma operator, not separating arguments. These are needed to insure
|
||||
// evaluation order as otherwise we couldn't insure v3errorPrep is called first.
|
||||
#define v3warnCode(code,msg) v3errorEnd((V3Error::v3errorPrep(code), (V3Error::v3errorStr()<<msg), V3Error::v3errorStr()));
|
||||
#define v3warn(code,msg) v3warnCode(V3ErrorCode::code,msg)
|
||||
#define v3info(msg) v3warn(EC_INFO,msg)
|
||||
#define v3fatal(msg) v3warn(EC_FATAL,msg)
|
||||
@ -375,6 +379,7 @@ public:
|
||||
|
||||
// OPERATORS
|
||||
void v3errorEnd(ostringstream& str);
|
||||
string warnMore() const;
|
||||
inline bool operator==(FileLine rhs) const {
|
||||
return (m_lineno==rhs.m_lineno && m_filenameno==rhs.m_filenameno && m_warnOn==rhs.m_warnOn);
|
||||
}
|
||||
|
@ -687,9 +687,9 @@ void GateVisitor::warnSignals() {
|
||||
&& !sp->fileline()->warnIsOff(V3ErrorCode::SYNCASYNCNET)
|
||||
) {
|
||||
vscp->varp()->user2(true); // Warn only once per signal
|
||||
vscp->v3warn(SYNCASYNCNET,"Signal flopped as both synchronous and async: "<<vscp->prettyName());
|
||||
ap->v3warn(SYNCASYNCNET,"... Location of async usage");
|
||||
sp->v3warn(SYNCASYNCNET,"... Location of sync usage");
|
||||
vscp->v3warn(SYNCASYNCNET,"Signal flopped as both synchronous and async: "<<vscp->prettyName()<<endl
|
||||
<<ap->warnMore()<<"... Location of async usage"<<endl
|
||||
<<sp->warnMore()<<"... Location of sync usage"<<endl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -178,12 +178,12 @@ private:
|
||||
// Begin: ... blocks often replicate under genif/genfor, so simply suppress duplicate checks
|
||||
// See t_gen_forif.v for an example.
|
||||
} else if (nodep->type() == foundp->type()) {
|
||||
nodep->v3error("Duplicate declaration of "<<nodeTextType(foundp)<<": "<<nodep->prettyName());
|
||||
foundp->v3error("... Location of original declaration");
|
||||
nodep->v3error("Duplicate declaration of "<<nodeTextType(foundp)<<": "<<nodep->prettyName()<<endl
|
||||
<<foundp->warnMore()<<"... Location of original declaration");
|
||||
} else {
|
||||
nodep->v3error("Unsupported in C: "<<ucfirst(nodeTextType(nodep))<<" has the same name as "
|
||||
<<nodeTextType(foundp)<<": "<<nodep->prettyName());
|
||||
foundp->v3error("... Location of original declaration");
|
||||
<<nodeTextType(foundp)<<": "<<nodep->prettyName()<<endl
|
||||
<<foundp->warnMore()<<"... Location of original declaration");
|
||||
}
|
||||
}
|
||||
|
||||
@ -324,16 +324,16 @@ private:
|
||||
}
|
||||
nodep->unlinkFrBack()->deleteTree(); nodep=NULL;
|
||||
} else {
|
||||
nodep->v3error("Duplicate declaration of signal: "<<nodep->prettyName());
|
||||
findvarp->v3error("... Location of original declaration");
|
||||
nodep->v3error("Duplicate declaration of signal: "<<nodep->prettyName()<<endl
|
||||
<<findvarp->warnMore()<<"... Location of original declaration");
|
||||
}
|
||||
} else {
|
||||
// User can disable the message at either point
|
||||
if (!(m_ftaskp && m_ftaskp->dpiImport())
|
||||
&& !nodep->fileline()->warnIsOff(V3ErrorCode::VARHIDDEN)
|
||||
&& !foundp->fileline()->warnIsOff(V3ErrorCode::VARHIDDEN)) {
|
||||
nodep->v3warn(VARHIDDEN,"Declaration of signal hides declaration in upper scope: "<<nodep->name());
|
||||
foundp->v3warn(VARHIDDEN,"... Location of original declaration");
|
||||
nodep->v3warn(VARHIDDEN,"Declaration of signal hides declaration in upper scope: "<<nodep->name()<<endl
|
||||
<<foundp->warnMore()<<"... Location of original declaration");
|
||||
}
|
||||
ins = true;
|
||||
}
|
||||
@ -400,14 +400,14 @@ private:
|
||||
} else if (findvarp != nodep) {
|
||||
UINFO(4,"DupVar: "<<nodep<<" ;; "<<foundp<<endl);
|
||||
if (findvarp && findvarp->user3p() == m_curVarsp) { // Only when on same level
|
||||
nodep->v3error("Duplicate declaration of enum value: "<<nodep->prettyName());
|
||||
findvarp->v3error("... Location of original declaration");
|
||||
nodep->v3error("Duplicate declaration of enum value: "<<nodep->prettyName()<<endl
|
||||
<<findvarp->warnMore()<<"... Location of original declaration");
|
||||
} else {
|
||||
// User can disable the message at either point
|
||||
if (!nodep->fileline()->warnIsOff(V3ErrorCode::VARHIDDEN)
|
||||
&& !foundp->fileline()->warnIsOff(V3ErrorCode::VARHIDDEN)) {
|
||||
nodep->v3warn(VARHIDDEN,"Declaration of enum value hides declaration in upper scope: "<<nodep->name());
|
||||
foundp->v3warn(VARHIDDEN,"... Location of original declaration");
|
||||
nodep->v3warn(VARHIDDEN,"Declaration of enum value hides declaration in upper scope: "<<nodep->name()<<endl
|
||||
<<foundp->warnMore()<<"... Location of original declaration");
|
||||
}
|
||||
ins = true;
|
||||
}
|
||||
@ -658,8 +658,9 @@ private:
|
||||
} else {
|
||||
nodep->modVarp(refp);
|
||||
if (refp->user5p() && refp->user5p()->castNode()!=nodep) {
|
||||
nodep->v3error("Duplicate pin connection: "<<nodep->prettyName());
|
||||
refp->user5p()->castNode()->v3error("... Location of original pin connection");
|
||||
nodep->v3error("Duplicate pin connection: "<<nodep->prettyName()<<endl
|
||||
<<refp->user5p()->castNode()->warnMore()
|
||||
<<"... Location of original pin connection");
|
||||
} else {
|
||||
refp->user5p(nodep);
|
||||
}
|
||||
|
@ -294,8 +294,8 @@ private:
|
||||
AstNode* foundp = m_mods.findIdUpward(nodep->name());
|
||||
if (foundp && foundp != nodep) {
|
||||
if (!(foundp->fileline()->warnIsOff(V3ErrorCode::MODDUP) || nodep->fileline()->warnIsOff(V3ErrorCode::MODDUP))) {
|
||||
nodep->v3warn(MODDUP,"Duplicate declaration of module: "<<nodep->prettyName());
|
||||
foundp->v3warn(MODDUP,"... Location of original declaration");
|
||||
nodep->v3warn(MODDUP,"Duplicate declaration of module: "<<nodep->prettyName()<<endl
|
||||
<<foundp->warnMore()<<"... Location of original declaration");
|
||||
}
|
||||
nodep->unlinkFrBack();
|
||||
pushDeletep(nodep); nodep=NULL;
|
||||
|
@ -144,8 +144,8 @@ public:
|
||||
}
|
||||
void checkPurity(AstNodeFTask* nodep, TaskBaseVertex* vxp) {
|
||||
if (!vxp->pure()) {
|
||||
nodep->v3warn(IMPURE,"Unsupported: External variable referenced by non-inlined function/task: "<<nodep->prettyName());
|
||||
vxp->impureNode()->v3warn(IMPURE,"... Location of the external reference: "<<vxp->impureNode()->prettyName());
|
||||
nodep->v3warn(IMPURE,"Unsupported: External variable referenced by non-inlined function/task: "<<nodep->prettyName()<<endl
|
||||
<<vxp->impureNode()->warnMore()<<"... Location of the external reference: "<<vxp->impureNode()->prettyName());
|
||||
}
|
||||
// And, we need to check all tasks this task calls
|
||||
for (V3GraphEdge* edgep = vxp->outBeginp(); edgep; edgep=edgep->outNextp()) {
|
||||
@ -914,9 +914,9 @@ private:
|
||||
m_dpiNames.insert(make_pair(nodep->cname(), make_pair(dpip, dpiproto)));
|
||||
}
|
||||
else if (iter->second.second != dpiproto) {
|
||||
nodep->v3error("Duplicate declaration of DPI function with different formal arguments: "<<nodep->prettyName());
|
||||
nodep->v3error("... New prototype: "<<dpiproto);
|
||||
iter->second.first->v3error("... Original prototype: "<<iter->second.second);
|
||||
nodep->v3error("Duplicate declaration of DPI function with different formal arguments: "<<nodep->prettyName()<<endl
|
||||
<<nodep->warnMore()<<"... New prototype: "<<dpiproto<<endl
|
||||
<<iter->second.first->warnMore()<<"... Original prototype: "<<iter->second.second);
|
||||
}
|
||||
}
|
||||
|
||||
@ -932,8 +932,8 @@ private:
|
||||
if (dpip) {
|
||||
dpip->addArgsp(portp->cloneTree(false));
|
||||
if (!portp->basicp() || portp->basicp()->keyword().isDpiUnsupported()) {
|
||||
portp->v3error("Unsupported: DPI argument of type "<<portp->basicp()->prettyTypeName());
|
||||
portp->v3error("... For best portability, use bit, byte, int, or longint");
|
||||
portp->v3error("Unsupported: DPI argument of type "<<portp->basicp()->prettyTypeName()<<endl
|
||||
<<portp->warnMore()<<"... For best portability, use bit, byte, int, or longint");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -875,8 +875,9 @@ private:
|
||||
num.opAssign(itemp->valuep()->castConst()->num());
|
||||
// Look for duplicates
|
||||
if (inits.find(num) != inits.end()) { // IEEE says illegal
|
||||
itemp->v3error("Overlapping enumeration value: "<<itemp->prettyName());
|
||||
inits.find(num)->second->v3error("... Location of original declaration");
|
||||
itemp->v3error("Overlapping enumeration value: "<<itemp->prettyName()<<endl
|
||||
<<inits.find(num)->second->warnMore()
|
||||
<<"... Location of original declaration");
|
||||
} else {
|
||||
inits.insert(make_pair(num,itemp));
|
||||
}
|
||||
|
@ -17,9 +17,9 @@ compile (
|
||||
make_main => 0,
|
||||
expect=>
|
||||
'%Warning-MULTIDRIVEN: t/t_lint_multidriven_bad.v:\d+: Signal has multiple driving blocks: v.mem
|
||||
%Warning-MULTIDRIVEN: Use ".*" and lint_on around source to disable this message.
|
||||
%Warning-MULTIDRIVEN: t/t_lint_multidriven_bad.v:\d+: ... Location of first driving block
|
||||
%Warning-MULTIDRIVEN: t/t_lint_multidriven_bad.v:\d+: ... Location of other driving block
|
||||
%Warning-MULTIDRIVEN: Use ".*" and lint_on around source to disable this message.
|
||||
%Warning-MULTIDRIVEN: t/t_lint_multidriven_bad.v:\d+: Signal has multiple driving blocks: out2
|
||||
%Warning-MULTIDRIVEN: t/t_lint_multidriven_bad.v:\d+: ... Location of first driving block
|
||||
%Warning-MULTIDRIVEN: t/t_lint_multidriven_bad.v:\d+: ... Location of other driving block
|
||||
|
@ -17,9 +17,9 @@ compile (
|
||||
make_main => 0,
|
||||
expect=>
|
||||
'%Warning-SYNCASYNCNET: t/t_lint_syncasyncnet_bad.v:\d+: Signal flopped as both synchronous and async: rst_both_l
|
||||
%Warning-SYNCASYNCNET: Use .* around source to disable this message.
|
||||
%Warning-SYNCASYNCNET: t/t_lint_syncasyncnet_bad.v:\d+: ... Location of async usage
|
||||
%Warning-SYNCASYNCNET: t/t_lint_syncasyncnet_bad.v:\d+: ... Location of sync usage
|
||||
%Warning-SYNCASYNCNET: Use .* around source to disable this message.
|
||||
%Error: Exiting due to.*',
|
||||
);
|
||||
|
||||
|
@ -12,8 +12,8 @@ compile (
|
||||
fails=>$Self->{v3},
|
||||
expect=>
|
||||
'%Warning-VARHIDDEN: t/t_var_bad_hide2.v:\d+: Declaration of signal hides declaration in upper scope: t
|
||||
.*
|
||||
%Warning-VARHIDDEN: t/t_var_bad_hide2.v:\d+: ... Location of original declaration
|
||||
.*
|
||||
%Error: Exiting due to.*',
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user