forked from github/verilator
Fix cppcheck warnings. No functional change.
This commit is contained in:
parent
e5af46d3fb
commit
8323092a0c
@ -406,7 +406,8 @@ endif
|
||||
|
||||
# Use --xml flag to see the cppcheck code to use for suppression
|
||||
CPPCHECK = src/cppcheck_filtered
|
||||
CPPCHECK_FLAGS = --enable=all --inline-suppr --suppress=unusedScopedObject --suppress=cstyleCast
|
||||
CPPCHECK_FLAGS = --enable=all --inline-suppr \
|
||||
--suppress=unusedScopedObject --suppress=cstyleCast --suppress=useInitializationList
|
||||
CPPCHECK_FLAGS += --xml
|
||||
CPPCHECK_CPP = $(wildcard $(srcdir)/include/*.cpp $(srcdir)/src/*.cpp)
|
||||
CPPCHECK_DEP = $(subst .cpp,.cppcheck,$(CPPCHECK_CPP))
|
||||
|
@ -487,7 +487,6 @@ static inline int _vl_vsss_peek(FILE* fp, int& floc, WDataInP fromp, const stri
|
||||
if (floc < 0) return EOF;
|
||||
floc = floc & ~7; // Align to closest character
|
||||
if (fromp == NULL) {
|
||||
int c = fstr[fstr.length()-1 - (floc>>3)];
|
||||
return fstr[fstr.length()-1 - (floc>>3)];
|
||||
} else {
|
||||
return (fromp[VL_BITWORD_I(floc)] >> VL_BITBIT_I(floc)) & 0xff;
|
||||
|
@ -1132,7 +1132,9 @@ static inline WDataOutP VL_DIVS_WWW(int lbits, WDataOutP owp,WDataInP lwp,WDataI
|
||||
int words = VL_WORDS_I(lbits);
|
||||
IData lsign = VL_SIGN_I(lbits,lwp[words-1]);
|
||||
IData rsign = VL_SIGN_I(lbits,rwp[words-1]);
|
||||
// cppcheck-suppress variableScope
|
||||
IData lwstore[VL_MULS_MAX_WORDS]; // Fixed size, as MSVC++ doesn't allow [words] here
|
||||
// cppcheck-suppress variableScope
|
||||
IData rwstore[VL_MULS_MAX_WORDS];
|
||||
WDataInP ltup = lwp;
|
||||
WDataInP rtup = rwp;
|
||||
@ -1151,7 +1153,9 @@ static inline WDataOutP VL_MODDIVS_WWW(int lbits, WDataOutP owp,WDataInP lwp,WDa
|
||||
int words = VL_WORDS_I(lbits);
|
||||
IData lsign = VL_SIGN_I(lbits,lwp[words-1]);
|
||||
IData rsign = VL_SIGN_I(lbits,rwp[words-1]);
|
||||
// cppcheck-suppress variableScope
|
||||
IData lwstore[VL_MULS_MAX_WORDS]; // Fixed size, as MSVC++ doesn't allow [words] here
|
||||
// cppcheck-suppress variableScope
|
||||
IData rwstore[VL_MULS_MAX_WORDS];
|
||||
WDataInP ltup = lwp;
|
||||
WDataInP rtup = rwp;
|
||||
|
@ -52,7 +52,10 @@ public: // But only local to this file
|
||||
// CONSTRUCTORS
|
||||
// Derived classes should call zero() in their constructor
|
||||
VerilatedCovImpItem() {
|
||||
for (int i=0; i<MAX_KEYS; i++) m_keys[i]=KEY_UNDEF;
|
||||
for (int i=0; i<MAX_KEYS; i++) {
|
||||
m_keys[i]=KEY_UNDEF;
|
||||
m_vals[i]=0;
|
||||
}
|
||||
}
|
||||
virtual ~VerilatedCovImpItem() {}
|
||||
virtual vluint64_t count() const = 0;
|
||||
|
@ -82,7 +82,7 @@ void svGetPartselLogic(svLogicVecVal* d, const svLogicVecVal* s, int i, int w) {
|
||||
void svPutPartselBit(svBitVecVal* d, const svBitVecVal s, int i, int w) {
|
||||
_VL_SVDPI_UNIMP();
|
||||
}
|
||||
void svPutPartselLogic(svLogicVecVal* d, const svLogicVecVal s, int i, int w) {
|
||||
void svPutPartselLogic(svLogicVecVal* d, const svLogicVecVal* s, int i, int w) {
|
||||
_VL_SVDPI_UNIMP();
|
||||
}
|
||||
|
||||
|
@ -308,13 +308,11 @@ void VerilatedVcd::bufferFlush () {
|
||||
// Simple methods
|
||||
|
||||
void VerilatedVcd::set_time_unit (const char* unitp) {
|
||||
string unitstr (unitp);
|
||||
//cout<<" set_time_unit ("<<unitp<<") == "<<timescaleToDouble(unitp)<<" == "<<doubleToTimescale(timescaleToDouble(unitp))<<endl;
|
||||
m_timeUnit = timescaleToDouble(unitp);
|
||||
}
|
||||
|
||||
void VerilatedVcd::set_time_resolution (const char* unitp) {
|
||||
string unitstr (unitp);
|
||||
//cout<<"set_time_resolution ("<<unitp<<") == "<<timescaleToDouble(unitp)<<" == "<<doubleToTimescale(timescaleToDouble(unitp))<<endl;
|
||||
m_timeRes = timescaleToDouble(unitp);
|
||||
}
|
||||
@ -440,7 +438,7 @@ void VerilatedVcd::dumpHeader () {
|
||||
deleteNameMap();
|
||||
}
|
||||
|
||||
void VerilatedVcd::module (string name) {
|
||||
void VerilatedVcd::module (const string& name) {
|
||||
m_modName = name;
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,7 @@ public:
|
||||
void* userthis);
|
||||
|
||||
/// Inside dumping routines, declare a module
|
||||
void module (const string name);
|
||||
void module (const string& name);
|
||||
/// Inside dumping routines, declare a signal
|
||||
void declBit (vluint32_t code, const char* name, int arraynum);
|
||||
void declBus (vluint32_t code, const char* name, int arraynum, int msb, int lsb);
|
||||
|
@ -787,6 +787,7 @@ void vpi_put_delays(vpiHandle object, p_vpi_delay delay_p) {
|
||||
|
||||
void vpi_get_value(vpiHandle object, p_vpi_value value_p) {
|
||||
static VL_THREAD char outStr[1+VL_MULS_MAX_WORDS*32]; // Maximum required size is for binary string, one byte per bit plus null termination
|
||||
// cppcheck-suppress variableScope
|
||||
static VL_THREAD int outStrSz = sizeof(outStr)-1;
|
||||
VL_DEBUG_IF_PLI(VL_PRINTF("-vltVpi: vpi_get_value %p\n",object););
|
||||
_VL_VPI_ERROR_RESET(); // reset vpi error status
|
||||
|
@ -155,7 +155,7 @@ XXTERN void svGetPartselBit(svBitVecVal* d, const svBitVecVal* s, int i, int w);
|
||||
XXTERN void svGetPartselLogic(svLogicVecVal* d, const svLogicVecVal* s, int i, int w);
|
||||
|
||||
XXTERN void svPutPartselBit(svBitVecVal* d, const svBitVecVal s, int i, int w);
|
||||
XXTERN void svPutPartselLogic(svLogicVecVal* d, const svLogicVecVal s, int i, int w);
|
||||
XXTERN void svPutPartselLogic(svLogicVecVal* d, const svLogicVecVal* s, int i, int w);
|
||||
|
||||
/*
|
||||
* Open array querying functions
|
||||
@ -427,7 +427,7 @@ XXTERN void svGetPartSelectLogic(svLogicVec32* d, const svLogicPackedArrRef s,
|
||||
/* actual <-- canonical */
|
||||
XXTERN void svPutPartSelectBit(svBitPackedArrRef d, const svBitVec32 s,
|
||||
int i, int w);
|
||||
XXTERN void svPutPartSelectLogic(svLogicPackedArrRef d, const svLogicVec32 s,
|
||||
XXTERN void svPutPartSelectLogic(svLogicPackedArrRef d, const svLogicVec32* s,
|
||||
int i, int w);
|
||||
|
||||
/*
|
||||
|
@ -88,21 +88,6 @@ private:
|
||||
return newp;
|
||||
}
|
||||
|
||||
AstNode* newIfCoverageOn(AstNode* nodep) {
|
||||
// Add a internal if to check coverage is on
|
||||
// Don't make this a AND term, as it's unlikely to need to test this.
|
||||
AstNode* newp
|
||||
= new AstIf (nodep->fileline(),
|
||||
// If assertions are off, have constant propagation rip them out later
|
||||
// This allows syntax errors and such to be detected normally.
|
||||
(v3Global.opt.coverage()
|
||||
? (AstNode*)(new AstConst(nodep->fileline(), AstConst::LogicTrue()))
|
||||
: (AstNode*)(new AstConst(nodep->fileline(), AstConst::LogicFalse()))),
|
||||
nodep, NULL);
|
||||
newp->user1(true); // Don't assert/cover this if
|
||||
return newp;
|
||||
}
|
||||
|
||||
AstNode* newFireAssert(AstNode* nodep, const string& message) {
|
||||
AstDisplay* dispp = new AstDisplay (nodep->fileline(), AstDisplayType::DT_ERROR, message, NULL, NULL);
|
||||
AstNode* bodysp = dispp;
|
||||
|
@ -918,7 +918,6 @@ void AstTypeTable::dump(ostream& str) {
|
||||
for (DetailedMap::const_iterator it = mapr.begin(); it != mapr.end(); ++it) {
|
||||
AstBasicDType* dtypep = it->second;
|
||||
str<<endl; // Newline from caller, so newline first
|
||||
stringstream nsstr;
|
||||
str<<"\t\tdetailed -> ";
|
||||
dtypep->dump(str);
|
||||
}
|
||||
|
@ -411,6 +411,7 @@ private:
|
||||
AstNode* itemexprp = ifexprp; ifexprp=NULL;
|
||||
if (depth == (CASE_ENCODER_GROUP_DEPTH)) { // End of group - can skip the condition
|
||||
itemexprp->deleteTree(); itemexprp=NULL;
|
||||
// cppcheck-suppress redundantAssignment
|
||||
itemexprp = new AstConst(itemp->fileline(), AstConst::LogicTrue());
|
||||
}
|
||||
AstIf* newp = new AstIf(itemp->fileline(), itemexprp, istmtsp, NULL);
|
||||
@ -462,6 +463,7 @@ private:
|
||||
replaceCaseFast(nodep); nodep=NULL;
|
||||
} else {
|
||||
++m_statCaseSlow;
|
||||
// cppcheck-supporess uselessAssignmentPtrArg
|
||||
replaceCaseComplicated(nodep); nodep=NULL;
|
||||
}
|
||||
}
|
||||
|
@ -99,18 +99,6 @@ private:
|
||||
UINFO(4,"New Last: "<<newvscp<<endl);
|
||||
return newvscp;
|
||||
}
|
||||
AstVarScope* getCreateLocalVar(FileLine* fl, const string& name, AstVar* examplep, int width) {
|
||||
AstVar* newvarp;
|
||||
if (width) {
|
||||
newvarp = new AstVar (fl, AstVarType::BLOCKTEMP, name, VFlagLogicPacked(), width);
|
||||
} else {
|
||||
newvarp = new AstVar (fl, AstVarType::BLOCKTEMP, name, examplep); // No range; 1 bit.
|
||||
}
|
||||
m_modp->addStmtp(newvarp);
|
||||
AstVarScope* newvscp = new AstVarScope(fl, m_scopep, newvarp);
|
||||
m_scopep->addVarp(newvscp);
|
||||
return newvscp;
|
||||
}
|
||||
AstNode* createSenItemEquation(AstSenItem* nodep) {
|
||||
// We know the var is clean, and one bit, so we use binary ops
|
||||
// for speed instead of logical ops.
|
||||
|
@ -737,7 +737,6 @@ class EmitCImp : EmitCStmts {
|
||||
// METHODS
|
||||
|
||||
void doubleOrDetect(AstChangeDet* changep, bool& gotOne) {
|
||||
static int addDoubleOr = 10; // Determined experimentally as best
|
||||
if (!changep->rhsp()) {
|
||||
if (!gotOne) gotOne = true;
|
||||
else puts(" | ");
|
||||
@ -746,6 +745,7 @@ class EmitCImp : EmitCStmts {
|
||||
else {
|
||||
AstNode* lhsp = changep->lhsp();
|
||||
AstNode* rhsp = changep->rhsp();
|
||||
static int addDoubleOr = 10; // Determined experimentally as best
|
||||
if (!lhsp->castVarRef() && !lhsp->castArraySel()) changep->v3fatalSrc("Not ref?");
|
||||
if (!rhsp->castVarRef() && !rhsp->castArraySel()) changep->v3fatalSrc("Not ref?");
|
||||
for (int word=0; word<changep->lhsp()->widthWords(); word++) {
|
||||
@ -2103,7 +2103,6 @@ void EmitCImp::main(AstNodeModule* modp, bool slow, bool fast) {
|
||||
m_modp = modp;
|
||||
m_slow = slow;
|
||||
m_fast = fast;
|
||||
string filenameNoExt = v3Global.opt.makeDir()+"/"+ modClassName(modp)+(m_fast ? "" : "__Slow");
|
||||
|
||||
if (debug()>=5) {
|
||||
UINFO(0," Emitting "<<modClassName(modp)<<endl);
|
||||
|
@ -70,6 +70,7 @@ class EmitCSyms : EmitCBaseVisitor {
|
||||
struct CmpDpi {
|
||||
inline bool operator () (const AstCFunc* lhsp, const AstCFunc* rhsp) const {
|
||||
if (lhsp->dpiImport() != rhsp->dpiImport()) {
|
||||
// cppcheck-suppress comparisonOfFuncReturningBoolError
|
||||
return lhsp->dpiImport() < rhsp->dpiImport();
|
||||
}
|
||||
return lhsp->name() < rhsp->name();
|
||||
|
@ -47,7 +47,8 @@ protected:
|
||||
public:
|
||||
|
||||
GraphAcycVertex(V3Graph* graphp, V3GraphVertex* origVertexp)
|
||||
: V3GraphVertex(graphp), m_origVertexp(origVertexp), m_onWorkList(false), m_deleted(false) {
|
||||
: V3GraphVertex(graphp), m_origVertexp(origVertexp)
|
||||
, m_storedRank(0), m_onWorkList(false), m_deleted(false) {
|
||||
}
|
||||
virtual ~GraphAcycVertex() {}
|
||||
V3GraphVertex* origVertexp() const { return m_origVertexp; }
|
||||
@ -185,6 +186,7 @@ public:
|
||||
GraphAcyc(V3Graph* origGraphp, V3EdgeFuncP edgeFuncp) {
|
||||
m_origGraphp = origGraphp;
|
||||
m_origEdgeFuncp = edgeFuncp;
|
||||
m_placeStep = 0;
|
||||
}
|
||||
~GraphAcyc() {
|
||||
for (vector<OrigEdgeList*>::iterator it = m_origEdgeDelp.begin(); it != m_origEdgeDelp.end(); ++it) {
|
||||
|
@ -74,7 +74,7 @@ private:
|
||||
// METHODS
|
||||
DfaGraph* graphp() { return static_cast<DfaGraph*>(m_graphp); }
|
||||
bool nfaState(V3GraphVertex* vertexp) { return vertexp->color()==0; }
|
||||
bool dfaState(V3GraphVertex* vertexp) { return vertexp->color()==1; }
|
||||
//bool dfaState(V3GraphVertex* vertexp) { return vertexp->color()==1; }
|
||||
|
||||
void nextStep() { m_step++; }
|
||||
|
||||
|
@ -163,7 +163,7 @@ public:
|
||||
if (debug()>4) oldassp->dumpTree(cout, " REMOVE/SAMEBLK ");
|
||||
entp->complexAssign();
|
||||
m_statep->pushUnlinkDeletep(oldassp); oldassp=NULL;
|
||||
m_statep->m_statAssnDel++;
|
||||
++m_statep->m_statAssnDel;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -200,7 +200,7 @@ public:
|
||||
UINFO(4," replaceconst: "<<varrefp<<endl);
|
||||
varrefp->replaceWith(constp->cloneTree(false));
|
||||
varrefp->deleteTree(); varrefp=NULL;
|
||||
m_statep->m_statAssnCon++;
|
||||
++m_statep->m_statAssnCon;
|
||||
return; // **DONE, no longer a var reference**
|
||||
}
|
||||
}
|
||||
|
@ -1558,9 +1558,9 @@ private:
|
||||
string expectWhat;
|
||||
bool allowScope = false;
|
||||
bool allowVar = false;
|
||||
AstPackage* packagep = NULL;
|
||||
if (m_ds.m_dotPos == DP_PACKAGE) {
|
||||
// {package}::{a}
|
||||
AstPackage* packagep = NULL;
|
||||
expectWhat = "scope/variable";
|
||||
allowScope = true;
|
||||
allowVar = true;
|
||||
|
@ -587,7 +587,7 @@ string V3Options::getenvVERILATOR_ROOT() {
|
||||
string var = getenvStr("VERILATOR_ROOT","");
|
||||
if (var == "" && string(DEFENV_VERILATOR_ROOT) != "") {
|
||||
var = DEFENV_VERILATOR_ROOT;
|
||||
setenvStr("VERILATOR_ROOT", var.c_str(), "Hardcoded at build time");
|
||||
setenvStr("VERILATOR_ROOT", var, "Hardcoded at build time");
|
||||
}
|
||||
if (var == "") {
|
||||
v3fatal("$VERILATOR_ROOT needs to be in environment\n");
|
||||
@ -1074,7 +1074,6 @@ void V3Options::parseOptsFile(FileLine* fl, const string& filename, bool rel) {
|
||||
}
|
||||
|
||||
string whole_file;
|
||||
string::size_type pos;
|
||||
bool inCmt = false;
|
||||
while (!ifp->eof()) {
|
||||
string line;
|
||||
@ -1107,7 +1106,7 @@ void V3Options::parseOptsFile(FileLine* fl, const string& filename, bool rel) {
|
||||
// Split into argument list and process
|
||||
// Note we don't respect quotes. It seems most simulators dont.
|
||||
// Woez those that expect it; we'll at least complain.
|
||||
if ((pos=whole_file.find("\"")) != string::npos) {
|
||||
if (whole_file.find("\"") != string::npos) {
|
||||
fl->v3error("Double quotes in -f files cause unspecified behavior.");
|
||||
}
|
||||
|
||||
@ -1207,7 +1206,11 @@ void V3Options::showVersion(bool verbose) {
|
||||
V3Options::V3Options() {
|
||||
m_impp = new V3OptionsImp;
|
||||
|
||||
m_assert = false;
|
||||
m_autoflush = false;
|
||||
m_bboxSys = false;
|
||||
m_bboxUnsup = false;
|
||||
m_cdc = false;
|
||||
m_coverageLine = false;
|
||||
m_coverageToggle = false;
|
||||
m_coverageUnderscore = false;
|
||||
@ -1215,6 +1218,7 @@ V3Options::V3Options() {
|
||||
m_debugCheck = false;
|
||||
m_exe = false;
|
||||
m_ignc = false;
|
||||
m_inhibitSim = false;
|
||||
m_l2Name = true;
|
||||
m_lintOnly = false;
|
||||
m_makeDepend = true;
|
||||
@ -1222,6 +1226,9 @@ V3Options::V3Options() {
|
||||
m_orderClockDly = true;
|
||||
m_outFormatOk = false;
|
||||
m_pinsBv = 65;
|
||||
m_pinsScUint = false;
|
||||
m_pinsScBigUint = false;
|
||||
m_pinsUint8 = false;
|
||||
m_profileCFuncs = false;
|
||||
m_preprocOnly = false;
|
||||
m_preprocNoLine = false;
|
||||
|
@ -340,6 +340,7 @@ private:
|
||||
AstNode* nextp = ep->nextp(); //May edit list
|
||||
ep->iterateAndNext(*this);
|
||||
V3Const::constifyParamsEdit(ep); ep=NULL; // ep may change
|
||||
// cppcheck-suppress redundantAssignment
|
||||
ep = nextp;
|
||||
}
|
||||
}
|
||||
|
@ -211,6 +211,7 @@ public:
|
||||
m_prevLexToken = 0;
|
||||
m_ahead = false;
|
||||
m_aheadToken = 0;
|
||||
// m_aheadVal not used as m_ahead = false
|
||||
}
|
||||
~V3ParseImp();
|
||||
void parserClear();
|
||||
|
@ -623,7 +623,6 @@ string V3PreProcImp::defineSubst(V3DefineRef* refp) {
|
||||
string out = "";
|
||||
{ // Parse substitution define using arguments
|
||||
string argName;
|
||||
string prev;
|
||||
bool quote = false;
|
||||
bool backslashesc = false; // In \.....{space} block
|
||||
// Note we go through the loop once more at the NULL end-of-string
|
||||
|
@ -600,6 +600,7 @@ private:
|
||||
UINFO(5," FUNCREF "<<nodep<<endl);
|
||||
if (!m_params) { badNodeType(nodep); return; }
|
||||
AstNodeFTask* funcp = nodep->taskp()->castNodeFTask(); if (!funcp) nodep->v3fatalSrc("Not linked");
|
||||
// cppcheck-suppress redundantAssignment
|
||||
if (m_params) { V3Width::widthParamsEdit(funcp); } funcp=NULL; // Make sure we've sized the function
|
||||
funcp = nodep->taskp()->castNodeFTask(); if (!funcp) nodep->v3fatalSrc("Not linked");
|
||||
// Apply function call values to function
|
||||
|
@ -98,7 +98,7 @@ class SplitLogicVertex : public SplitNodeVertex {
|
||||
uint32_t m_splitColor; // Copied from color() when determined
|
||||
public:
|
||||
SplitLogicVertex(V3Graph* graphp, AstNode* nodep)
|
||||
: SplitNodeVertex(graphp,nodep) {}
|
||||
: SplitNodeVertex(graphp,nodep), m_splitColor(0) {}
|
||||
void splitColor(uint32_t flag) { m_splitColor=flag; }
|
||||
uint32_t splitColor() const { return m_splitColor; }
|
||||
virtual ~SplitLogicVertex() {}
|
||||
|
@ -548,7 +548,7 @@ private:
|
||||
return beginp;
|
||||
}
|
||||
|
||||
string dpiprotoName(AstNodeFTask* nodep, AstVar* rtnvarp) {
|
||||
string dpiprotoName(AstNodeFTask* nodep, AstVar* rtnvarp) const {
|
||||
// Return fancy export-ish name for DPI function
|
||||
// Variable names are NOT included so differences in only IO names won't matter
|
||||
string dpiproto;
|
||||
@ -645,8 +645,6 @@ private:
|
||||
}
|
||||
|
||||
AstCFunc* makeDpiExportWrapper(AstNodeFTask* nodep, AstVar* rtnvarp) {
|
||||
string dpiproto = dpiprotoName(nodep,rtnvarp);
|
||||
|
||||
AstCFunc* dpip = new AstCFunc(nodep->fileline(),
|
||||
nodep->cname(),
|
||||
m_scopep,
|
||||
|
@ -545,7 +545,6 @@ class TristateVisitor : public TristateBaseVisitor {
|
||||
}
|
||||
|
||||
AstNode* orp = NULL;
|
||||
AstNode* andp = NULL;
|
||||
AstNode* enp = NULL;
|
||||
AstNode* undrivenp = NULL;
|
||||
|
||||
@ -581,7 +580,7 @@ class TristateVisitor : public TristateBaseVisitor {
|
||||
// now append this driver to the driver logic.
|
||||
AstNode* ref1p = new AstVarRef(refp->fileline(), newlhsp,false);
|
||||
AstNode* ref2p = new AstVarRef(refp->fileline(), newenp, false);
|
||||
andp = new AstAnd(refp->fileline(), ref1p, ref2p);
|
||||
AstNode* andp = new AstAnd(refp->fileline(), ref1p, ref2p);
|
||||
|
||||
// or this to the others
|
||||
orp = (!orp) ? andp : new AstOr(refp->fileline(), orp, andp);
|
||||
|
@ -92,7 +92,7 @@ private:
|
||||
UINFO(5," IM_WireRep "<<m_assignwp<<endl);
|
||||
m_assignwp->convertToAlways(); pushDeletep(m_assignwp); m_assignwp=NULL;
|
||||
}
|
||||
bool needDly = m_assigndlyp;
|
||||
bool needDly = (m_assigndlyp != NULL);
|
||||
if (m_assigndlyp) {
|
||||
// Delayed assignments become normal assignments,
|
||||
// then the temp created becomes the delayed assignment
|
||||
|
@ -2872,9 +2872,9 @@ private:
|
||||
underp->replaceWith(new AstConst(nodep->fileline(), AstConst::LogicFalse()));
|
||||
pushDeletep(underp); underp=NULL;
|
||||
} else {
|
||||
bool warnOn = true; // Not used
|
||||
bool bad = widthBad(underp,nodep->findLogicBoolDType());
|
||||
if (bad) {
|
||||
bool warnOn = true; // Not used
|
||||
if (warnOn) {
|
||||
if (debug()>4) nodep->backp()->dumpTree(cout," back: ");
|
||||
nodep->v3warn(WIDTH,"Logical Operator "<<nodep->prettyTypeName()
|
||||
@ -3438,11 +3438,6 @@ private:
|
||||
nodep->v3fatalSrc("No dtype expected at statement "<<nodep->prettyTypeName());
|
||||
}
|
||||
}
|
||||
bool backRequiresUnsigned(AstNode* nodep) {
|
||||
// The spec doesn't state this, but if you have an array select where the selection
|
||||
// index is NOT wide enough, you do not sign extend, but always zero extend.
|
||||
return (nodep->castArraySel() || nodep->castSel());
|
||||
}
|
||||
void checkConstantOrReplace(AstNode* nodep, const string& message) {
|
||||
// See also V3WidthSel::checkConstantOrReplace
|
||||
// Note can't call V3Const::constifyParam(nodep) here, as constify may change nodep on us!
|
||||
|
@ -47,6 +47,7 @@ sub process {
|
||||
my %uniq;
|
||||
my %errs;
|
||||
while (defined(my $line = $fh->getline())) {
|
||||
$line =~ s/^\s+//;
|
||||
$line =~ s/Checking usage of global functions\.+//; # Sometimes tacked at end-of-line
|
||||
# General gunk
|
||||
next if $uniq{$line}++;
|
||||
@ -62,6 +63,8 @@ sub process {
|
||||
# Specific suppressions
|
||||
next if $line =~ m!id="missingInclude" .*systemc.h!;
|
||||
next if $line =~ m!id="missingInclude" .*svdpi.h!;
|
||||
next if $line =~ m!id="unusedFunction" .*sv! && $line =~ m!verilated_dpi.cpp!;
|
||||
next if $line =~ m!id="unusedPrivateFunction" .*::debug!; # Doesn't know UINFO will use it
|
||||
next if $line =~ m!file=".*obj_dbg/V3ParseBison.c".* id="unreachableCode"!;
|
||||
# Output
|
||||
if ($line =~ /^cppcheck --/) {
|
||||
@ -82,7 +85,8 @@ sub process {
|
||||
if (scalar(keys %errs)) {
|
||||
#my $all = join('',sort(keys %errs));
|
||||
#$Self->error("Cppcheck errors:\n$all");
|
||||
die "%Error: cppcheck_filtered found errors";
|
||||
#die "%Error: cppcheck_filtered found errors\n";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,6 +97,9 @@ sub _suppress {
|
||||
my $linenum = shift;
|
||||
my $id = shift;
|
||||
#print "-Suppression search $filename $linenum $id\n" if $Self->{verbose};
|
||||
|
||||
return undef if $filename eq "*";
|
||||
|
||||
my $fh = IO::File->new("<$filename");
|
||||
if (!$fh) {
|
||||
warn "%Warning: $! $filename,";
|
||||
@ -111,6 +118,13 @@ sub _suppress {
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($l == $linenum) {
|
||||
if ($id eq "uselessAssignmentPtrArg"
|
||||
&& $line =~ /(delete|Delete|Edit).*p *= *NULL;/) {
|
||||
# delete(nodep); nodep=NULL; # This is ok, it's how we prevent later using nodep
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user