Cleanup misc clang-tidy warnings. No functional change intended

This commit is contained in:
Wilson Snyder 2020-04-03 22:31:54 -04:00
parent 27516b565d
commit 38a31ae168
42 changed files with 245 additions and 215 deletions

View File

@ -302,7 +302,6 @@ AC_SUBST(CFG_CXXFLAGS_WEXTRA)
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-Qunused-arguments)
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-faligned-new)
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-Wno-unused-parameter)
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-Wno-undefined-bool-conversion)
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-Wno-shadow)
AC_SUBST(CFG_CXXFLAGS_SRC)

View File

@ -884,7 +884,7 @@ static inline int _vl_vsss_peek(FILE* fp, int& floc, WDataInP fromp,
}
static inline void _vl_vsss_skipspace(FILE* fp, int& floc,
WDataInP fromp, const std::string& fstr) VL_MT_SAFE {
while (1) {
while (true) {
int c = _vl_vsss_peek(fp, floc, fromp, fstr);
if (c==EOF || !isspace(c)) return;
_vl_vsss_advance(fp, floc);
@ -894,7 +894,7 @@ static inline void _vl_vsss_read(FILE* fp, int& floc, WDataInP fromp, const std:
char* tmpp, const char* acceptp) VL_MT_SAFE {
// Read into tmp, consisting of characters from acceptp list
char* cp = tmpp;
while (1) {
while (true) {
int c = _vl_vsss_peek(fp, floc, fromp, fstr);
if (c==EOF || isspace(c)) break;
if (acceptp // String - allow anything
@ -1340,7 +1340,7 @@ IData VL_FREAD_I(int width, int array_lsb, int array_size,
// Read the data
// We process a character at a time, as then we don't need to deal
// with changing buffer sizes dynamically, etc.
while (1) {
while (true) {
int c = fgetc(fp);
if (VL_UNLIKELY(c == EOF)) break;
// Shift value in
@ -1668,7 +1668,7 @@ bool VlReadMem::get(QData& addrr, std::string& valuer) {
// Read the data
// We process a character at a time, as then we don't need to deal
// with changing buffer sizes dynamically, etc.
while (1) {
while (true) {
int c = fgetc(m_fp);
if (VL_UNLIKELY(c == EOF)) break;
// printf("%d: Got '%c' Addr%lx IN%d IgE%d IgC%d\n",
@ -1853,7 +1853,7 @@ void VL_READMEM_N(bool hex, // Hex format, else binary
VlReadMem rmem(hex, bits, filename, start, end);
if (VL_UNLIKELY(!rmem.isOpen())) return;
while (1) {
while (true) {
QData addr;
std::string value;
if (rmem.get(addr /*ref*/, value/*ref*/)) {
@ -2183,9 +2183,7 @@ void VerilatedImp::commandArgsAddGuts(int argc, const char** argv) VL_REQUIRES(s
void VerilatedImp::commandArgVl(const std::string& arg) {
if (0 == strncmp(arg.c_str(), "+verilator+", strlen("+verilator+"))) {
std::string value;
if (0) {
}
else if (arg == "+verilator+debug") {
if (arg == "+verilator+debug") {
Verilated::debug(4);
}
else if (commandArgVlValue(arg, "+verilator+debugi+", value/*ref*/)) {

View File

@ -316,7 +316,7 @@ private:
public: // But internals only - called from VerilatedModule's
VerilatedScope();
~VerilatedScope();
void configure(VerilatedSyms* symsp, const char* prefixp, const char* suffix,
void configure(VerilatedSyms* symsp, const char* prefixp, const char* suffixp,
const char* identifier, const Type type) VL_MT_UNSAFE;
void exportInsert(int finalize, const char* namep, void* cb) VL_MT_UNSAFE;
void varInsert(int finalize, const char* namep, void* datap,
@ -1653,18 +1653,22 @@ static inline void _VL_INSERT_WW(int, WDataOutP owp, WDataInP lwp, int hbit, int
int oword = lword+i;
EData d = lwp[i] << loffset;
EData od = (owp[oword] & ~linsmask) | (d & linsmask);
if (oword == hword)
if (oword == hword) {
owp[oword] = (owp[oword] & ~hinsmask) | (od & hinsmask);
else owp[oword] = od;
} else {
owp[oword] = od;
}
}
{ // Upper word
int oword = lword+i+1;
if (oword <= hword) {
EData d = lwp[i] >> nbitsonright;
EData od = (d & ~linsmask) | (owp[oword] & linsmask);
if (oword == hword)
if (oword == hword) {
owp[oword] = (owp[oword] & ~hinsmask) | (od & hinsmask);
else owp[oword] = od;
} else {
owp[oword] = od;
}
}
}
}
@ -2280,7 +2284,6 @@ static inline WDataOutP VL_RTOIROUND_W_D(int obits, WDataOutP owp, double lhs) V
if (lsb < 0) {
VL_SET_WQ(owp, mantissa >> -lsb);
} else if (lsb < obits) {
int lsbword = VL_BITWORD_I(lsb);
_VL_INSERT_WQ(obits, owp, mantissa, lsb + 52, lsb);
}
if (lhs < 0) VL_NEGATE_INPLACE_W(VL_WORDS_I(obits), owp);

View File

@ -74,7 +74,7 @@ public:
virtual void zero() const VL_OVERRIDE { *m_countp = 0; }
// CONSTRUCTORS
// cppcheck-suppress noExplicitConstructor
VerilatedCoverItemSpec(T* countp) : m_countp(countp) { *m_countp = 0; }
explicit VerilatedCoverItemSpec(T* countp) : m_countp(countp) { *m_countp = 0; }
virtual ~VerilatedCoverItemSpec() VL_OVERRIDE {}
};

View File

@ -29,9 +29,15 @@
/// Conditionally compile coverage code
#ifdef VM_COVERAGE
# define VL_IF_COVER(stmts) do { stmts ; } while(0)
# define VL_IF_COVER(stmts) \
do { \
stmts; \
} while (false)
#else
# define VL_IF_COVER(stmts) do { if(0) { stmts ; } } while(0)
# define VL_IF_COVER(stmts) \
do { \
if (false) { stmts; } \
} while (false)
#endif
//=============================================================================

View File

@ -33,10 +33,10 @@
//===================================================================
// String formatters (required by below containers)
extern std::string VL_TO_STRING(CData obj);
extern std::string VL_TO_STRING(SData obj);
extern std::string VL_TO_STRING(IData obj);
extern std::string VL_TO_STRING(QData obj);
extern std::string VL_TO_STRING(CData lhs);
extern std::string VL_TO_STRING(SData lhs);
extern std::string VL_TO_STRING(IData lhs);
extern std::string VL_TO_STRING(QData lhs);
inline std::string VL_TO_STRING(const std::string& obj) { return "\"" + obj + "\""; }
extern std::string VL_TO_STRING_W(int words, WDataInP obj);
@ -158,7 +158,7 @@ public:
int next(T_Key& indexr) const {
typename Map::const_iterator it = m_map.find(indexr);
if (VL_UNLIKELY(it == m_map.end())) return 0;
it++;
++it;
if (VL_UNLIKELY(it == m_map.end())) return 0;
indexr = it->first;
return 1;
@ -217,7 +217,7 @@ void VL_READMEM_N(bool hex, int bits, const std::string& filename,
VlAssocArray<T_Key, T_Value>& obj, QData start, QData end) VL_MT_SAFE {
VlReadMem rmem(hex, bits, filename, start, end);
if (VL_UNLIKELY(!rmem.isOpen())) return;
while (1) {
while (true) {
QData addr;
std::string data;
if (rmem.get(addr /*ref*/, data /*ref*/)) {

View File

@ -184,7 +184,7 @@ void VerilatedSave::flush() VL_MT_UNSAFE_ONE {
m_assertOne.check();
if (VL_UNLIKELY(!isOpen())) return;
vluint8_t* wp = m_bufp;
while (1) {
while (true) {
ssize_t remaining = (m_cp - wp);
if (remaining==0) break;
errno = 0;
@ -213,7 +213,7 @@ void VerilatedRestore::fill() VL_MT_UNSAFE_ONE {
m_endp = m_bufp + (m_endp - m_cp);
m_cp = m_bufp; // Reset buffer
// Read into buffer starting at m_endp
while (1) {
while (true) {
ssize_t remaining = (m_bufp+bufferSize() - m_endp);
if (remaining==0) break;
errno = 0;

View File

@ -36,7 +36,8 @@ VlMTaskVertex::VlMTaskVertex(vluint32_t upstreamDepCount)
// VlWorkerThread
VlWorkerThread::VlWorkerThread(VlThreadPool* poolp, bool profiling)
: m_ready_size(0)
: m_waiting(false)
, m_ready_size(0)
, m_poolp(poolp)
, m_profiling(profiling)
, m_exiting(false)
@ -58,7 +59,7 @@ void VlWorkerThread::workerLoop() {
ExecRec work;
work.m_fnp = NULL;
while (1) {
while (true) {
if (VL_LIKELY(!work.m_fnp)) {
dequeWork(&work);
}

View File

@ -147,7 +147,7 @@ public:
return (!this->operator==(other));
}
void advanceUntilValid() {
while (1) {
while (true) {
if (m_bit != m_setp->m_bucketsp[m_bucketIdx].end()) {
// Valid iterator in this bucket; we're done.
return;

View File

@ -364,7 +364,7 @@ void VerilatedVcd::bufferFlush() VL_MT_UNSAFE_ONE {
m_assertOne.check();
if (VL_UNLIKELY(!isOpen())) return;
char* wp = m_wrBufp;
while (1) {
while (true) {
ssize_t remaining = (m_writep - wp);
if (remaining==0) break;
errno = 0;

View File

@ -76,21 +76,22 @@ public:
if (VL_UNCOVERABLE(size>chunk)) VL_FATAL_MT(__FILE__, __LINE__, "", "increase chunk");
if (VL_LIKELY(t_freeHead)) {
vluint8_t* newp = t_freeHead;
t_freeHead = *((vluint8_t**)newp);
t_freeHead = *(reinterpret_cast<vluint8_t**>(newp));
return newp+8;
}
// +8: 8 bytes for next
vluint8_t* newp = reinterpret_cast<vluint8_t*>(::operator new(chunk+8));
return newp+8;
}
inline static void operator delete(void* obj, size_t size) VL_MT_SAFE {
vluint8_t* oldp = ((vluint8_t*)obj)-8;
*((void**)oldp) = t_freeHead;
inline static void operator delete(void* obj, size_t /*size*/)VL_MT_SAFE {
vluint8_t* oldp = (static_cast<vluint8_t*>(obj)) - 8;
*(reinterpret_cast<void**>(oldp)) = t_freeHead;
t_freeHead = oldp;
}
// MEMBERS
static inline VerilatedVpio* castp(vpiHandle h) {
return dynamic_cast<VerilatedVpio*>((VerilatedVpio*)h); }
return dynamic_cast<VerilatedVpio*>(reinterpret_cast<VerilatedVpio*>(h));
}
inline vpiHandle castVpiHandle() { return reinterpret_cast<vpiHandle>(this); }
// ACCESSORS
virtual const char* name() const { return "<null>"; }
@ -117,7 +118,8 @@ public:
}
virtual ~VerilatedVpioCb() {}
static inline VerilatedVpioCb* castp(vpiHandle h) {
return dynamic_cast<VerilatedVpioCb*>((VerilatedVpio*)h); }
return dynamic_cast<VerilatedVpioCb*>(reinterpret_cast<VerilatedVpio*>(h));
}
virtual vluint32_t type() const { return vpiCallback; }
vluint32_t reason() const { return m_cbData.reason; }
VerilatedPliCb cb_rtnp() const { return m_cbData.cb_rtn; }
@ -131,7 +133,8 @@ public:
explicit VerilatedVpioConst(vlsint32_t num) : m_num(num) {}
virtual ~VerilatedVpioConst() {}
static inline VerilatedVpioConst* castp(vpiHandle h) {
return dynamic_cast<VerilatedVpioConst*>((VerilatedVpio*)h); }
return dynamic_cast<VerilatedVpioConst*>(reinterpret_cast<VerilatedVpio*>(h));
}
virtual vluint32_t type() const { return vpiUndefined; }
vlsint32_t num() const { return m_num; }
};
@ -143,7 +146,8 @@ public:
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); }
return dynamic_cast<VerilatedVpioRange*>(reinterpret_cast<VerilatedVpio*>(h));
}
virtual vluint32_t type() const { return vpiRange; }
virtual vluint32_t size() const { return m_range->elements(); }
virtual const VerilatedRange* rangep() const { return m_range; }
@ -167,7 +171,8 @@ public:
: m_scopep(scopep) {}
virtual ~VerilatedVpioScope() {}
static inline VerilatedVpioScope* castp(vpiHandle h) {
return dynamic_cast<VerilatedVpioScope*>((VerilatedVpio*)h); }
return dynamic_cast<VerilatedVpioScope*>(reinterpret_cast<VerilatedVpio*>(h));
}
virtual vluint32_t type() const { return vpiScope; }
const VerilatedScope* scopep() const { return m_scopep; }
virtual const char* name() const { return m_scopep->name(); }
@ -202,7 +207,8 @@ public:
if (m_prevDatap) { delete [] m_prevDatap; m_prevDatap = NULL; }
}
static inline VerilatedVpioVar* castp(vpiHandle h) {
return dynamic_cast<VerilatedVpioVar*>((VerilatedVpio*)h); }
return dynamic_cast<VerilatedVpioVar*>(reinterpret_cast<VerilatedVpio*>(h));
}
const VerilatedVar* varp() const { return m_varp; }
const VerilatedScope* scopep() const { return m_scopep; }
vluint32_t mask() const { return m_mask.u32; }
@ -236,11 +242,12 @@ public:
vlsint32_t index, int offset)
: VerilatedVpioVar(varp, scopep) {
m_index = index;
m_varDatap = ((vluint8_t*)varp->datap()) + entSize()*offset;
m_varDatap = (static_cast<vluint8_t*>(varp->datap())) + entSize() * offset;
}
virtual ~VerilatedVpioMemoryWord() {}
static inline VerilatedVpioMemoryWord* castp(vpiHandle h) {
return dynamic_cast<VerilatedVpioMemoryWord*>((VerilatedVpio*)h); }
return dynamic_cast<VerilatedVpioMemoryWord*>(reinterpret_cast<VerilatedVpio*>(h));
}
virtual vluint32_t type() const { return vpiMemoryWord; }
virtual vluint32_t size() const { return varp()->packed().elements(); }
virtual const VerilatedRange* rangep() const { return &(varp()->packed()); }
@ -261,7 +268,8 @@ public:
: m_scopep(scopep), m_started(false) { }
virtual ~VerilatedVpioVarIter() {}
static inline VerilatedVpioVarIter* castp(vpiHandle h) {
return dynamic_cast<VerilatedVpioVarIter*>((VerilatedVpio*)h); }
return dynamic_cast<VerilatedVpioVarIter*>(reinterpret_cast<VerilatedVpio*>(h));
}
virtual vluint32_t type() const { return vpiIterator; }
virtual vpiHandle dovpi_scan() {
if (VL_LIKELY(m_scopep->varsp())) {
@ -291,7 +299,8 @@ public:
m_done(false) { }
virtual ~VerilatedVpioMemoryWordIter() {}
static inline VerilatedVpioMemoryWordIter* castp(vpiHandle h) {
return dynamic_cast<VerilatedVpioMemoryWordIter*>((VerilatedVpio*)h); }
return dynamic_cast<VerilatedVpioMemoryWordIter*>(reinterpret_cast<VerilatedVpio*>(h));
}
virtual vluint32_t type() const { return vpiIterator; }
void iterationInc() {
if (!(m_done = (m_iteration == m_varp->unpacked().left()))) {
@ -318,7 +327,8 @@ public:
m_name = m_scopep->identifier();
}
static inline VerilatedVpioModule* castp(vpiHandle h) {
return dynamic_cast<VerilatedVpioModule*>((VerilatedVpio*)h); }
return dynamic_cast<VerilatedVpioModule*>(reinterpret_cast<VerilatedVpio*>(h));
}
virtual vluint32_t type() const { return vpiModule; }
virtual const char* name() const { return m_name; }
virtual const char* fullname() const { return m_fullname; }
@ -333,7 +343,8 @@ public:
}
virtual ~VerilatedVpioModuleIter() {}
static inline VerilatedVpioModuleIter* castp(vpiHandle h) {
return dynamic_cast<VerilatedVpioModuleIter*>((VerilatedVpio*) h); }
return dynamic_cast<VerilatedVpioModuleIter*>(reinterpret_cast<VerilatedVpio*>(h));
}
virtual vluint32_t type() const { return vpiIterator; }
virtual vpiHandle dovpi_scan() {
if (m_it == m_vec->end()) {
@ -461,7 +472,7 @@ public:
varop->fullname(),
*((CData*)newDatap), *((CData*)prevDatap),
newDatap, prevDatap););
if (memcmp(prevDatap, newDatap, varop->entSize())) {
if (memcmp(prevDatap, newDatap, varop->entSize()) != 0) {
VL_DEBUG_IF_PLI(VL_DBG_MSGF("- vpi: value_callback %p %s v[0]=%d\n",
vop, varop->fullname(), *((CData*)newDatap)););
update.insert(varop);
@ -505,7 +516,7 @@ public:
VerilatedVpiError() : m_flag(false) {
m_buff[0] = '\0';
m_errorInfo.product = (PLI_BYTE8*)Verilated::productName();
m_errorInfo.product = const_cast<PLI_BYTE8*>(Verilated::productName());
}
~VerilatedVpiError() {}
static void selfTest() VL_MT_UNSAFE_ONE;
@ -514,7 +525,7 @@ public:
m_errorInfo.level = level;
return this;
}
void setMessage(std::string file, PLI_INT32 line, const char* message, ...) {
void setMessage(const std::string& file, PLI_INT32 line, const char* message, ...) {
// message cannot be a const string& as va_start cannot use a reference
static VL_THREAD_LOCAL std::string filehold;
va_list args;
@ -523,7 +534,7 @@ public:
va_end(args);
m_errorInfo.state = vpiPLI;
filehold = file;
setError((PLI_BYTE8*)m_buff, NULL, (PLI_BYTE8*)filehold.c_str(), line);
setError((PLI_BYTE8*)m_buff, NULL, const_cast<PLI_BYTE8*>(filehold.c_str()), line);
}
p_vpi_error_info getError() {
if (m_flag) return &m_errorInfo;
@ -1024,14 +1035,13 @@ PLI_INT32 vpi_remove_cb(vpiHandle object) {
return 1;
}
void vpi_get_cb_info(vpiHandle object, p_cb_data cb_data_p) {
_VL_VPI_UNIMP(); return;
void vpi_get_cb_info(vpiHandle /*object*/, p_cb_data /*cb_data_p*/) { _VL_VPI_UNIMP(); }
vpiHandle vpi_register_systf(p_vpi_systf_data /*systf_data_p*/) {
_VL_VPI_UNIMP();
return 0;
}
vpiHandle vpi_register_systf(p_vpi_systf_data systf_data_p) {
_VL_VPI_UNIMP(); return 0;
}
void vpi_get_systf_info(vpiHandle object, p_vpi_systf_data systf_data_p) {
_VL_VPI_UNIMP(); return;
void vpi_get_systf_info(vpiHandle /*object*/, p_vpi_systf_data /*systf_data_p*/) {
_VL_VPI_UNIMP();
}
// for obtaining handles
@ -1047,7 +1057,7 @@ vpiHandle vpi_handle_by_name(PLI_BYTE8* namep, vpiHandle scope) {
std::string scopeAndName = namep;
if (voScopep) {
scopeAndName = std::string(voScopep->fullname()) + "." + namep;
namep = (PLI_BYTE8*)scopeAndName.c_str();
namep = const_cast<PLI_BYTE8*>(scopeAndName.c_str());
}
{
// This doesn't yet follow the hierarchy in the proper way
@ -1067,7 +1077,7 @@ vpiHandle vpi_handle_by_name(PLI_BYTE8* namep, vpiHandle scope) {
scopename = std::string(namep, dotp-namep);
}
if (scopename.find(".") == std::string::npos) {
if (scopename.find('.') == std::string::npos) {
// This is a toplevel, hence search in our TOP ports first.
scopep = Verilated::scopeFind("TOP");
if (scopep) {
@ -1150,8 +1160,10 @@ vpiHandle vpi_handle(PLI_INT32 type, vpiHandle object) {
}
}
vpiHandle vpi_handle_multi(PLI_INT32 type, vpiHandle refHandle1, vpiHandle refHandle2, ... ) {
_VL_VPI_UNIMP(); return 0;
vpiHandle vpi_handle_multi(PLI_INT32 /*type*/, vpiHandle /*refHandle1*/, vpiHandle /*refHandle2*/,
...) {
_VL_VPI_UNIMP();
return 0;
}
vpiHandle vpi_iterate(PLI_INT32 type, vpiHandle object) {
@ -1194,7 +1206,7 @@ vpiHandle vpi_iterate(PLI_INT32 type, vpiHandle object) {
VerilatedVpioModule* vop = VerilatedVpioModule::castp(object);
const VerilatedHierarchyMap* map = VerilatedImp::hierarchyMap();
const VerilatedScope *mod = vop ? vop->scopep() : NULL;
VerilatedHierarchyMap::const_iterator it = map->find((VerilatedScope*) mod);
VerilatedHierarchyMap::const_iterator it = map->find(const_cast<VerilatedScope*>(mod));
if (it == map->end()) return 0;
return ((new VerilatedVpioModuleIter(it->second))->castVpiHandle());
}
@ -1256,7 +1268,7 @@ PLI_INT32 vpi_get(PLI_INT32 property, vpiHandle object) {
}
}
PLI_INT64 vpi_get64(PLI_INT32 property, vpiHandle object) {
PLI_INT64 vpi_get64(PLI_INT32 /*property*/, vpiHandle /*object*/) {
_VL_VPI_UNIMP();
return 0;
}
@ -1269,16 +1281,16 @@ PLI_BYTE8 *vpi_get_str(PLI_INT32 property, vpiHandle object) {
if (VL_UNLIKELY(!vop)) return NULL;
switch (property) {
case vpiName: {
return (PLI_BYTE8*)vop->name();
return const_cast<PLI_BYTE8*>(vop->name());
}
case vpiFullName: {
return (PLI_BYTE8*)vop->fullname();
return const_cast<PLI_BYTE8*>(vop->fullname());
}
case vpiDefName: {
return (PLI_BYTE8*)vop->defname();
return const_cast<PLI_BYTE8*>(vop->defname());
}
case vpiType: {
return (PLI_BYTE8*) VerilatedVpiError::strFromVpiObjType(vop->type());
return const_cast<PLI_BYTE8*>(VerilatedVpiError::strFromVpiObjType(vop->type()));
}
default:
_VL_VPI_WARNING(__FILE__, __LINE__, "%s: Unsupported type %s, nothing will be returned",
@ -1289,14 +1301,8 @@ PLI_BYTE8 *vpi_get_str(PLI_INT32 property, vpiHandle object) {
// delay processing
void vpi_get_delays(vpiHandle object, p_vpi_delay delay_p) {
_VL_VPI_UNIMP();
return;
}
void vpi_put_delays(vpiHandle object, p_vpi_delay delay_p) {
_VL_VPI_UNIMP();
return;
}
void vpi_get_delays(vpiHandle /*object*/, p_vpi_delay /*delay_p*/) { _VL_VPI_UNIMP(); }
void vpi_put_delays(vpiHandle /*object*/, p_vpi_delay /*delay_p*/) { _VL_VPI_UNIMP(); }
// value processing
@ -1582,8 +1588,8 @@ void vpi_get_value(vpiHandle object, p_vpi_value value_p) {
VL_FUNC, VerilatedVpiError::strFromVpiVal(value_p->format));
}
vpiHandle vpi_put_value(vpiHandle object, p_vpi_value value_p,
p_vpi_time time_p, PLI_INT32 flags) {
vpiHandle vpi_put_value(vpiHandle object, p_vpi_value value_p, p_vpi_time /*time_p*/,
PLI_INT32 /*flags*/) {
VL_DEBUG_IF_PLI(VL_DBG_MSGF("- vpi: vpi_put_value %p %p\n", object, value_p););
VerilatedVpiImp::assertOneCheck();
_VL_VPI_ERROR_RESET();
@ -1876,19 +1882,18 @@ vpiHandle vpi_put_value(vpiHandle object, p_vpi_value value_p,
return NULL;
}
void vpi_get_value_array(vpiHandle object, p_vpi_arrayvalue arrayvalue_p,
PLI_INT32 *index_p, PLI_UINT32 num) {
_VL_VPI_UNIMP(); return;
void vpi_get_value_array(vpiHandle /*object*/, p_vpi_arrayvalue /*arrayvalue_p*/,
PLI_INT32* /*index_p*/, PLI_UINT32 /*num*/) {
_VL_VPI_UNIMP();
}
void vpi_put_value_array(vpiHandle object, p_vpi_arrayvalue arrayvalue_p,
PLI_INT32 *index_p, PLI_UINT32 num) {
_VL_VPI_UNIMP(); return;
void vpi_put_value_array(vpiHandle /*object*/, p_vpi_arrayvalue /*arrayvalue_p*/,
PLI_INT32* /*index_p*/, PLI_UINT32 /*num*/) {
_VL_VPI_UNIMP();
}
// time processing
void vpi_get_time(vpiHandle object, p_vpi_time time_p) {
void vpi_get_time(vpiHandle /*object*/, p_vpi_time time_p) {
VerilatedVpiImp::assertOneCheck();
// cppcheck-suppress nullPointer
if (VL_UNLIKELY(!time_p)) {
@ -1905,7 +1910,6 @@ void vpi_get_time(vpiHandle object, p_vpi_time time_p) {
}
_VL_VPI_ERROR(__FILE__, __LINE__, "%s: Unsupported type (%d)",
VL_FUNC, time_p->type);
return;
}
// I/O routines
@ -1919,11 +1923,13 @@ PLI_UINT32 vpi_mcd_open(PLI_BYTE8 *filenamep) {
PLI_UINT32 vpi_mcd_close(PLI_UINT32 mcd) {
VerilatedVpiImp::assertOneCheck();
_VL_VPI_ERROR_RESET();
VL_FCLOSE_I(mcd); return 0;
VL_FCLOSE_I(mcd);
return 0;
}
PLI_BYTE8 *vpi_mcd_name(PLI_UINT32 mcd) {
_VL_VPI_UNIMP(); return 0;
PLI_BYTE8* vpi_mcd_name(PLI_UINT32 /*mcd*/) {
_VL_VPI_UNIMP();
return 0;
}
PLI_INT32 vpi_mcd_printf(PLI_UINT32 mcd, PLI_BYTE8 *formatp, ...) {
@ -1980,8 +1986,9 @@ PLI_INT32 vpi_mcd_flush(PLI_UINT32 mcd) {
// utility routines
PLI_INT32 vpi_compare_objects(vpiHandle object1, vpiHandle object2) {
_VL_VPI_UNIMP(); return 0;
PLI_INT32 vpi_compare_objects(vpiHandle /*object1*/, vpiHandle /*object2*/) {
_VL_VPI_UNIMP();
return 0;
}
PLI_INT32 vpi_chk_error(p_vpi_error_info error_info_p) {
// executing vpi_chk_error does not reset error
@ -2016,25 +2023,29 @@ PLI_INT32 vpi_get_vlog_info(p_vpi_vlog_info vlog_info_p) VL_MT_SAFE {
VerilatedVpiImp::assertOneCheck();
_VL_VPI_ERROR_RESET();
vlog_info_p->argc = Verilated::getCommandArgs()->argc;
vlog_info_p->argv = (PLI_BYTE8**)Verilated::getCommandArgs()->argv;
vlog_info_p->product = (PLI_BYTE8*)Verilated::productName();
vlog_info_p->version = (PLI_BYTE8*)Verilated::productVersion();
vlog_info_p->argv = const_cast<PLI_BYTE8**>(Verilated::getCommandArgs()->argv);
vlog_info_p->product = const_cast<PLI_BYTE8*>(Verilated::productName());
vlog_info_p->version = const_cast<PLI_BYTE8*>(Verilated::productVersion());
return 1;
}
// routines added with 1364-2001
PLI_INT32 vpi_get_data(PLI_INT32 id, PLI_BYTE8 *dataLoc, PLI_INT32 numOfBytes) {
_VL_VPI_UNIMP(); return 0;
PLI_INT32 vpi_get_data(PLI_INT32 /*id*/, PLI_BYTE8* /*dataLoc*/, PLI_INT32 /*numOfBytes*/) {
_VL_VPI_UNIMP();
return 0;
}
PLI_INT32 vpi_put_data(PLI_INT32 id, PLI_BYTE8 *dataLoc, PLI_INT32 numOfBytes) {
_VL_VPI_UNIMP(); return 0;
PLI_INT32 vpi_put_data(PLI_INT32 /*id*/, PLI_BYTE8* /*dataLoc*/, PLI_INT32 /*numOfBytes*/) {
_VL_VPI_UNIMP();
return 0;
}
void *vpi_get_userdata(vpiHandle obj) {
_VL_VPI_UNIMP(); return 0;
void* vpi_get_userdata(vpiHandle /*obj*/) {
_VL_VPI_UNIMP();
return 0;
}
PLI_INT32 vpi_put_userdata(vpiHandle obj, void *userdata) {
_VL_VPI_UNIMP(); return 0;
PLI_INT32 vpi_put_userdata(vpiHandle /*obj*/, void* /*userdata*/) {
_VL_VPI_UNIMP();
return 0;
}
PLI_INT32 vpi_control(PLI_INT32 operation, ...) {
@ -2056,6 +2067,8 @@ PLI_INT32 vpi_control(PLI_INT32 operation, ...) {
return 0;
}
vpiHandle vpi_handle_by_multi_index(vpiHandle obj, PLI_INT32 num_index, PLI_INT32 *index_array) {
_VL_VPI_UNIMP(); return 0;
vpiHandle vpi_handle_by_multi_index(vpiHandle /*obj*/, PLI_INT32 /*num_index*/,
PLI_INT32* /*index_array*/) {
_VL_VPI_UNIMP();
return 0;
}

View File

@ -153,15 +153,32 @@
# define VL_DANGLING(var)
#else
///< After e.g. delete, set variable to NULL to indicate must not use later
# define VL_DANGLING(var) do { (var) = NULL; } while(0)
# define VL_DANGLING(var) \
do { \
(var) = NULL; \
} while (false)
#endif
///< Perform an e.g. delete, then set variable to NULL to indicate must not use later.
///< Unlike VL_DO_CLEAR the setting of the variable is only for debug reasons.
#define VL_DO_DANGLING(stmt, var) do { do { stmt; } while(0); VL_DANGLING(var); } while(0)
#define VL_DO_DANGLING(stmt, var) \
do { \
do { \
stmt; \
} while (false); \
VL_DANGLING(var); \
} while (false)
///< Perform an e.g. delete, then set variable to NULL as a requirement
#define VL_DO_CLEAR(stmt, stmt2) do { do { stmt; } while(0); do { stmt2; } while(0); } while(0)
#define VL_DO_CLEAR(stmt, stmt2) \
do { \
do { \
stmt; \
} while (false); \
do { \
stmt2; \
} while (false); \
} while (false)
//=========================================================================
// C++-2011

View File

@ -415,15 +415,14 @@ private:
virtual void visit(AstNodeMath* nodep) VL_OVERRIDE {}
virtual void visit(AstVarScope* nodep) VL_OVERRIDE {}
//--------------------
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
virtual void visit(AstNode* nodep) VL_OVERRIDE { iterateChildren(nodep); }
public:
// CONSTRUCTORS
explicit ActiveVisitor(AstNetlist* nodep) {
m_scopeFinalp = NULL;
m_itemCombo = false;
m_itemSequent = false;
explicit ActiveVisitor(AstNetlist* nodep)
: m_scopeFinalp(NULL)
, m_itemCombo(false)
, m_itemSequent(false) {
iterate(nodep);
}
virtual ~ActiveVisitor() {}

View File

@ -131,13 +131,12 @@ private:
virtual void visit(AstNodeMath* nodep) VL_OVERRIDE {}
virtual void visit(AstVarScope* nodep) VL_OVERRIDE {}
//--------------------
virtual void visit(AstNode* nodep) VL_OVERRIDE {
iterateChildren(nodep);
}
virtual void visit(AstNode* nodep) VL_OVERRIDE { iterateChildren(nodep); }
public:
// CONSTRUCTORS
explicit ActiveTopVisitor(AstNetlist* nodep) {
m_topscopep = NULL;
explicit ActiveTopVisitor(AstNetlist* nodep)
: m_topscopep(NULL) {
iterate(nodep);
}
virtual ~ActiveTopVisitor() {}

View File

@ -1204,7 +1204,7 @@ AstNodeDType* AstNode::findLogicDType(int width, int widthMin, AstNumeric numeri
return v3Global.rootp()->typeTablep()
->findLogicBitDType(fileline(), AstBasicDTypeKwd::LOGIC, width, widthMin, numeric);
}
AstNodeDType* AstNode::findLogicRangeDType(VNumRange range, int widthMin,
AstNodeDType* AstNode::findLogicRangeDType(const VNumRange& range, int widthMin,
AstNumeric numeric) const {
return v3Global.rootp()->typeTablep()
->findLogicBitDType(fileline(), AstBasicDTypeKwd::LOGIC, range, widthMin, numeric);

View File

@ -50,13 +50,13 @@ typedef std::set<int> MTaskIdSet; // Set of mtaskIds for Var sorting
#define BROKEN_RTN(test) \
do { \
if (VL_UNCOVERABLE(test)) return #test; \
} while (0)
} while (false)
// For broken() function, return error string if a base of this class has a match
#define BROKEN_BASE_RTN(test) \
do { \
const char* reasonp = (test); \
if (VL_UNCOVERABLE(reasonp)) return reasonp; \
} while (0)
} while (false)
// (V)erilator (N)ode is: True if AstNode is of a a given AstType
#define VN_IS(nodep,nodetypename) (AstNode::privateIs<Ast ## nodetypename>(nodep))
@ -1559,7 +1559,8 @@ public:
AstNodeDType* findVoidDType() const;
AstNodeDType* findBitDType(int width, int widthMin, AstNumeric numeric) const;
AstNodeDType* findLogicDType(int width, int widthMin, AstNumeric numeric) const;
AstNodeDType* findLogicRangeDType(VNumRange range, int widthMin, AstNumeric numeric) const;
AstNodeDType* findLogicRangeDType(const VNumRange& range, int widthMin,
AstNumeric numeric) const;
AstNodeDType* findBasicDType(AstBasicDTypeKwd kwd) const;
AstBasicDType* findInsertSameDType(AstBasicDType* nodep);

View File

@ -502,7 +502,7 @@ private:
for (V3GraphVertex* itp = m_graph.verticesBeginp(); itp; itp=itp->verticesNextp()) {
if (CdcVarVertex* vvertexp = dynamic_cast<CdcVarVertex*>(itp)) {
AstVar* varp = vvertexp->varScp()->varp();
if (1) { // varp->isPrimaryIO()
{
string what = "wire";
if (varp->isPrimaryIO()) what = varp->direction().prettyName();
@ -752,11 +752,11 @@ public:
iterate(nodep);
analyze();
if (debug()>=1) edgeReport(); // Not useful to users at the moment
if (0) {
*m_ofp<<"\nDBG-test-dumper\n";
if (debug() >= 1) edgeReport(); // Not useful to users at the moment
if (false) {
*m_ofp << "\nDBG-test-dumper\n";
V3EmitV::verilogPrefixedTree(nodep, *m_ofp, "DBG ", 40, NULL, true);
*m_ofp<<endl;
*m_ofp << endl;
}
}
virtual ~CdcVisitor() {

View File

@ -592,15 +592,12 @@ private:
bool rad = ifMergeAdjacent(lp->rhsp(), rp->rhsp());
if (lad && rad) return true;
// {a[] & b[]&c[], a[] & b[]&c[]}
else if (lad && concatMergeable(lp->rhsp(), rp->rhsp())) return true;
if (lad && concatMergeable(lp->rhsp(), rp->rhsp())) return true;
// {a[]&b[] & c[], a[]&b[] & c[]}
else if (rad && concatMergeable(lp->lhsp(), rp->lhsp())) return true;
else {
// {(a[]&b[])&(c[]&d[]), (a[]&b[])&(c[]&d[])}
if (concatMergeable(lp->lhsp(), rp->lhsp())
&& concatMergeable(lp->rhsp(), rp->rhsp()))
return true;
}
if (rad && concatMergeable(lp->lhsp(), rp->lhsp())) return true;
// {(a[]&b[])&(c[]&d[]), (a[]&b[])&(c[]&d[])}
if (concatMergeable(lp->lhsp(), rp->lhsp())
&& concatMergeable(lp->rhsp(), rp->rhsp())) return true;
return false;
}

View File

@ -68,7 +68,7 @@ private:
// Want to choose a base node, and keep finding duplicates that are identical.
// This prevents making chains where a->b, then c->d, then b->c, as we'll
// find a->b, a->c, a->d directly.
while (1) {
while (true) {
V3Hashed::iterator dupit = hashed.findDuplicate(nodep->origp());
if (dupit == hashed.end()) break;
//

View File

@ -70,12 +70,11 @@ class CMakeEmitter {
cmake_set_raw(of, name, raw_value, cache_type, docstring);
}
//Swap all backslashes for forward slashes, because of Windows
// Swap all backslashes for forward slashes, because of Windows
static string deslash(const string& s) {
std::string res = s;
for (string::iterator it = res.begin(); it != res.end(); ++it) {
if (*it == '\\')
*it = '/';
if (*it == '\\') *it = '/';
}
return res;
}

View File

@ -141,7 +141,7 @@ class EmitCSyms : EmitCBaseVisitor {
string scopeDecodeIdentifier(const string& scpname) {
string out = scpname;
// Remove hierarchy
string::size_type pos = out.rfind(".");
string::size_type pos = out.rfind('.');
if (pos != std::string::npos) out.erase(0, pos + 1);
// Decode all escaped characters
while ((pos = out.find("__0")) != string::npos) {
@ -163,10 +163,8 @@ class EmitCSyms : EmitCBaseVisitor {
}
string::size_type pos = scp.rfind("__DOT__");
if (pos == string::npos) {
pos = scp.rfind(".");
if (pos == string::npos) {
break;
}
pos = scp.rfind('.');
if (pos == string::npos) break;
}
scp.resize(pos);
}
@ -228,10 +226,8 @@ class EmitCSyms : EmitCBaseVisitor {
string above = name;
while (!above.empty()) {
string::size_type pos = above.rfind(".");
if (pos == string::npos) {
break;
}
string::size_type pos = above.rfind('.');
if (pos == string::npos) break;
above.resize(pos);
if (m_vpiScopeHierarchy.find(above) != m_vpiScopeHierarchy.end()) {
m_vpiScopeHierarchy[above].push_back(name);
@ -671,8 +667,8 @@ void EmitCSyms::emitSymImp() {
string name = it->second.m_prettyName;
if (it->first == "TOP") continue;
name = name.replace(0, 4, ""); // Remove the "TOP."
if ((name.find(".") == string::npos) && (it->second.m_type == "SCOPE_MODULE")) {
puts("__Vhier.add(0, &"+protect("__Vscope_"+it->second.m_symName)+");\n");
if ((name.find('.') == string::npos) && (it->second.m_type == "SCOPE_MODULE")) {
puts("__Vhier.add(0, &" + protect("__Vscope_" + it->second.m_symName) + ");\n");
}
}

View File

@ -740,7 +740,7 @@ public:
void V3EmitV::emitv() {
UINFO(2,__FUNCTION__<<": "<<endl);
if (1) {
if (true) {
// All-in-one file
V3OutVFile of (v3Global.opt.makeDir()+"/"+v3Global.opt.prefix()+"__Vout.v");
of.putsHeader();

View File

@ -320,31 +320,36 @@ inline void v3errorEndFatal(std::ostringstream& sstr) {
{ if (VL_UNCOVERABLE(debug() >= (level))) { cout << stmsg; } }
#ifdef VL_DEBUG
# define UDEBUGONLY(stmts) {stmts}
# define UDEBUGONLY(stmts) \
{ stmts }
#else
# define UDEBUGONLY(stmts) {if (0) {stmts}}
# define UDEBUGONLY(stmts) \
{ if (false) { stmts } }
#endif
// Assertion without object, generally UOBJASSERT preferred
#define UASSERT(condition,stmsg) \
do { if (VL_UNCOVERABLE(!(condition))) { v3fatalSrc(stmsg); }} while(0)
do { if (VL_UNCOVERABLE(!(condition))) { v3fatalSrc(stmsg); }} while (false)
// Assertion with object
#define UASSERT_OBJ(condition,obj,stmsg) \
do { if (VL_UNCOVERABLE(!(condition))) { (obj)->v3fatalSrc(stmsg); }} while(0)
do { if (VL_UNCOVERABLE(!(condition))) { (obj)->v3fatalSrc(stmsg); }} while (false)
// For use in V3Ast static functions only
#define UASSERT_STATIC(condition,stmsg) \
do { if (VL_UNCOVERABLE(!(condition))) { \
std::cerr<<"Internal Error: "<<__FILE__<<":"<<std::dec<<__LINE__ \
<<":"<<(stmsg)<<std::endl; abort(); } } while(0)
<<":"<<(stmsg)<<std::endl; abort(); } } while (false)
// Check self test values for expected value. Safe from side-effects.
// Type argument can be removed when go to C++11 (use auto).
#define UASSERT_SELFTEST(Type,got,exp) \
do { Type g = (got); Type e = (exp); \
UASSERT(g==e, "Self-test failed '" #got "==" #exp "'"" got=" \
<<g<<" expected="<<e); } while(0)
<<g<<" expected="<<e); } while(false)
#define V3ERROR_NA \
do { v3error("Internal: Unexpected Call"); v3fatalSrc("Unexpected Call"); } while(0)
do { \
v3error("Internal: Unexpected Call"); \
v3fatalSrc("Unexpected Call"); \
} while (false)
/// Declare a convenience debug() routine that may be added to any class in
/// Verilator so that --debugi-<srcfile> will work to control UINFOs in

View File

@ -1024,10 +1024,10 @@ public:
string out;
string::size_type start = 0;
// space, ., ->
while (1) {
while (true) {
// When C++11, use find_if and lambda
string::size_type pos = string::npos;
string separator = "";
string separator;
trySep(old, start, " ", pos/*ref*/, separator/*ref*/);
trySep(old, start, ".", pos/*ref*/, separator/*ref*/);
trySep(old, start, "->", pos/*ref*/, separator/*ref*/);

View File

@ -99,8 +99,8 @@ void VFileContent::pushText(const string& text) {
// Insert line-by-line
string::size_type line_start = 0;
while (1) {
string::size_type line_end = leftover.find("\n", line_start);
while (true) {
string::size_type line_end = leftover.find('\n', line_start);
if (line_end != string::npos) {
string oneline (leftover, line_start, line_end-line_start+1);
m_lines.push_back(oneline); // Keeps newline
@ -338,17 +338,17 @@ void FileLine::modifyStateInherit(const FileLine* fromp) {
}
}
void FileLine::v3errorEnd(std::ostringstream& str, const string& locationStr) {
void FileLine::v3errorEnd(std::ostringstream& sstr, const string& locationStr) {
std::ostringstream nsstr;
if (lastLineno()) nsstr<<this;
nsstr<<str.str();
nsstr<<endl;
nsstr << sstr.str();
nsstr << endl;
std::ostringstream lstr;
if (!locationStr.empty()) {
lstr<<std::setw(ascii().length())<<" "<<": "<<locationStr;
}
if (warnIsOff(V3Error::errorCode())
|| V3Config::waive(this, V3Error::errorCode(), str.str())) {
|| V3Config::waive(this, V3Error::errorCode(), sstr.str())) {
V3Error::suppressThisWarning();
}
else if (!V3Error::errorContexted()) nsstr<<warnContextPrimary();
@ -393,7 +393,7 @@ string FileLine::prettySource() const {
string FileLine::warnContext(bool secondary) const {
V3Error::errorContexted(true);
if (!v3Global.opt.context()) return "";
string out = "";
string out;
if (firstLineno() == lastLineno() && firstColumn()) {
string sourceLine = prettySource();
// Don't show super-long lines as can fill screen and unlikely to help user
@ -451,7 +451,7 @@ void FileLine::deleteAllRemaining() {
// FileLines are allocated, but never nicely freed, as it's much faster
// that way. Unfortunately this makes our leak checking a big mess, so
// only when leak checking we'll track them all and cleanup.
while (1) {
while (true) {
FileLineCheckSet::iterator it = fileLineLeakChecks.begin();
if (it==fileLineLeakChecks.end()) break;
delete *it;

View File

@ -215,17 +215,13 @@ private:
if (m_lhsVarRef) clearSimple(">1 lhs varRefs");
m_lhsVarRef = nodep;
} else {
if (m_rhsVarRefs.size()>1) {
if (m_rhsVarRefs.size() > 1) {
AstNodeVarRef* lastRefp = m_rhsVarRefs.back();
if (0) { // Disable the multiple-input optimization
clearSimple(">1 rhs varRefs");
} else {
if (m_buffersOnly) clearSimple(">1 rhs varRefs");
if (!nodep->varScopep()->varp()->gateMultiInputOptimizable()
// We didn't check multiInput on the first varref, so check it here
|| !lastRefp->varScopep()->varp()->gateMultiInputOptimizable()) {
clearSimple("!gateMultiInputOptimizable");
}
if (m_buffersOnly) clearSimple(">1 rhs varRefs");
if (!nodep->varScopep()->varp()->gateMultiInputOptimizable()
// We didn't check multiInput on the first varref, so check it here
|| !lastRefp->varScopep()->varp()->gateMultiInputOptimizable()) {
clearSimple("!gateMultiInputOptimizable");
}
}
m_rhsVarRefs.push_back(nodep);
@ -565,7 +561,7 @@ void GateVisitor::optimizeSignals(bool allowMultiIn) {
&& !vvertexp->varScp()->varp()->valuep()
&& !vvertexp->varScp()->varp()->isSigPublic()) {
UINFO(4, "No drivers "<<vvertexp->varScp()<<endl);
if (0) {
if (false) {
// If we warned here after constant propagation, what the user considered
// reasonable logic may have disappeared. Issuing a warning would
// thus be confusing. V3Undriven now handles this.

View File

@ -501,7 +501,7 @@ public:
it!=m_scopeAliasMap[samn].end(); ++it) {
VSymEnt* lhsp = it->first;
VSymEnt* srcp = lhsp;
while (1) { // Follow chain of aliases up to highest level non-alias
while (true) { // Follow chain of aliases up to highest level non-alias
ScopeAliasMap::iterator it2 = m_scopeAliasMap[samn].find(srcp);
if (it2 != m_scopeAliasMap[samn].end()) { srcp = it2->second; continue; }
else break;

View File

@ -68,8 +68,8 @@ public:
~V3ListEnt() {
#ifdef VL_DEBUG
// Load bogus pointers so we can catch deletion bugs
m_nextp = (T)1;
m_prevp = (T)1;
m_nextp = reinterpret_cast<T>(1);
m_prevp = reinterpret_cast<T>(1);
#endif
}
T nextp() const { return m_nextp; }

View File

@ -1638,7 +1638,7 @@ V3Number& V3Number::opMul(const V3Number& lhs, const V3Number& rhs) {
vluint64_t mul = static_cast<vluint64_t>(lhs.m_value[lword])
* static_cast<vluint64_t>(rhs.m_value[rword]);
for (int qword=lword+rword; qword<this->words(); qword++) {
mul += (vluint64_t)(m_value[qword]);
mul += static_cast<vluint64_t>(m_value[qword]);
m_value[qword] = (mul & VL_ULL(0xffffffff));
mul = (mul >> VL_ULL(32)) & VL_ULL(0xffffffff);
}

View File

@ -656,10 +656,10 @@ bool V3Options::onoff(const char* sw, const char* arg, bool& flag) {
else if (0==strncmp(sw, "-no-", 4) && (0==strcmp(sw+4, arg+1))) { flag = false; return true; }
return false;
}
bool V3Options::onoffb(const char* sw, const char* arg, VOptionBool& bflag) {
bool V3Options::onoffb(const char* sw, const char* arg, VOptionBool& flagr) {
bool flag;
if (onoff(sw, arg, flag/*ref*/)) {
bflag.setTrueOrFalse(flag);
if (onoff(sw, arg, flag /*ref*/)) {
flagr.setTrueOrFalse(flag);
return true;
} else {
return false;
@ -727,9 +727,8 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, char
// Allow gnu -- switches
if (sw[0]=='-' && sw[1]=='-') ++sw;
bool hadSwitchPart1 = true;
if (0) {}
// Single switches
else if (!strcmp(sw, "-E")) { m_preprocOnly = true; }
if (!strcmp(sw, "-E")) { m_preprocOnly = true; }
else if ( onoffb(sw, "-MMD", bflag/*ref*/)) { m_makeDepend = bflag; }
else if ( onoff (sw, "-MP", flag/*ref*/)) { m_makePhony = flag; }
else if (!strcmp(sw, "-P")) { m_preprocNoLine = true; }

View File

@ -77,6 +77,7 @@ public:
FST,
FST_THREAD
} m_e;
// cppcheck-suppress noExplicitConstructor
inline TraceFormat(en _e = VCD) : m_e(_e) {}
explicit inline TraceFormat(int _e) : m_e(static_cast<en>(_e)) {}
operator en() const { return m_e; }
@ -280,7 +281,7 @@ class V3Options {
void showVersion(bool verbose);
void coverage(bool flag) { m_coverageLine = m_coverageToggle = m_coverageUser = flag; }
bool onoff(const char* sw, const char* arg, bool& flag);
bool onoffb(const char* sw, const char* arg, VOptionBool& flag);
bool onoffb(const char* sw, const char* arg, VOptionBool& flagr);
bool suffixed(const string& sw, const char* arg);
string parseFileArg(const string& optdir, const string& relfilename);
bool parseLangExt(const char* swp, const char* langswp, const V3LangCode& lc);

View File

@ -726,7 +726,7 @@ public:
lit != mtaskp->vertexListp()->end(); ++lit) {
const OrderLogicVertex* logicp = (*lit)->logicp();
if (!logicp) continue;
if (0) {
if (false) {
// Show nodes only
*osp<<"> "; logicp->nodep()->dumpTree(*osp);
} else {
@ -1191,7 +1191,7 @@ public:
doRescore(); // Set initial scores in scoreboard
while (1) {
while (true) {
// This is the best edge to merge, with the lowest
// score (shortest local critical path)
MergeCandidate* mergeCanp = const_cast<MergeCandidate*>(m_sb.bestp());

View File

@ -194,8 +194,13 @@ class V3PreLex {
void curFilelinep(FileLine* fl) { curStreamp()->m_curFilelinep = fl; }
void appendDefValue(const char* textp, size_t len) { m_defValue.append(textp, len); }
void lineDirective(const char* textp);
void linenoInc() { if (curStreamp()->m_ignNewlines) curStreamp()->m_ignNewlines--;
else curFilelinep()->linenoInc(); }
void linenoInc() {
if (curStreamp()->m_ignNewlines) {
curStreamp()->m_ignNewlines--;
} else {
curFilelinep()->linenoInc();
}
}
void warnBackslashSpace();
// Called by V3PreProc.cpp to inform lexer
void pushStateDefArg(int level);

View File

@ -861,7 +861,7 @@ void V3PreProcImp::candidateDefines(VSpellCheck* spellerp) {
int V3PreProcImp::getRawToken() {
// Get a token from the file, whatever it may be.
while (1) {
while (true) {
next_tok:
if (m_lineAdd) {
m_lineAdd--;
@ -942,7 +942,7 @@ void V3PreProcImp::debugToken(int tok, const char* cmtp) {
int V3PreProcImp::getStateToken() {
// Return the next state-determined token
while (1) {
while (true) {
next_tok:
if (isEof()) return VP_EOF;
int tok = getRawToken();

View File

@ -501,6 +501,6 @@ private:
namespace V3ScoreboardBase {
void selfTest();
}
} // namespace V3ScoreboardBase
#endif // Guard

View File

@ -851,7 +851,7 @@ private:
} else if (optimizable()) {
int loops = 0;
iterateAndNextNull(nodep->initsp());
while (1) {
while (true) {
UINFO(5, " FOR-ITER "<<nodep<<endl);
iterateAndNextNull(nodep->condp());
if (!optimizable()) break;
@ -880,7 +880,7 @@ private:
iterateChildren(nodep);
} else if (optimizable()) {
int loops = 0;
while (1) {
while (true) {
UINFO(5, " WHILE-ITER "<<nodep<<endl);
iterateAndNextNull(nodep->precondsp());
if (jumpingOver(nodep)) break;

View File

@ -75,7 +75,7 @@ bool VString::wildmatch(const string& s, const string& p) {
}
bool VString::isWildcard(const string &p) {
return ((p.find("*") != string::npos) || (p.find("?") != string::npos));
return ((p.find('*') != string::npos) || (p.find('?') != string::npos));
}
string VString::dot(const string& a, const string& dot, const string& b) {
@ -144,8 +144,8 @@ static inline uint32_t shaRotr32(uint32_t lhs, uint32_t rhs) {
return lhs >> rhs | lhs << (32 - rhs);
}
static inline void sha256Block(uint32_t* h, uint32_t* chunk) VL_ATTR_ALWINLINE;
static inline void sha256Block(uint32_t* h, uint32_t* chunk) {
static inline void sha256Block(uint32_t* h, const uint32_t* chunk) VL_ATTR_ALWINLINE;
static inline void sha256Block(uint32_t* h, const uint32_t* chunk) {
uint32_t ah[8];
const uint32_t* p = chunk;
@ -416,7 +416,7 @@ VSpellCheck::EditDistance VSpellCheck::cutoffDistance(size_t goal_len, size_t ca
size_t max_length = std::max(goal_len, candidate_len);
size_t min_length = std::min(goal_len, candidate_len);
if (max_length <= 1) return 0;
if (max_length - min_length <= 1) return std::max(max_length / 3, (size_t)1);
if (max_length - min_length <= 1) return std::max(max_length / 3, static_cast<size_t>(1));
return (max_length + 2) / 3;
}

View File

@ -48,7 +48,6 @@ namespace V3TSP {
void tspSort(const StateVec& states, StateVec* resultp);
void selfTest();
}
} // namespace V3TSP
#endif // Guard

View File

@ -240,7 +240,7 @@ private:
if (!simulateTree(initp->rhsp(), NULL, initp, loopValue)) {
return false;
}
while (1) {
while (true) {
V3Number res = V3Number(initp);
if (!simulateTree(condp, &loopValue, NULL, res)) {
return false;
@ -300,7 +300,7 @@ private:
++m_statLoops;
if (stmtsp) {
int times = 0;
while (1) {
while (true) {
UINFO(8," Looping "<<loopValue<<endl);
V3Number res = V3Number(nodep);
if (!simulateTree(condp, &loopValue, NULL, res)) {

View File

@ -2498,7 +2498,7 @@ private:
<< VN_CAST(patp->keyp(), Text)->text());
}
}
} while(0);
} while (false);
// Next
if (memp) memp = VN_CAST(memp->nextp(), MemberDType);
if (patp) patp = VN_CAST(patp->nextp(), PatMember);
@ -3392,7 +3392,7 @@ private:
// AstPattern requires assignments to pass datatype on PRELIM
VL_DO_DANGLING(userIterate(pinp, WidthVP(portp->dtypep(), PRELIM).p()), pinp);
}
} while (0);
} while (false);
// Stage 2
{
V3TaskConnects tconnects = V3Task::taskConnects(nodep, nodep->taskp()->stmtsp());

View File

@ -111,12 +111,9 @@ void VlcOptions::parseOptsList(int argc, char** argv) {
}
shift;
} // - options
else if (1) {
else {
addReadFile(argv[i]);
shift;
} else {
v3fatal("Invalid argument: " << argv[i]);
shift;
}
}
#undef shift
@ -139,7 +136,7 @@ void VlcOptions::showVersion(bool verbose) {
//######################################################################
int main(int argc, char** argv, char** env) {
int main(int argc, char** argv, char** /*env*/) {
// General initialization
std::ios::sync_with_stdio();

View File

@ -113,7 +113,7 @@ void VlcTop::rank() {
// O(n^2) Ouch. Probably the thing to do is randomize the order of data
// then hierarchically solve a small subset of tests, and take resulting
// solution and move up to larger subset of tests. (Aka quick sort.)
while (1) {
while (true) {
if (debug()) { UINFO(9, "Left on iter" << nextrank << ": "); remaining.dump(); }
VlcTest* bestTestp = NULL;
vluint64_t bestRemain = 0;