Internals: Cleanup cppcheck warnings.

This commit is contained in:
Wilson Snyder 2015-10-03 22:33:06 -04:00
parent f1874b211f
commit 318ded4198
90 changed files with 196 additions and 147 deletions

View File

@ -104,9 +104,9 @@ class VerilatedModule {
private:
const char* m_namep; ///< Module name
VerilatedModule(); ///< N/A, always use named constructor below
VerilatedModule(const VerilatedModule& ); ///< N/A, no copying modules
VerilatedModule(const VerilatedModule& ); ///< N/A, no copy constructor
public:
VerilatedModule(const char* namep); ///< Create module with given hierarchy name
explicit VerilatedModule(const char* namep); ///< Create module with given hierarchy name
~VerilatedModule();
const char* name() const { return m_namep; } ///< Return name of module
};

View File

@ -75,6 +75,7 @@ public:
virtual vluint64_t count() const { return *m_countp; }
virtual void zero() const { *m_countp = 0; }
// CONSTRUCTORS
// cppcheck-suppress noExplicitConstructor
VerilatedCoverItemSpec(T* countp) : m_countp(countp) { zero(); }
virtual ~VerilatedCoverItemSpec() {}
};

View File

@ -84,6 +84,7 @@ template< class T> std::string vlCovCvtToStr (const T& t) {
struct VlCovCvtToCStr {
string m_str;
// Casters
// cppcheck-suppress noExplicitConstructor
template< class T> VlCovCvtToCStr (const T& t) {
ostringstream os; os<<t; m_str=os.str();
}

View File

@ -48,6 +48,8 @@ protected:
m_bufp = new vluint8_t [bufferSize()];
m_cp = m_bufp;
}
private:
VerilatedSerialBase(const VerilatedSerialBase& ); ///< N/A, no copy constructor
public:
// CREATORS
virtual ~VerilatedSerialBase() {

View File

@ -144,13 +144,15 @@ private:
return out + ((char)((code)%94+33));
}
VerilatedVcd(const VerilatedVcd& ); ///< N/A, no copy constructor
protected:
// METHODS
void evcd(bool flag) { m_evcd = flag; }
public:
// CREATORS
VerilatedVcd(VerilatedVcdFile* filep=NULL);
explicit VerilatedVcd(VerilatedVcdFile* filep=NULL);
~VerilatedVcd();
// ACCESSORS
@ -399,7 +401,7 @@ class VerilatedVcdC {
VerilatedVcd m_sptrace; ///< Trace file being created
public:
// CONSTRUCTORS
VerilatedVcdC(VerilatedVcdFile* filep=NULL) : m_sptrace(filep) {}
explicit VerilatedVcdC(VerilatedVcdFile* filep=NULL) : m_sptrace(filep) {}
~VerilatedVcdC() {}
// ACCESSORS
/// Is file open?

View File

@ -30,6 +30,7 @@
//--------------------------------------------------
#if (SYSTEMC_VERSION>=20050714)
// SystemC 2.1.v1
// cppcheck-suppress unusedFunction
void VerilatedVcdSc::write_comment (const std::string &) {}
void VerilatedVcdSc::trace (const unsigned int &, const std::string &, const char **) {}
@ -74,6 +75,7 @@ void VerilatedVcdSc::trace (const unsigned int &, const std::string &, const cha
//--------------------------------------------------
#elif (SYSTEMC_VERSION>20011000)
// SystemC 2.0.1
// cppcheck-suppress unusedFunction
void VerilatedVcdSc::write_comment (const sc_string &) {}
void VerilatedVcdSc::trace (const unsigned int &, const sc_string &, const char **) {}
@ -116,6 +118,7 @@ void VerilatedVcdSc::trace (const unsigned int &, const sc_string &, const char
//--------------------------------------------------
#else
// SystemC 1.2.1beta
// cppcheck-suppress unusedFunction
void VerilatedVcdSc::write_comment (const sc_string &) {}
void VerilatedVcdSc::trace (const unsigned int &, const sc_string &, const char **) {}

View File

@ -431,6 +431,7 @@ void VerilatedVpiError::selfTest() {
vpiHandle vpi_register_cb(p_cb_data cb_data_p) {
_VL_VPI_ERROR_RESET(); // reset vpi error status
// cppcheck-suppress nullPointer
if (VL_UNLIKELY(!cb_data_p)) {
_VL_VPI_WARNING(__FILE__, __LINE__, "%s : callback data pointer is null", VL_FUNC);
return NULL;
@ -440,7 +441,7 @@ vpiHandle vpi_register_cb(p_cb_data cb_data_p) {
QData time = 0;
if (cb_data_p->time) time = _VL_SET_QII(cb_data_p->time->high, cb_data_p->time->low);
VerilatedVpioCb* vop = new VerilatedVpioCb(cb_data_p, VL_TIME_Q()+time);
VL_DEBUG_IF_PLI(VL_PRINTF("-vltVpi: vpi_register_cb %d %p delay=%" VL_PRI64 "d\n",cb_data_p->reason,vop,time););
VL_DEBUG_IF_PLI(VL_PRINTF("-vltVpi: vpi_register_cb %d %p delay=%" VL_PRI64 "u\n",cb_data_p->reason,vop,time););
VerilatedVpi::cbTimedAdd(vop);
return vop->castVpiHandle();
}
@ -1244,6 +1245,7 @@ void vpi_put_value_array(vpiHandle object, p_vpi_arrayvalue arrayvalue_p,
// time processing
void vpi_get_time(vpiHandle object, p_vpi_time time_p) {
// cppcheck-suppress nullPointer
if (VL_UNLIKELY(!time_p)) {
_VL_VPI_WARNING(__FILE__, __LINE__, "Ignoring vpi_get_time with NULL value pointer");
return;
@ -1303,6 +1305,7 @@ PLI_INT32 vpi_vprintf(PLI_BYTE8* formatp, va_list ap) {
PLI_INT32 vpi_mcd_vprintf(PLI_UINT32 mcd, PLI_BYTE8 *format, va_list ap) {
FILE* fp = VL_CVT_I_FP(mcd);
_VL_VPI_ERROR_RESET(); // reset vpi error status
// cppcheck-suppress nullPointer
if (VL_UNLIKELY(!fp)) return 0;
int chars = vfprintf(fp, format, ap);
return chars;

View File

@ -130,7 +130,7 @@ public:
class VerilatedVpioConst : public VerilatedVpio {
vlsint32_t m_num;
public:
VerilatedVpioConst(vlsint32_t num) : m_num(num) {}
explicit VerilatedVpioConst(vlsint32_t num) : m_num(num) {}
virtual ~VerilatedVpioConst() {}
static inline VerilatedVpioConst* castp(vpiHandle h) { return dynamic_cast<VerilatedVpioConst*>((VerilatedVpio*)h); }
virtual const vluint32_t type() { return vpiUndefined; }
@ -141,7 +141,7 @@ class VerilatedVpioRange : public VerilatedVpio {
const VerilatedRange* m_range;
vlsint32_t m_iteration;
public:
VerilatedVpioRange(const VerilatedRange* range) : m_range(range), m_iteration(0) {}
explicit VerilatedVpioRange(const VerilatedRange* range) : m_range(range), m_iteration(0) {}
virtual ~VerilatedVpioRange() {}
static inline VerilatedVpioRange* castp(vpiHandle h) { return dynamic_cast<VerilatedVpioRange*>((VerilatedVpio*)h); }
virtual const vluint32_t type() { return vpiRange; }
@ -163,7 +163,7 @@ public:
class VerilatedVpioScope : public VerilatedVpio {
const VerilatedScope* m_scopep;
public:
VerilatedVpioScope(const VerilatedScope* scopep)
explicit VerilatedVpioScope(const VerilatedScope* scopep)
: m_scopep(scopep) {}
virtual ~VerilatedVpioScope() {}
static inline VerilatedVpioScope* castp(vpiHandle h) { return dynamic_cast<VerilatedVpioScope*>((VerilatedVpio*)h); }
@ -255,7 +255,7 @@ class VerilatedVpioVarIter : public VerilatedVpio {
VerilatedVarNameMap::iterator m_it;
bool m_started;
public:
VerilatedVpioVarIter(const VerilatedScope* scopep)
explicit VerilatedVpioVarIter(const VerilatedScope* scopep)
: m_scopep(scopep), m_started(false) { }
virtual ~VerilatedVpioVarIter() {}
static inline VerilatedVpioVarIter* castp(vpiHandle h) { return dynamic_cast<VerilatedVpioVarIter*>((VerilatedVpio*)h); }

View File

@ -421,7 +421,7 @@ private:
}
public:
// CONSTUCTORS
ActiveVisitor(AstNetlist* nodep) {
explicit ActiveVisitor(AstNetlist* nodep) {
m_scopeFinalp = NULL;
m_itemCombo = false;
m_itemSequent = false;

View File

@ -147,7 +147,7 @@ private:
}
public:
// CONSTUCTORS
ActiveTopVisitor(AstNetlist* nodep) {
explicit ActiveTopVisitor(AstNetlist* nodep) {
m_topscopep = NULL;
nodep->accept(*this);
}

View File

@ -317,7 +317,7 @@ private:
}
public:
// CONSTRUCTORS
AssertVisitor(AstNetlist* nodep) {
explicit AssertVisitor(AstNetlist* nodep) {
m_beginp = NULL;
m_modp = NULL;
// Process

View File

@ -122,7 +122,7 @@ private:
public:
// CONSTRUCTORS
AssertPreVisitor(AstNetlist* nodep) {
explicit AssertPreVisitor(AstNetlist* nodep) {
m_seniDefaultp = NULL;
clearAssertInfo();
// Process

View File

@ -53,6 +53,7 @@ public:
enum en m_e;
// cppcheck-suppress uninitVar // responsiblity of each subclass
inline AstType () {}
// cppcheck-suppress noExplicitConstructor
inline AstType (en _e) : m_e(_e) {}
explicit inline AstType (int _e) : m_e(static_cast<en>(_e)) {}
operator en () const { return m_e; }
@ -87,7 +88,9 @@ public:
return names[m_e];
};
inline AstNumeric () : m_e(UNSIGNED) {}
// cppcheck-suppress noExplicitConstructor
inline AstNumeric (en _e) : m_e(_e) {}
// cppcheck-suppress noExplicitConstructor
inline AstNumeric (VSignedState signst) {
if (signst==signedst_UNSIGNED) m_e=UNSIGNED;
else if (signst==signedst_SIGNED) m_e=SIGNED;
@ -121,6 +124,7 @@ public:
};
enum en m_e;
inline AstPragmaType () : m_e(ILLEGAL) {}
// cppcheck-suppress noExplicitConstructor
inline AstPragmaType (en _e) : m_e(_e) {}
explicit inline AstPragmaType (int _e) : m_e(static_cast<en>(_e)) {}
operator en () const { return m_e; }
@ -144,6 +148,7 @@ public:
};
enum en m_e;
inline AstCFuncType () : m_e(FT_NORMAL) {}
// cppcheck-suppress noExplicitConstructor
inline AstCFuncType (en _e) : m_e(_e) {}
explicit inline AstCFuncType (int _e) : m_e(static_cast<en>(_e)) {}
operator en () const { return m_e; }
@ -212,6 +217,7 @@ public:
return names[m_e];
};
inline AstEdgeType () : m_e(ET_ILLEGAL) {}
// cppcheck-suppress noExplicitConstructor
inline AstEdgeType (en _e) : m_e(_e) {}
explicit inline AstEdgeType (int _e) : m_e(static_cast<en>(_e)) {}
operator en () const { return m_e; }
@ -279,6 +285,7 @@ public:
return names[m_e];
};
inline AstAttrType () : m_e(ILLEGAL) {}
// cppcheck-suppress noExplicitConstructor
inline AstAttrType (en _e) : m_e(_e) {}
explicit inline AstAttrType (int _e) : m_e(static_cast<en>(_e)) {}
operator en () const { return m_e; }
@ -338,6 +345,7 @@ public:
UASSERT(0==strcmp(AstBasicDTypeKwd(_ENUM_MAX).dpiType()," MAX"),"Enum array mismatch");
}
inline AstBasicDTypeKwd () : m_e(UNKNOWN) {}
// cppcheck-suppress noExplicitConstructor
inline AstBasicDTypeKwd (en _e) : m_e(_e) {}
explicit inline AstBasicDTypeKwd (int _e) : m_e(static_cast<en>(_e)) {}
operator en () const { return m_e; }
@ -432,6 +440,7 @@ public:
};
enum en m_e;
inline AstVarType () : m_e(UNKNOWN) {}
// cppcheck-suppress noExplicitConstructor
inline AstVarType (en _e) : m_e(_e) {}
explicit inline AstVarType (int _e) : m_e(static_cast<en>(_e)) {}
operator en () const { return m_e; }
@ -469,6 +478,7 @@ public:
enum en m_e;
// CONSTRUCTOR - note defaults to *UNKNOWN*
inline AstBranchPred () : m_e(BP_UNKNOWN) {}
// cppcheck-suppress noExplicitConstructor
inline AstBranchPred (en _e) : m_e(_e) {}
explicit inline AstBranchPred (int _e) : m_e(static_cast<en>(_e)) {}
operator en () const { return m_e; }
@ -500,6 +510,7 @@ public:
enum en m_e;
// CONSTRUCTOR - note defaults to *UNKNOWN*
inline AstVarAttrClocker () : m_e(CLOCKER_UNKNOWN) {}
// cppcheck-suppress noExplicitConstructor
inline AstVarAttrClocker (en _e) : m_e(_e) {}
explicit inline AstVarAttrClocker (int _e) : m_e(static_cast<en>(_e)) {}
operator en () const { return m_e; }
@ -530,6 +541,7 @@ public:
};
enum en m_e;
inline VAlwaysKwd () : m_e(ALWAYS) {}
// cppcheck-suppress noExplicitConstructor
inline VAlwaysKwd (en _e) : m_e(_e) {}
explicit inline VAlwaysKwd (int _e) : m_e(static_cast<en>(_e)) {}
operator en () const { return m_e; }
@ -554,6 +566,7 @@ public:
};
enum en m_e;
inline VCaseType () : m_e(CT_CASE) {}
// cppcheck-suppress noExplicitConstructor
inline VCaseType (en _e) : m_e(_e) {}
explicit inline VCaseType (int _e) : m_e(static_cast<en>(_e)) {}
operator en () const { return m_e; }
@ -576,6 +589,7 @@ public:
};
enum en m_e;
inline AstDisplayType () : m_e(DT_DISPLAY) {}
// cppcheck-suppress noExplicitConstructor
inline AstDisplayType (en _e) : m_e(_e) {}
explicit inline AstDisplayType (int _e) : m_e(static_cast<en>(_e)) {}
operator en () const { return m_e; }
@ -600,6 +614,7 @@ public:
};
enum en m_e;
inline AstParseRefExp() : m_e(PX_NONE) {}
// cppcheck-suppress noExplicitConstructor
inline AstParseRefExp (en _e) : m_e(_e) {}
explicit inline AstParseRefExp (int _e) : m_e(static_cast<en>(_e)) {}
operator en () const { return m_e; }
@ -897,16 +912,19 @@ public:
// CREATORS
class Illegal {}; // for creator type-overload selection
class FullValue {}; // for creator type-overload selection
V3Hash(Illegal) { m_both=0; }
explicit V3Hash(Illegal) { m_both=0; }
// Saving and restoring inside a userp
V3Hash(AstNUser* up) { m_both=up->castInt(); }
explicit V3Hash(AstNUser* up) { m_both=up->castInt(); }
V3Hash operator+= (const V3Hash& rh) {
setBoth(depth()+rh.depth(), (hshval()*31+rh.hshval()));
return *this; };
// Creating from raw data (sameHash functions)
V3Hash() { setBoth(1,0); }
// cppcheck-suppress noExplicitConstructor
V3Hash(uint32_t val) { setBoth(1,val); }
// cppcheck-suppress noExplicitConstructor
V3Hash(const void* vp) { setBoth(1,cvtToHash(vp)); }
// cppcheck-suppress noExplicitConstructor
V3Hash(const string& name);
V3Hash(V3Hash h1, V3Hash h2) {
setBoth(1,h1.hshval()*31+h2.hshval()); }
@ -991,7 +1009,7 @@ public:
protected:
// CONSTUCTORS
AstNode() {init(); }
AstNode(FileLine* fileline) {init(); m_fileline = fileline; }
explicit AstNode(FileLine* fileline) {init(); m_fileline = fileline; }
virtual AstNode* clone() = 0; // Generally, cloneTree is what you want instead
virtual void cloneRelink() {}
void cloneRelinkTree();
@ -1274,7 +1292,7 @@ inline void AstNRelinker::relink(AstNode* newp) { newp->AstNode::relink(this); }
class AstNodeMath : public AstNode {
// Math -- anything that's part of an expression tree
public:
AstNodeMath(FileLine* fl)
explicit AstNodeMath(FileLine* fl)
: AstNode(fl) {}
ASTNODE_BASE_FUNCS(NodeMath)
// METHODS
@ -1291,7 +1309,7 @@ public:
class AstNodeTermop : public AstNodeMath {
// Terminal operator -- a operator with no "inputs"
public:
AstNodeTermop(FileLine* fl)
explicit AstNodeTermop(FileLine* fl)
: AstNodeMath(fl) {}
ASTNODE_BASE_FUNCS(NodeTermop)
// Know no children, and hot function, so skip iterator for speed
@ -1435,7 +1453,7 @@ public:
class AstNodeStmt : public AstNode {
// Statement -- anything that's directly under a function
public:
AstNodeStmt(FileLine* fl)
explicit AstNodeStmt(FileLine* fl)
: AstNode(fl) {}
ASTNODE_BASE_FUNCS(NodeStmt)
// METHODS
@ -1525,7 +1543,7 @@ public:
class AstNodeSenItem : public AstNode {
// An AstSenItem or AstSenGate
public:
AstNodeSenItem(FileLine* fl) : AstNode(fl) {}
explicit AstNodeSenItem(FileLine* fl) : AstNode(fl) {}
ASTNODE_BASE_FUNCS(NodeSenItem)
virtual bool isClocked() const = 0;
virtual bool isCombo() const = 0;
@ -1612,7 +1630,7 @@ private:
static int s_uniqueNum; // Unique number assigned to each dtype during creation for IEEE matching
public:
// CONSTRUCTORS
AstNodeDType(FileLine* fl) : AstNode(fl) {
explicit AstNodeDType(FileLine* fl) : AstNode(fl) {
m_width=0; m_widthMin=0; m_generic=false;
}
ASTNODE_BASE_FUNCS(NodeDType)
@ -1701,7 +1719,7 @@ private:
AstNodeDType* m_refDTypep; // Elements of this type (after widthing)
AstNode* rangenp() const { return op2p(); } // op2 = Array(s) of variable
public:
AstNodeArrayDType(FileLine* fl) : AstNodeDType(fl) {
explicit AstNodeArrayDType(FileLine* fl) : AstNodeDType(fl) {
m_refDTypep = NULL;
}
ASTNODE_BASE_FUNCS(NodeArrayDType)

View File

@ -2604,7 +2604,7 @@ public:
class AstBreak : public AstNodeStmt {
public:
AstBreak(FileLine* fileline)
explicit AstBreak(FileLine* fileline)
: AstNodeStmt (fileline) {}
ASTNODE_NODE_FUNCS(Break, BREAK)
virtual string verilogKwd() const { return "break"; };
@ -2614,7 +2614,7 @@ public:
class AstContinue : public AstNodeStmt {
public:
AstContinue(FileLine* fileline)
explicit AstContinue(FileLine* fileline)
: AstNodeStmt (fileline) {}
ASTNODE_NODE_FUNCS(Continue, CONTINUE)
virtual string verilogKwd() const { return "continue"; };
@ -2907,7 +2907,7 @@ public:
class AstStop : public AstNodeStmt {
public:
AstStop(FileLine* fl)
explicit AstStop(FileLine* fl)
: AstNodeStmt(fl) {}
ASTNODE_NODE_FUNCS(Stop, STOP)
virtual bool isGateOptimizable() const { return false; }
@ -2923,7 +2923,7 @@ public:
class AstFinish : public AstNodeStmt {
public:
AstFinish(FileLine* fl)
explicit AstFinish(FileLine* fl)
: AstNodeStmt(fl) {}
ASTNODE_NODE_FUNCS(Finish, FINISH)
virtual bool isGateOptimizable() const { return false; }
@ -3072,7 +3072,7 @@ private:
string scopeNameFormatter(AstText* textp) const;
string scopePrettyNameFormatter(AstText* textp) const;
public:
AstScopeName(FileLine* fl) : AstNodeMath(fl), m_dpiExport(false) {
explicit AstScopeName(FileLine* fl) : AstNodeMath(fl), m_dpiExport(false) {
dtypeSetUInt64(); }
ASTNODE_NODE_FUNCS(ScopeName, SCOPENAME)
virtual V3Hash sameHash() const { return V3Hash(); }
@ -3122,7 +3122,7 @@ private:
public:
AstRand(FileLine* fl, AstNodeDType* dtp, bool reset) : AstNodeTermop(fl) {
dtypep(dtp); m_reset=reset; }
AstRand(FileLine* fl) : AstNodeTermop(fl), m_reset(false) { }
explicit AstRand(FileLine* fl) : AstNodeTermop(fl), m_reset(false) { }
ASTNODE_NODE_FUNCS(Rand, RAND)
virtual string emitVerilog() { return "%f$random"; }
virtual string emitC() {
@ -3139,7 +3139,7 @@ public:
class AstTime : public AstNodeTermop {
public:
AstTime(FileLine* fl) : AstNodeTermop(fl) {
explicit AstTime(FileLine* fl) : AstNodeTermop(fl) {
dtypeSetUInt64(); }
ASTNODE_NODE_FUNCS(Time, TIME)
virtual string emitVerilog() { return "%f$time"; }
@ -3154,7 +3154,7 @@ public:
class AstTimeD : public AstNodeTermop {
public:
AstTimeD(FileLine* fl) : AstNodeTermop(fl) {
explicit AstTimeD(FileLine* fl) : AstNodeTermop(fl) {
dtypeSetDouble(); }
ASTNODE_NODE_FUNCS(TimeD, TIMED)
virtual string emitVerilog() { return "%f$realtime"; }
@ -5082,7 +5082,7 @@ class AstTypeTable : public AstNode {
typedef map<VBasicTypeKey,AstBasicDType*> DetailedMap;
DetailedMap m_detailedMap;
public:
AstTypeTable(FileLine* fl) : AstNode(fl) {
explicit AstTypeTable(FileLine* fl) : AstNode(fl) {
for (int i=0; i<AstBasicDTypeKwd::_ENUM_MAX; ++i) m_basicps[i] = NULL;
}
ASTNODE_NODE_FUNCS(TypeTable, TYPETABLE)

View File

@ -128,7 +128,7 @@ private:
public:
// CONSTUCTORS
BranchVisitor(AstNetlist* nodep) {
explicit BranchVisitor(AstNetlist* nodep) {
reset();
nodep->iterateChildren(*this);
calc_tasks();

View File

@ -197,7 +197,7 @@ private:
}
public:
// CONSTUCTORS
BrokenMarkVisitor(AstNetlist* nodep) {
explicit BrokenMarkVisitor(AstNetlist* nodep) {
nodep->accept(*this);
}
virtual ~BrokenMarkVisitor() {}
@ -241,7 +241,7 @@ private:
}
public:
// CONSTUCTORS
BrokenCheckVisitor(AstNetlist* nodep) {
explicit BrokenCheckVisitor(AstNetlist* nodep) {
nodep->accept(*this);
}
virtual ~BrokenCheckVisitor() {}

View File

@ -112,7 +112,7 @@ private:
}
public:
// CONSTUCTORS
CaseLintVisitor(AstNodeCase* nodep) {
explicit CaseLintVisitor(AstNodeCase* nodep) {
m_caseExprp = NULL;
nodep->accept(*this);
}
@ -475,7 +475,7 @@ private:
public:
// CONSTUCTORS
CaseVisitor(AstNetlist* nodep) {
explicit CaseVisitor(AstNetlist* nodep) {
m_caseNoOverlapsAllCovered = false;
nodep->accept(*this);
}

View File

@ -176,7 +176,7 @@ private:
public:
// CONSTUCTORS
CastVisitor(AstNetlist* nodep) {
explicit CastVisitor(AstNetlist* nodep) {
nodep->accept(*this);
}
virtual ~CastVisitor() {}

View File

@ -184,7 +184,7 @@ private:
}
public:
// CONSTUCTORS
CdcWidthVisitor(AstNode* nodep) {
explicit CdcWidthVisitor(AstNode* nodep) {
m_maxLineno = 0;
m_maxFilenameLen = 0;
nodep->accept(*this);
@ -726,7 +726,7 @@ private:
public:
// CONSTUCTORS
CdcVisitor(AstNode* nodep) {
explicit CdcVisitor(AstNode* nodep) {
m_logicVertexp = NULL;
m_scopep = NULL;
m_modp = NULL;

View File

@ -280,7 +280,7 @@ private:
public:
// CONSTUCTORS
CleanVisitor(AstNetlist* nodep) {
explicit CleanVisitor(AstNetlist* nodep) {
nodep->accept(*this);
}
virtual ~CleanVisitor() {}

View File

@ -66,7 +66,7 @@ class GaterVarVertex;
class GaterVertex : public V3GraphVertex {
static uint32_t s_rankNum;
public:
GaterVertex(V3Graph* graphp)
explicit GaterVertex(V3Graph* graphp)
: V3GraphVertex(graphp) {
s_rankNum++; rank(s_rankNum);
}
@ -79,7 +79,7 @@ uint32_t GaterVertex::s_rankNum = 0;
class GaterHeadVertex : public GaterVertex {
public:
GaterHeadVertex(V3Graph* graphp)
explicit GaterHeadVertex(V3Graph* graphp)
: GaterVertex(graphp) {}
virtual ~GaterHeadVertex() {}
virtual int typeNum() const { return __LINE__; } // C++ typeof() equivelent
@ -89,7 +89,7 @@ public:
class GaterPliVertex : public GaterVertex {
public:
GaterPliVertex(V3Graph* graphp)
explicit GaterPliVertex(V3Graph* graphp)
: GaterVertex(graphp) {}
virtual ~GaterPliVertex() {}
virtual int typeNum() const { return __LINE__; } // C++ typeof() equivelent
@ -217,7 +217,7 @@ private:
}
public:
// CONSTUCTORS
GaterCondVisitor(AstNode* nodep) {
explicit GaterCondVisitor(AstNode* nodep) {
m_isSimple = true;
nodep->accept(*this);
}
@ -878,7 +878,7 @@ class GaterVisitor : public GaterBaseVisitor {
public:
// CONSTUCTORS
GaterVisitor(AstNode* nodep) {
explicit GaterVisitor(AstNode* nodep) {
// AstAlways visitor does the real work, so most zeroing needs to be in clear()
clear();
nodep->accept(*this);

View File

@ -386,7 +386,7 @@ private:
public:
// CONSTUCTORS
ClockVisitor(AstNetlist* nodep) {
explicit ClockVisitor(AstNetlist* nodep) {
m_modp=NULL; m_activep=NULL;
m_evalFuncp = NULL;
m_topScopep=NULL;

View File

@ -169,7 +169,7 @@ private:
}
public:
// CONSTRUCTORS
CombMarkVisitor(AstNode* nodep) {
explicit CombMarkVisitor(AstNode* nodep) {
nodep->accept(*this);
}
virtual ~CombMarkVisitor() {}
@ -457,7 +457,7 @@ private:
public:
// CONSTUCTORS
CombineVisitor(AstNetlist* nodep) {
explicit CombineVisitor(AstNetlist* nodep) {
m_modp=NULL;
m_funcp = NULL;
m_state = STATE_IDLE;

View File

@ -54,7 +54,7 @@ private:
}
public:
// CONSTUCTORS
ConstVarMarkVisitor(AstNode* nodep) {
explicit ConstVarMarkVisitor(AstNode* nodep) {
AstNode::user4ClearTree(); // Check marked InUse before we're called
nodep->accept(*this);
}
@ -76,7 +76,7 @@ private:
}
public:
// CONSTUCTORS
ConstVarFindVisitor(AstNode* nodep) {
explicit ConstVarFindVisitor(AstNode* nodep) {
m_found = false;
nodep->iterateAndNext(*this, NULL);
}
@ -2292,7 +2292,7 @@ public:
};
// CONSTUCTORS
ConstVisitor(ProcMode pmode) {
explicit ConstVisitor(ProcMode pmode) {
m_params = false;
m_required = false;
m_doExpensive = false;

View File

@ -378,7 +378,7 @@ private:
public:
// CONSTUCTORS
CoverageVisitor(AstNetlist* rootp) {
explicit CoverageVisitor(AstNetlist* rootp) {
// Operate on all modules
m_checkBlock = true;
m_beginHier = "";

View File

@ -121,7 +121,7 @@ private:
public:
// CONSTUCTORS
CoverageJoinVisitor(AstNetlist* nodep) {
explicit CoverageJoinVisitor(AstNetlist* nodep) {
nodep->accept(*this);
}
virtual ~CoverageJoinVisitor() {

View File

@ -58,7 +58,7 @@ private:
}
public:
// CONSTRUCTORS
DeadModVisitor(AstNodeModule* nodep) {
explicit DeadModVisitor(AstNodeModule* nodep) {
nodep->accept(*this);
}
virtual ~DeadModVisitor() {}

View File

@ -450,7 +450,7 @@ private:
public:
// CONSTUCTORS
DelayedVisitor(AstNetlist* nodep) {
explicit DelayedVisitor(AstNetlist* nodep) {
m_inDly = false;
m_activep=NULL;
m_cfuncp=NULL;

View File

@ -157,7 +157,7 @@ private:
public:
// CONSTUCTORS
DepthVisitor(AstNetlist* nodep) {
explicit DepthVisitor(AstNetlist* nodep) {
m_modp=NULL;
m_funcp=NULL;
m_stmtp=NULL;

View File

@ -125,7 +125,7 @@ private:
public:
// CONSTUCTORS
DepthBlockVisitor(AstNetlist* nodep) {
explicit DepthBlockVisitor(AstNetlist* nodep) {
m_modp=NULL;
m_depth=0;
//

View File

@ -247,7 +247,7 @@ private:
}
public:
// CONSTRUCTORS
DescopeVisitor(AstNetlist* nodep) {
explicit DescopeVisitor(AstNetlist* nodep) {
m_modp = NULL;
m_scopep = NULL;
m_needThis = false;

View File

@ -656,7 +656,7 @@ public:
}
} else if (nodep->isQuad()) {
vluint64_t num = nodep->toUQuad();
if (num<10) ofp()->printf("VL_ULL(%" VL_PRI64 "d)", num);
if (num<10) ofp()->printf("VL_ULL(%" VL_PRI64 "u)", num);
else ofp()->printf("VL_ULL(0x%" VL_PRI64 "x)", num);
} else {
uint32_t num = nodep->toUInt();
@ -2434,7 +2434,7 @@ class EmitCTrace : EmitCStmts {
}
public:
EmitCTrace(bool slow) {
explicit EmitCTrace(bool slow) {
m_funcp = NULL;
m_slow = slow;
}

View File

@ -106,7 +106,7 @@ private:
}
public:
// CONSTUCTORS
EmitCBaseCounterVisitor(AstNode* nodep) {
explicit EmitCBaseCounterVisitor(AstNode* nodep) {
m_count = 0;
nodep->accept(*this);
}

View File

@ -71,7 +71,7 @@ class EmitCInlines : EmitCBaseVisitor {
//---------------------------------------
// ACCESSORS
public:
EmitCInlines(AstNetlist* nodep) {
explicit EmitCInlines(AstNetlist* nodep) {
nodep->accept(*this);
if (v3Global.needHInlines()) {
emitInt();

View File

@ -244,7 +244,7 @@ class EmitCSyms : EmitCBaseVisitor {
//---------------------------------------
// ACCESSORS
public:
EmitCSyms(AstNetlist* nodep) {
explicit EmitCSyms(AstNetlist* nodep) {
m_funcp = NULL;
m_modp = NULL;
m_coverBins = 0;

View File

@ -234,7 +234,7 @@ public:
}
public:
EmitMkVisitor(AstNetlist*) {
explicit EmitMkVisitor(AstNetlist*) {
emitClassMake();
emitOverallMake();
}

View File

@ -589,7 +589,7 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
}
public:
EmitVBaseVisitor(AstSenTree* domainp=NULL) { // Domain for printing one a ALWAYS under a ACTIVE
explicit EmitVBaseVisitor(AstSenTree* domainp=NULL) { // Domain for printing one a ALWAYS under a ACTIVE
m_suppressSemi = false;
m_sensesp = domainp;
}

View File

@ -104,8 +104,9 @@ public:
};
enum en m_e;
inline V3ErrorCode () : m_e(EC_MIN) {}
// cppcheck-suppress noExplicitConstructor
inline V3ErrorCode (en _e) : m_e(_e) {}
V3ErrorCode (const char* msgp); // Matching code or ERROR
explicit V3ErrorCode (const char* msgp); // Matching code or ERROR
explicit inline V3ErrorCode (int _e) : m_e(static_cast<en>(_e)) {}
operator en () const { return m_e; }
const char* ascii() const {

View File

@ -921,7 +921,7 @@ private:
public:
// CONSTUCTORS
ExpandVisitor(AstNetlist* nodep) {
explicit ExpandVisitor(AstNetlist* nodep) {
m_stmtp=NULL;
nodep->accept(*this);
}

View File

@ -363,6 +363,7 @@ private:
}
return out;
}
// cppcheck-suppress unusedFunction
string readFilterLine() {
// Slow, but we don't need it much
UINFO(9,"readFilterLine\n");
@ -380,6 +381,7 @@ private:
UINFO(6,"filter-line-in: "<<line);
return line;
}
// cppcheck-suppress unusedFunction
void writeFilter(const string& out) {
if (debug()>=6) { UINFO(6,"filter-out: "<<out); if (out[out.length()-1]!='\n') cout<<endl; }
if (!m_pid) { v3error("--pipe-filter: write to closed file\n"); m_readEof = true; stop(); }
@ -521,7 +523,7 @@ protected:
return out;
}
// CONSTRUCTORS
V3InFilterImp(const string& command) {
explicit V3InFilterImp(const string& command) {
m_readEof = false;
m_pid = 0;
m_pidExited = false;

View File

@ -77,6 +77,7 @@ class V3InFilterImp;
class V3InFilter {
V3InFilterImp* m_impp;
V3InFilter(const V3InFilter&); ///< N/A, no copy constructor
public:
// TYPES
typedef list<string> StrList;
@ -86,7 +87,7 @@ public:
bool readWholefile(const string& filename, StrList& outl);
// CONSTRUCTORS
V3InFilter(const string& command);
explicit V3InFilter(const string& command);
~V3InFilter();
};
@ -183,7 +184,7 @@ private:
class V3OutCFile : public V3OutFile {
int m_private;
public:
V3OutCFile(const string& filename) : V3OutFile(filename, V3OutFormatter::LA_C) {
explicit V3OutCFile(const string& filename) : V3OutFile(filename, V3OutFormatter::LA_C) {
resetPrivate();
}
virtual ~V3OutCFile() {}
@ -208,7 +209,7 @@ public:
class V3OutScFile : public V3OutCFile {
public:
V3OutScFile(const string& filename) : V3OutCFile(filename) {}
explicit V3OutScFile(const string& filename) : V3OutCFile(filename) {}
virtual ~V3OutScFile() {}
virtual void putsHeader() { puts("// Verilated -*- SystemC -*-\n"); }
virtual void putsIntTopInclude() {
@ -219,7 +220,7 @@ public:
class V3OutSpFile : public V3OutCFile {
public:
V3OutSpFile(const string& filename) : V3OutCFile(filename) {}
explicit V3OutSpFile(const string& filename) : V3OutCFile(filename) {}
virtual ~V3OutSpFile() {}
virtual void putsHeader() { puts("// Verilated -*- SystemC -*-\n"); }
virtual void putsIntTopInclude() {
@ -230,21 +231,21 @@ public:
class V3OutVFile : public V3OutFile {
public:
V3OutVFile(const string& filename) : V3OutFile(filename, V3OutFormatter::LA_VERILOG) {}
explicit V3OutVFile(const string& filename) : V3OutFile(filename, V3OutFormatter::LA_VERILOG) {}
virtual ~V3OutVFile() {}
virtual void putsHeader() { puts("// Verilated -*- Verilog -*-\n"); }
};
class V3OutXmlFile : public V3OutFile {
public:
V3OutXmlFile(const string& filename) : V3OutFile(filename, V3OutFormatter::LA_XML) {}
explicit V3OutXmlFile(const string& filename) : V3OutFile(filename, V3OutFormatter::LA_XML) {}
virtual ~V3OutXmlFile() {}
virtual void putsHeader() { puts("<?xml version=\"1.0\" ?>\n"); }
};
class V3OutMkFile : public V3OutFile {
public:
V3OutMkFile(const string& filename) : V3OutFile(filename, V3OutFormatter::LA_MK) {}
explicit V3OutMkFile(const string& filename) : V3OutFile(filename, V3OutFormatter::LA_MK) {}
virtual ~V3OutMkFile() {}
virtual void putsHeader() { puts("# Verilated -*- Makefile -*-\n"); }
// No automatic indentation yet.

View File

@ -102,9 +102,9 @@ public:
FileLine (const string& filename, int lineno) {
m_lineno=lineno; m_filenameno = singleton().nameToNumber(filename);
m_warnOn=defaultFileLine().m_warnOn; }
FileLine (FileLine* fromp) {
explicit FileLine (FileLine* fromp) {
m_lineno=fromp->m_lineno; m_filenameno = fromp->m_filenameno; m_warnOn=fromp->m_warnOn; }
FileLine (EmptySecret);
explicit FileLine (EmptySecret);
~FileLine() { }
FileLine* create(const string& filename, int lineno) { return new FileLine(filename,lineno); }
FileLine* create(int lineno) { return create(filename(), lineno); }

View File

@ -496,7 +496,7 @@ private:
public:
// CONSTUCTORS
GateVisitor(AstNode* nodep) {
explicit GateVisitor(AstNode* nodep) {
AstNode::user1ClearTree();
m_logicVertexp = NULL;
m_scopep = NULL;
@ -1202,7 +1202,7 @@ private:
}
public:
GateMergeAssignsGraphVisitor(V3Graph* graphp) {
explicit GateMergeAssignsGraphVisitor(V3Graph* graphp) {
m_assignp = NULL;
m_activep = NULL;
m_logicvp = NULL;
@ -1253,7 +1253,7 @@ private:
public:
// CONSTUCTORS
GateDeassignVisitor(AstNode* nodep) {
explicit GateDeassignVisitor(AstNode* nodep) {
nodep->accept(*this);
}
virtual ~GateDeassignVisitor() {}

View File

@ -213,7 +213,7 @@ private:
}
public:
// CONSTRUCTORS
GenClkReadVisitor(AstNetlist* nodep) {
explicit GenClkReadVisitor(AstNetlist* nodep) {
m_activep = NULL;
m_assignp = NULL;
m_topModp = NULL;

View File

@ -46,6 +46,7 @@ public:
};
enum en m_e;
inline VWidthMinUsage () : m_e(LINT_WIDTH) {}
// cppcheck-suppress noExplicitConstructor
inline VWidthMinUsage (en _e) : m_e(_e) {}
explicit inline VWidthMinUsage (int _e) : m_e(static_cast<en>(_e)) {}
operator en () const { return m_e; }
@ -63,7 +64,6 @@ class V3Global {
VWidthMinUsage m_widthMinUsage; // What AstNode::widthMin() is used for
int m_debugFileNumber; // Number to append to debug files created
int m_assertWidthsMatch; // Tree should have width()==widthMin()
bool m_assertDTypesResolved; // Tree should have dtypep()'s
bool m_constRemoveXs; // Const needs to strip any Xs
bool m_needHInlines; // Need __Inlines file

View File

@ -167,7 +167,7 @@ protected:
// CONSTRUCTORS
V3GraphVertex(V3Graph* graphp, const V3GraphVertex& old);
public:
V3GraphVertex(V3Graph* graphp);
explicit V3GraphVertex(V3Graph* graphp);
//! Clone copy constructor. Doesn't copy edges or user/userp.
virtual V3GraphVertex* clone(V3Graph* graphp) const {
return new V3GraphVertex(graphp, *this); }

View File

@ -319,6 +319,7 @@ void GraphAcyc::simplifyOne (GraphAcycVertex* avertexp) {
&& (!outEdgep->cutable()
|| inEdgep->weight()<outEdgep->weight() ))
? inEdgep : outEdgep);
// cppcheck-suppress leakReturnValNotUsed
edgeFromEdge(templateEdgep, inVertexp, outVertexp);
// Remove old edge
inEdgep->unlinkDelete(); inEdgep = NULL;
@ -353,6 +354,7 @@ void GraphAcyc::simplifyOut (GraphAcycVertex* avertexp) {
return;
}
// Make a new edge connecting the two vertices directly
// cppcheck-suppress leakReturnValNotUsed
edgeFromEdge(inEdgep, inVertexp, outVertexp);
// Remove old edge
inEdgep->unlinkDelete(); inEdgep = NULL;

View File

@ -96,7 +96,7 @@ private:
public:
// CONSTUCTORS
HashedVisitor(AstNode* nodep) {
explicit HashedVisitor(AstNode* nodep) {
nodeHashIterate(nodep);
//UINFO(9," stmthash "<<hex<<V3Hashed::nodeHash(nodep)<<" "<<nodep<<endl);
}

View File

@ -185,7 +185,7 @@ private:
public:
// CONSTUCTORS
InlineMarkVisitor(AstNode* nodep) {
explicit InlineMarkVisitor(AstNode* nodep) {
m_modp = NULL;
m_stmtCnt = 0;
nodep->accept(*this);
@ -227,7 +227,7 @@ private:
public:
// CONSTUCTORS
InlineCollectVisitor(AstNodeModule* nodep) { // passed OLD module, not new one
explicit InlineCollectVisitor(AstNodeModule* nodep) { // passed OLD module, not new one
nodep->accept(*this);
}
virtual ~InlineCollectVisitor() {}
@ -537,7 +537,7 @@ private:
public:
// CONSTUCTORS
InlineVisitor(AstNode* nodep) {
explicit InlineVisitor(AstNode* nodep) {
m_modp = NULL;
nodep->accept(*this);
}

View File

@ -139,7 +139,7 @@ private:
}
public:
// CONSTUCTORS
InstVisitor(AstNode* nodep) {
explicit InstVisitor(AstNode* nodep) {
m_modp=NULL;
m_cellp=NULL;
//
@ -229,7 +229,7 @@ private:
}
public:
// CONSTUCTORS
InstDeVisitor(AstNode* nodep) {
explicit InstDeVisitor(AstNode* nodep) {
m_cellRangep=NULL;
m_instNum=0;
m_instLsb=0;

View File

@ -64,8 +64,9 @@ public:
//
enum en m_e;
inline V3LangCode () : m_e(L_ERROR) {}
// cppcheck-suppress noExplicitConstructor
inline V3LangCode (en _e) : m_e(_e) {}
V3LangCode (const char* textp);
explicit V3LangCode (const char* textp);
explicit inline V3LangCode (int _e) : m_e(static_cast<en>(_e)) {}
operator en () const { return m_e; }
};

View File

@ -93,10 +93,10 @@ public:
LifeVarEntry(SIMPLEASSIGN, AstNodeAssign* assp) {
init(true); simpleAssign(assp);
}
LifeVarEntry(COMPLEXASSIGN) {
explicit LifeVarEntry(COMPLEXASSIGN) {
init(false); complexAssign();
}
LifeVarEntry(CONSUMED) {
explicit LifeVarEntry(CONSUMED) {
init(false); consumed();
}
~LifeVarEntry() {}
@ -455,14 +455,14 @@ public:
m_sideEffect = false;
m_noopt = false;
{
// Cpp check bug, it is deleted
// cppcheck-suppress leak
m_lifep = new LifeBlock (NULL, m_statep);
nodep->accept(*this);
delete m_lifep; m_lifep=NULL;
if (m_lifep) { delete m_lifep; m_lifep=NULL; }
}
}
virtual ~LifeVisitor() {}
virtual ~LifeVisitor() {
if (m_lifep) { delete m_lifep; m_lifep=NULL; }
}
};
//######################################################################

View File

@ -86,7 +86,7 @@ private:
}
public:
// CONSTRUCTORS
LifePostElimVisitor(AstTopScope* nodep) {
explicit LifePostElimVisitor(AstTopScope* nodep) {
nodep->accept(*this);
}
virtual ~LifePostElimVisitor() {}
@ -178,7 +178,7 @@ private:
}
public:
// CONSTRUCTORS
LifePostDlyVisitor(AstNetlist* nodep) {
explicit LifePostDlyVisitor(AstNetlist* nodep) {
nodep->accept(*this);
}
virtual ~LifePostDlyVisitor() {

View File

@ -66,7 +66,7 @@ public:
class LibraryVertex : public V3GraphVertex {
public:
LibraryVertex(V3Graph* graphp)
explicit LibraryVertex(V3Graph* graphp)
: V3GraphVertex(graphp) {}
virtual ~LibraryVertex() {}
virtual string name() const { return "*LIBRARY*"; }

View File

@ -246,7 +246,7 @@ private:
}
public:
// CONSTUCTORS
LinkJumpVisitor(AstNetlist* nodep) {
explicit LinkJumpVisitor(AstNetlist* nodep) {
m_modp = NULL;
m_ftaskp = NULL;
m_loopp = NULL;

View File

@ -349,7 +349,7 @@ private:
public:
// CONSTUCTORS
LinkParseVisitor(AstNetlist* rootp) {
explicit LinkParseVisitor(AstNetlist* rootp) {
m_varp = NULL;
m_modp = NULL;
m_ftaskp = NULL;

View File

@ -399,7 +399,7 @@ private:
public:
// CONSTUCTORS
LinkResolveVisitor(AstNetlist* rootp) {
explicit LinkResolveVisitor(AstNetlist* rootp) {
m_ftaskp = NULL;
m_modp = NULL;
m_assertp = NULL;
@ -451,7 +451,7 @@ private:
}
public:
// CONSTUCTORS
LinkBotupVisitor(AstNetlist* rootp) {
explicit LinkBotupVisitor(AstNetlist* rootp) {
m_modp = NULL;
//
rootp->accept(*this);

View File

@ -93,7 +93,7 @@ private:
}
public:
// CONSTRUCTORS
LocalizeDehierVisitor(AstNetlist* nodep) {
explicit LocalizeDehierVisitor(AstNetlist* nodep) {
nodep->accept(*this);
}
virtual ~LocalizeDehierVisitor() {}
@ -233,7 +233,7 @@ private:
}
public:
// CONSTRUCTORS
LocalizeVisitor(AstNetlist* nodep) {
explicit LocalizeVisitor(AstNetlist* nodep) {
m_cfuncp = NULL;
nodep->accept(*this);
}

View File

@ -137,7 +137,7 @@ private:
}
public:
// CONSTUCTORS
NameVisitor(AstNetlist* nodep) {
explicit NameVisitor(AstNetlist* nodep) {
nodep->accept(*this);
}
virtual ~NameVisitor() {}

View File

@ -129,7 +129,7 @@ private:
public:
// CONSTRUCTORS
V3Number(FileLine* fileline) { init(fileline, 1); }
explicit V3Number(FileLine* fileline) { init(fileline, 1); }
V3Number(FileLine* fileline, int width) { init(fileline, width); } // 0=unsized
V3Number(FileLine* fileline, int width, uint32_t value) { init(fileline, width); m_value[0]=value; opCleanThis(); }
V3Number(FileLine* fileline, const char* source); // Create from a verilog 32'hxxxx number.

View File

@ -1002,6 +1002,7 @@ void V3Options::parseOptsFile(FileLine* fl, const string& filename, bool rel) {
getline(*ifp, line);
// Strip simple comments
string oline;
// cppcheck-suppress StlMissingComparison
for (string::const_iterator pos = line.begin(); pos != line.end(); ++pos) {
if (inCmt) {
if (*pos=='*' && *(pos+1)=='/') {

View File

@ -175,6 +175,8 @@ class V3Options {
static string getenvSYSTEMPERLGuts();
V3Options(const V3Options&); ///< N/A, no copy constructor
public:
// CREATORS
V3Options();

View File

@ -363,7 +363,7 @@ private:
public:
// CONSTUCTORS
OrderClkMarkVisitor(AstNode* nodep) {
explicit OrderClkMarkVisitor(AstNode* nodep) {
m_hasClk = false;
m_inClocked = false;
m_inAss = false;
@ -410,7 +410,7 @@ private:
public:
// CONSTUCTORS
OrderClkAssVisitor(AstNode* nodep) {
explicit OrderClkAssVisitor(AstNode* nodep) {
m_clkAss = false;
nodep->accept(*this);
}

View File

@ -104,6 +104,7 @@ struct OrderVEdgeType {
}
enum en m_e;
inline OrderVEdgeType () : m_e(VERTEX_UNKNOWN) {}
// cppcheck-suppress noExplicitConstructor
inline OrderVEdgeType (en _e) : m_e(_e) {}
explicit inline OrderVEdgeType (int _e) : m_e(static_cast<en>(_e)) {}
operator en () const { return m_e; }

View File

@ -88,7 +88,7 @@ private:
struct ModInfo {
AstNodeModule* m_modp; // Module with specified name
VarCloneMap m_cloneMap; // Map of old-varp -> new cloned varp
ModInfo(AstNodeModule* modp) { m_modp=modp; }
explicit ModInfo(AstNodeModule* modp) { m_modp=modp; }
};
typedef map<string,ModInfo> ModNameMap;
ModNameMap m_modNameMap; // Hash of created module flavors by name
@ -385,7 +385,7 @@ private:
public:
// CONSTUCTORS
ParamVisitor(AstNetlist* nodep) {
explicit ParamVisitor(AstNetlist* nodep) {
m_longId = 0;
//
nodep->accept(*this);

View File

@ -36,6 +36,7 @@ class V3Parse {
private:
V3ParseImp* m_impp;
V3Parse(const V3Parse&); ///< N/A, no copy constructor
public:
// CONSTRUCTORS
// We must allow reading multiple files into one parser

View File

@ -133,7 +133,7 @@ public:
}
public:
// CREATORS
V3ParseSym(AstNetlist* rootp)
explicit V3ParseSym(AstNetlist* rootp)
: m_syms(rootp) {
s_anonNum = 0; // Number of next anonymous object
pushScope(findNewTable(rootp));

View File

@ -85,7 +85,7 @@ private:
public:
// CONSTRUCTORS
PremitAssignVisitor(AstNodeAssign* nodep) {
explicit PremitAssignVisitor(AstNodeAssign* nodep) {
UINFO(4," PremitAssignVisitor on "<<nodep<<endl);
m_noopt = false;
nodep->accept(*this);
@ -383,7 +383,7 @@ private:
public:
// CONSTUCTORS
PremitVisitor(AstNetlist* nodep) {
explicit PremitVisitor(AstNetlist* nodep) {
m_modp = NULL;
m_funcp = NULL;
m_stmtp = NULL;

View File

@ -294,7 +294,7 @@ private:
}
public:
// CONSTUCTORS
ScopeVisitor(AstNetlist* nodep) {
explicit ScopeVisitor(AstNetlist* nodep) {
m_aboveCellp = NULL;
m_aboveScopep = NULL;
m_modp = NULL;
@ -402,7 +402,7 @@ private:
}
public:
// CONSTUCTORS
ScopeCleanupVisitor(AstNetlist* nodep) {
explicit ScopeCleanupVisitor(AstNetlist* nodep) {
m_scopep = NULL;
nodep->accept(*this);
}

View File

@ -655,6 +655,7 @@ private:
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
// cppcheck-suppress redundantAssignment
funcp = nodep->taskp()->castNodeFTask(); if (!funcp) nodep->v3fatalSrc("Not linked");
// Apply function call values to function
V3TaskConnects tconnects = V3Task::taskConnects(nodep, nodep->taskp()->stmtsp());

View File

@ -185,7 +185,7 @@ class SliceCloneVisitor : public AstNVisitor {
}
public:
// CONSTUCTORS
SliceCloneVisitor(AstNode* nodep) {
explicit SliceCloneVisitor(AstNode* nodep) {
nodep->accept(*this);
}
virtual ~SliceCloneVisitor() {}
@ -487,7 +487,7 @@ class SliceVisitor : public AstNVisitor {
public:
// CONSTUCTORS
SliceVisitor(AstNetlist* rootp) {
explicit SliceVisitor(AstNetlist* rootp) {
m_assignp = NULL;
m_lhsVarRefp = NULL;
rootp->accept(*this);

View File

@ -69,7 +69,7 @@
class SplitPliVertex : public V3GraphVertex {
public:
SplitPliVertex(V3Graph* graphp)
explicit SplitPliVertex(V3Graph* graphp)
: V3GraphVertex(graphp) {}
virtual ~SplitPliVertex() {}
virtual string name() const { return "*PLI*"; }

View File

@ -71,7 +71,7 @@ private:
}
public:
// CONSTUCTORS
SplitAsFindVisitor(AstAlways* nodep) {
explicit SplitAsFindVisitor(AstAlways* nodep) {
m_splitVscp = NULL;
nodep->accept(*this);
}
@ -200,7 +200,7 @@ private:
public:
// CONSTUCTORS
SplitAsVisitor(AstNetlist* nodep) {
explicit SplitAsVisitor(AstNetlist* nodep) {
m_splitVscp = NULL;
AstNode::user1ClearTree(); // user1p() used on entire tree
nodep->accept(*this);

View File

@ -37,7 +37,7 @@ public:
~V3Double0() {}
// Implicit conversion operators:
inline V3Double0 (const vluint64_t v) : m_d(v) { }
inline explicit V3Double0 (const vluint64_t v) : m_d(v) { }
inline operator double () const { return m_d; }
// Explicit operators:

View File

@ -177,7 +177,7 @@ public:
}
// CONSTRUCTORS
StatsReport(ofstream* aofp)
explicit StatsReport(ofstream* aofp)
: os(*aofp) {
header();
sumit();

View File

@ -54,7 +54,7 @@ class VHashSha1 {
public:
// CONSTRUCTORS
VHashSha1() { init(); }
VHashSha1(const string& data) { init(); insert(data); }
explicit VHashSha1(const string& data) { init(); insert(data); }
~VHashSha1() {}
// METHODS
@ -93,7 +93,7 @@ class VName {
static size_t s_minLength; // Length to preserve if over maxLength
public:
// CONSTRUCTORS
VName (const string& name) : m_name(name) {}
explicit VName (const string& name) : m_name(name) {}
~VName() {}
// METHODS
void name(const string& name) { m_name = name; m_hashed = ""; }

View File

@ -86,7 +86,7 @@ class SubstVarEntry {
public:
// CONSTRUCTORS
SubstVarEntry (AstVar* varp) { // Construction for when a var is used
explicit SubstVarEntry (AstVar* varp) { // Construction for when a var is used
m_varp = varp;
m_whole.m_use = false;
m_wordAssign = false;
@ -379,7 +379,7 @@ private:
}
public:
// CONSTUCTORS
SubstVisitor(AstNode* nodep) {
explicit SubstVisitor(AstNode* nodep) {
AstNode::user1ClearTree(); // user1p() used on entire tree
AstNode::user2ClearTree(); // user2p() used on entire tree
m_ops = 0;

View File

@ -226,6 +226,8 @@ private:
VSymEnt* m_symRootp; // Root symbol table
SymStack m_symsp; // All symbol tables, to cleanup
VSymGraph(const VSymGraph&); ///< N/A, no copy constructor
protected:
friend class VSymEnt;
void pushNewEnt(VSymEnt* entp) { m_symsp.push_back(entp); }
@ -256,7 +258,7 @@ public:
}
public:
// CREATORS
VSymGraph(AstNetlist* nodep) {
explicit VSymGraph(AstNetlist* nodep) {
m_symRootp = new VSymEnt(this, nodep);
}
~VSymGraph() {

View File

@ -60,7 +60,7 @@ public:
virtual void varRefCb(AstVarRef* nodep); ///< Call other-this function on all new var references
// CONSTRUCTORS
TableSimulateVisitor(TableVisitor* cbthis) {
explicit TableSimulateVisitor(TableVisitor* cbthis) {
m_cbthis = cbthis;
}
virtual ~TableSimulateVisitor() {}
@ -437,7 +437,7 @@ private:
}
public:
// CONSTRUCTORS
TableVisitor(AstNetlist* nodep) {
explicit TableVisitor(AstNetlist* nodep) {
m_modp = NULL;
m_modTables = 0;
m_scopep = NULL;

View File

@ -49,7 +49,7 @@ class TaskBaseVertex : public V3GraphVertex {
AstNode* m_impurep; // Node causing impure function w/ outside references
bool m_noInline; // Marked with pragma
public:
TaskBaseVertex(V3Graph* graphp)
explicit TaskBaseVertex(V3Graph* graphp)
: V3GraphVertex(graphp), m_impurep(NULL), m_noInline(false) {}
virtual ~TaskBaseVertex() {}
bool pure() const { return m_impurep==NULL; }
@ -79,7 +79,7 @@ public:
class TaskCodeVertex : public TaskBaseVertex {
// Top vertex for all calls not under another task
public:
TaskCodeVertex(V3Graph* graphp)
explicit TaskCodeVertex(V3Graph* graphp)
: TaskBaseVertex(graphp) {}
virtual ~TaskCodeVertex() {}
virtual string name() const { return "*CODE*"; }
@ -234,7 +234,7 @@ private:
}
public:
// CONSTUCTORS
TaskStateVisitor(AstNetlist* nodep) {
explicit TaskStateVisitor(AstNetlist* nodep) {
m_assignwp = NULL;
m_curVxp = new TaskCodeVertex(&m_callGraph);
AstNode::user3ClearTree();
@ -277,7 +277,7 @@ private:
}
public:
// CONSTUCTORS
TaskRelinkVisitor(AstBegin* nodep) { // Passed temporary tree
explicit TaskRelinkVisitor(AstBegin* nodep) { // Passed temporary tree
nodep->accept(*this);
}
virtual ~TaskRelinkVisitor() {}

View File

@ -677,7 +677,7 @@ private:
public:
// CONSTUCTORS
TraceVisitor(AstNetlist* nodep) {
explicit TraceVisitor(AstNetlist* nodep) {
m_funcp = NULL;
m_tracep = NULL;
m_topModp = NULL;

View File

@ -108,9 +108,6 @@ private:
basep->addStmtsp(callp);
return funcp;
}
void addCFuncStmt(AstCFunc* basep, AstNode* nodep, VNumRange arrayRange) {
basep->addStmtsp(nodep);
}
void addTraceDecl(const VNumRange& arrayRange,
int widthOverride) { // If !=0, is packed struct/array where basicp size misreflects one element
VNumRange bitRange;
@ -305,7 +302,7 @@ private:
public:
// CONSTUCTORS
TraceDeclVisitor(AstNetlist* nodep) {
explicit TraceDeclVisitor(AstNetlist* nodep) {
m_scopetopp = NULL;
m_initFuncp = NULL;
m_initSubFuncp = NULL;

View File

@ -1302,7 +1302,7 @@ class TristateVisitor : public TristateBaseVisitor {
public:
// CONSTUCTORS
TristateVisitor(AstNode* nodep) {
explicit TristateVisitor(AstNode* nodep) {
m_graphing = false;
m_modp = NULL;
m_cellp = NULL;

View File

@ -60,7 +60,7 @@ class UndrivenVarEntry {
public:
// CONSTRUCTORS
UndrivenVarEntry (AstVar* varp) { // Construction for when a var is used
explicit UndrivenVarEntry (AstVar* varp) { // Construction for when a var is used
UINFO(9, "create "<<varp<<endl);
m_varp = varp;
m_usedWhole = false;
@ -370,7 +370,7 @@ private:
}
public:
// CONSTUCTORS
UndrivenVisitor(AstNetlist* nodep) {
explicit UndrivenVisitor(AstNetlist* nodep) {
m_markBoth = false;
m_taskp = NULL;
m_alwaysp = NULL;

View File

@ -457,7 +457,7 @@ private:
public:
// CONSTUCTORS
UnknownVisitor(AstNetlist* nodep) {
explicit UnknownVisitor(AstNetlist* nodep) {
m_modp = NULL;
m_assigndlyp = NULL;
m_assignwp = NULL;

View File

@ -452,7 +452,7 @@ private:
if (!constp) { nodep->v3error("Replication value isn't a constant."); return; }
uint32_t times = constp->toUInt();
if (times==0 && !nodep->backp()->castConcat()) { // Concat Visitor will clean it up.
nodep->v3error("Replication value of 0 is only legal under a concatenation."); times=1;
nodep->v3error("Replication value of 0 is only legal under a concatenation.");
}
nodep->dtypeSetString();
}

View File

@ -151,7 +151,7 @@ private:
}
public:
// CONSTUCTORS
WidthCommitVisitor(AstNetlist* nodep) {
explicit WidthCommitVisitor(AstNetlist* nodep) {
// Were changing widthMin's, so the table is now somewhat trashed
nodep->typeTablep()->clearCache();
nodep->accept(*this);

View File

@ -77,7 +77,7 @@ private:
public:
// CONSTRUCTORS
VlcSource(const string& name) {
explicit VlcSource(const string& name) {
m_name = name;
m_needed = false;
}

View File

@ -64,6 +64,7 @@ sub process {
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="unusedFunction" .*vpi! && $line =~ m!verilated_vpi.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
@ -124,6 +125,12 @@ sub _suppress {
# delete(nodep); nodep=NULL; # This is ok, it's how we prevent later using nodep
return 1;
}
if (($id eq "uselessAssignment"
|| $id eq "uselessAssignmentPtrArg")
&& $line =~ /;.*p *= *NULL;/) {
# delete(nodep); nodep=NULL; # This is ok, it's how we prevent later using nodep
return 1;
}
}
}
return undef;

View File

@ -986,7 +986,7 @@ double V3ParseImp::parseDouble(const char* textp, size_t length) {
double d = strtod(strgp, &endp);
size_t parsed_len = endp-strgp;
if (parsed_len != strlen(strgp)) { yyerrorf("Syntax error parsing real: %s",strgp); }
delete strgp;
delete[] strgp;
return d;
}