Fix cppcheck warnings

This commit is contained in:
Wilson Snyder 2017-11-23 10:43:34 -05:00
parent 45702e319b
commit 7369500bb7
5 changed files with 13 additions and 19 deletions

View File

@ -131,7 +131,8 @@ class VL_SCOPED_CAPABILITY VerilatedLockGuard {
private:
VerilatedMutex& m_mutexr;
public:
VerilatedLockGuard(VerilatedMutex& mutexr) VL_ACQUIRE(mutexr) : m_mutexr(mutexr) {
explicit VerilatedLockGuard(VerilatedMutex& mutexr) VL_ACQUIRE(mutexr)
: m_mutexr(mutexr) {
m_mutexr.lock();
}
~VerilatedLockGuard() VL_RELEASE() {
@ -144,8 +145,9 @@ class VL_SCOPED_CAPABILITY VerilatedLockGuard {
// Empty classes to avoid #ifdefs everywhere
class VerilatedMutex {};
class VerilatedLockGuard {
VL_UNCOPYABLE(VerilatedLockGuard);
public:
VerilatedLockGuard(VerilatedMutex&) {}
explicit VerilatedLockGuard(VerilatedMutex&) {}
~VerilatedLockGuard() {}
};
#endif // VL_THREADED
@ -164,11 +166,11 @@ public:
// METHODS
/// Check that the current thread ID is the same as the construction thread ID
void check() VL_MT_UNSAFE_ONE {
// Memoize results in local thread, to prevent slow get_id() call
VL_THREAD_LOCAL bool t_okThread = (m_threadid == VL_THREAD_ID());
if (!VL_LIKELY(t_okThread)) {
fatal_different();
}
// Memoize results in local thread, to prevent slow get_id() call
VL_THREAD_LOCAL bool t_okThread = (m_threadid == VL_THREAD_ID());
if (!VL_LIKELY(t_okThread)) {
fatal_different();
}
}
static void fatal_different() VL_MT_SAFE;
#else // !VL_THREADED || !VL_DEBUG

View File

@ -199,7 +199,8 @@ class VerilatedImp {
public: // But only for verilated*.cpp
// CONSTRUCTORS
VerilatedImp() : m_argVecLoaded(false), m_exportNext(0) {
VerilatedImp()
: m_argVecLoaded(false), m_exportNext(0), m_spawned(false), m_numThreads(0) {
m_fdps.resize(3);
m_fdps[0] = stdin;
m_fdps[1] = stdout;

View File

@ -1738,8 +1738,8 @@ 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
VerilatedVpiImp::assertOneCheck();
// cppcheck-suppress nullPointer
if (VL_UNLIKELY(!time_p)) {
_VL_VPI_WARNING(__FILE__, __LINE__, "Ignoring vpi_get_time with NULL value pointer");
return;

View File

@ -518,15 +518,6 @@ private:
return varVxp;
}
bool isClkAssign(AstNodeAssign* nodep) {
if (AstVarRef* varrefp = nodep->lhsp()->castVarRef()) {
if (varrefp->varp()->attrClocker() == AstVarAttrClocker::CLOCKER_YES) {
return true;
}
}
return false;
}
void process();
void processCircular();
typedef deque<OrderEitherVertex*> VertexVec;

View File

@ -223,7 +223,7 @@ public:
m_ahead = false;
m_curBisonVal.token = 0;
m_prevBisonVal.token = 0;
// m_aheadVal not used as m_ahead = false
// m_aheadVal not used as m_ahead = false, and not all compilers support initing it
m_tagNodep = NULL;
}
~V3ParseImp();