Internals: Fix misc internal coverage holes. No functional change intended.

This commit is contained in:
Wilson Snyder 2020-06-04 19:49:18 -04:00
parent b88e1e6970
commit a433096d5a
7 changed files with 22 additions and 15 deletions

View File

@ -2254,11 +2254,24 @@ void Verilated::flushCb(VerilatedVoidCb cb) VL_MT_SAFE {
}
}
// When running internal code coverage (gcc --coverage, as opposed to
// verilator --coverage), dump coverage data to properly cover failing
// tests.
#ifdef VL_GCOV
extern "C" {
void __gcov_flush(); // gcc sources gcc/gcov-io.h has the prototype
}
void vl_gcov_flush() { __gcov_flush(); }
#else
void vl_gcov_flush() {}
#endif
void Verilated::flushCall() VL_MT_SAFE {
const VerilatedLockGuard lock(m_mutex);
if (s_flushCb) (*s_flushCb)();
fflush(stderr);
fflush(stdout);
vl_gcov_flush();
}
const char* Verilated::productName() VL_PURE { return VERILATOR_PRODUCT; }

View File

@ -623,7 +623,7 @@ const char* VerilatedVpiError::strFromVpiVal(PLI_INT32 vpiVal) VL_MT_SAFE {
"vpiRawFourStateVal",
};
// clang-format on
if (vpiVal < 0) return names[0];
if (VL_UNCOVERABLE(vpiVal < 0)) return names[0];
return names[(vpiVal <= vpiRawFourStateVal) ? vpiVal : 0];
}
const char* VerilatedVpiError::strFromVpiObjType(PLI_INT32 vpiVal) VL_MT_SAFE {
@ -767,7 +767,7 @@ const char* VerilatedVpiError::strFromVpiObjType(PLI_INT32 vpiVal) VL_MT_SAFE {
"vpiGenVar"
};
// clang-format on
if (vpiVal < 0) return names[0];
if (VL_UNCOVERABLE(vpiVal < 0)) return names[0];
return names[(vpiVal <= vpiGenVar) ? vpiVal : 0];
}
const char* VerilatedVpiError::strFromVpiMethod(PLI_INT32 vpiVal) VL_MT_SAFE {
@ -850,7 +850,7 @@ const char* VerilatedVpiError::strFromVpiCallbackReason(PLI_INT32 vpiVal) VL_MT_
"cbAtEndOfSimTime"
};
// clang-format on
if (vpiVal < 0) return names[0];
if (VL_UNCOVERABLE(vpiVal < 0)) return names[0];
return names[(vpiVal <= cbAtEndOfSimTime) ? vpiVal : 0];
}
@ -1141,7 +1141,8 @@ vpiHandle vpi_handle(PLI_INT32 type, vpiHandle object) {
if (VL_UNLIKELY(!vop->rangep())) return 0;
return (new VerilatedVpioConst(vop->rangep()->left()))->castVpiHandle();
}
_VL_VPI_WARNING(__FILE__, __LINE__, "%s: Unsupported vpiHandle (%p) for type %s, nothing will be returned",
_VL_VPI_WARNING(__FILE__, __LINE__,
"%s: Unsupported vpiHandle (%p) for type %s, nothing will be returned",
VL_FUNC, object, VerilatedVpiError::strFromVpiMethod(type));
return 0;
}
@ -1153,7 +1154,8 @@ vpiHandle vpi_handle(PLI_INT32 type, vpiHandle object) {
if (VL_UNLIKELY(!vop->rangep())) return 0;
return (new VerilatedVpioConst(vop->rangep()->right()))->castVpiHandle();
}
_VL_VPI_WARNING(__FILE__, __LINE__, "%s: Unsupported vpiHandle (%p) for type %s, nothing will be returned",
_VL_VPI_WARNING(__FILE__, __LINE__,
"%s: Unsupported vpiHandle (%p) for type %s, nothing will be returned",
VL_FUNC, object, VerilatedVpiError::strFromVpiMethod(type));
return 0;
}
@ -2089,7 +2091,7 @@ PLI_INT32 vpi_control(PLI_INT32 operation, ...) {
}
case vpiStop: {
VL_STOP_MT("", 0, "*VPI*");
return 1;
return 1; // LCOV_EXCL_LINE
}
default: {
_VL_VPI_WARNING(__FILE__, __LINE__, "%s: Unsupported type %s, ignoring", VL_FUNC,

View File

@ -36,10 +36,6 @@ AstNetlist* V3Global::makeNetlist() {
void V3Global::checkTree() { rootp()->checkTree(); }
void V3Global::clear() {
if (m_rootp) VL_DO_CLEAR(m_rootp->deleteTree(), m_rootp = NULL);
}
void V3Global::readFiles() {
// NODE STATE
// AstNode::user4p() // VSymEnt* Package and typedef symbol names

View File

@ -105,7 +105,6 @@ public:
UASSERT(!m_rootp, "call once");
m_rootp = makeNetlist();
}
void clear();
// ACCESSORS (general)
AstNetlist* rootp() const { return m_rootp; }
VWidthMinUsage widthMinUsage() const { return m_widthMinUsage; }

View File

@ -192,7 +192,7 @@ private:
: new AstConst(rhsp->fileline(), AstConst::LogicFalse());
}
}
rhsp->v3fatal("Don't know how to fold expression");
rhsp->v3fatalSrc("Don't know how to fold expression");
}
void mergeEnd() {

View File

@ -240,8 +240,6 @@ void V3Os::unlinkRegexp(const string& dir, const string& regexp) {
}
}
std::string V3Os::getcwd() { return filenameRealPath("."); }
//######################################################################
// METHODS (random)

View File

@ -53,7 +53,6 @@ public:
// METHODS (directory utilities)
static void createDir(const string& dirname);
static void unlinkRegexp(const string& dir, const string& regexp);
static std::string getcwd(); // Return the current working directory
// METHODS (random)
static vluint64_t rand64(vluint64_t* statep);