diff --git a/include/verilated.cpp b/include/verilated.cpp index 3390e421b..67fb673b9 100644 --- a/include/verilated.cpp +++ b/include/verilated.cpp @@ -605,7 +605,7 @@ WDataOutP VL_POWSS_WWW(int obits, int, int rbits, WDataOutP owp, const WDataInP const int words = VL_WORDS_I(obits); VL_ZERO_W(obits, owp); EData lor = 0; // 0=all zeros, ~0=all ones, else mix - for (int i = 1; i < (words - 1); ++i) { lor |= lwp[i]; } + for (int i = 1; i < (words - 1); ++i) lor |= lwp[i]; lor |= ((lwp[words - 1] == VL_MASK_E(rbits)) ? ~VL_EUL(0) : 0); if (lor == 0 && lwp[0] == 0) { // "X" so return 0 return owp; @@ -1439,8 +1439,8 @@ void _vl_string_to_vint(int obits, void* destp, size_t srclen, const char* srcp) char* op = reinterpret_cast(destp); if (srclen > bytes) srclen = bytes; // Don't overflow destination size_t i = 0; - for (i = 0; i < srclen; ++i) { *op++ = srcp[srclen - 1 - i]; } - for (; i < bytes; ++i) { *op++ = 0; } + for (i = 0; i < srclen; ++i) *op++ = srcp[srclen - 1 - i]; + for (; i < bytes; ++i) *op++ = 0; } static IData getLine(std::string& str, IData fpi, size_t maxLen) VL_MT_SAFE { diff --git a/include/verilated_probdist.cpp b/include/verilated_probdist.cpp index de4ca6308..8cf9ea573 100644 --- a/include/verilated_probdist.cpp +++ b/include/verilated_probdist.cpp @@ -116,7 +116,7 @@ IData VL_DIST_ERLANG(IData& seedr, IData uk, IData umean) VL_MT_SAFE { return 0; } double x = 1.0; - for (int32_t i = 1; i <= k; i++) { x = x * _vl_dbase_uniform(seedr, 0, 1); } + for (int32_t i = 1; i <= k; i++) x = x * _vl_dbase_uniform(seedr, 0, 1); const double a = static_cast(mean); const double b = static_cast(k); double r = -a * log(x) / b; diff --git a/include/verilated_trace.h b/include/verilated_trace.h index 8224d73a0..806a4e53a 100644 --- a/include/verilated_trace.h +++ b/include/verilated_trace.h @@ -582,7 +582,7 @@ public: m_offloadBufferWritep[0] = (bits << 4) | VerilatedTraceOffloadCommand::CHG_WDATA; m_offloadBufferWritep[1] = code; m_offloadBufferWritep += 2; - for (int i = 0; i < (bits + 31) / 32; ++i) { *m_offloadBufferWritep++ = newvalp[i]; } + for (int i = 0; i < (bits + 31) / 32; ++i) *m_offloadBufferWritep++ = newvalp[i]; VL_DEBUG_IF(assert(m_offloadBufferWritep <= m_offloadBufferEndp);); } void chgDouble(uint32_t code, double newval) { diff --git a/include/verilated_vpi.cpp b/include/verilated_vpi.cpp index d06d0e014..9e6596ddc 100644 --- a/include/verilated_vpi.cpp +++ b/include/verilated_vpi.cpp @@ -555,7 +555,7 @@ public: m_fullname_string = std::string{m_fullname} + "::"; if (m_fullname_string == "\\$unit ::") m_fullname_string = "$unit::"; - if (strcmp(m_name, "\\$unit ") == 0) { m_name = d_unit; } + if (strcmp(m_name, "\\$unit ") == 0) m_name = d_unit; } static VerilatedVpioPackage* castp(vpiHandle h) { return dynamic_cast(reinterpret_cast(h)); diff --git a/src/V3AstNodes.cpp b/src/V3AstNodes.cpp index a8aca5aee..ae39f974c 100644 --- a/src/V3AstNodes.cpp +++ b/src/V3AstNodes.cpp @@ -2088,7 +2088,7 @@ void AstSliceSel::dump(std::ostream& str) const { if (declRange().ranged()) str << " decl" << declRange(); } void AstSliceSel::dumpJson(std::ostream& str) const { - if (declRange().ranged()) { dumpJsonStr(str, "declRange", cvtToStr(declRange())); } + if (declRange().ranged()) dumpJsonStr(str, "declRange", cvtToStr(declRange())); dumpJsonGen(str); } void AstMTaskBody::dump(std::ostream& str) const { diff --git a/src/V3Class.cpp b/src/V3Class.cpp index 1df60b5b2..fbbfb892b 100644 --- a/src/V3Class.cpp +++ b/src/V3Class.cpp @@ -198,12 +198,12 @@ class ClassVisitor final : public VNVisitor { void visit(AstInitial* nodep) override { // But not AstInitialAutomatic, which remains under the class iterateChildren(nodep); - if (m_packageScopep) { m_toScopeMoves.emplace_back(nodep, m_packageScopep); } + if (m_packageScopep) m_toScopeMoves.emplace_back(nodep, m_packageScopep); } void visit(AstInitialStatic* nodep) override { // But not AstInitialAutomatic, which remains under the class iterateChildren(nodep); - if (m_packageScopep) { m_toScopeMoves.emplace_back(nodep, m_packageScopep); } + if (m_packageScopep) m_toScopeMoves.emplace_back(nodep, m_packageScopep); } void setStructModulep(AstNodeUOrStructDType* const dtypep) { diff --git a/src/V3Config.cpp b/src/V3Config.cpp index 82af60789..add634091 100644 --- a/src/V3Config.cpp +++ b/src/V3Config.cpp @@ -286,7 +286,7 @@ public: } void update(const V3ConfigFile& file) { // Copy in all Attributes - for (const auto& itr : file.m_lineAttrs) { m_lineAttrs[itr.first] |= itr.second; } + for (const auto& itr : file.m_lineAttrs) m_lineAttrs[itr.first] |= itr.second; // Copy in all ignores for (const auto& ignLine : file.m_ignLines) m_ignLines.insert(ignLine); // Update the iterator after the list has changed diff --git a/src/V3EmitCBase.cpp b/src/V3EmitCBase.cpp index 424fa82bd..480906b60 100644 --- a/src/V3EmitCBase.cpp +++ b/src/V3EmitCBase.cpp @@ -26,7 +26,7 @@ EmitCParentModule::EmitCParentModule() { const auto setAll = [](AstNodeModule* modp) -> void { for (AstNode* nodep = modp->stmtsp(); nodep; nodep = nodep->nextp()) { - if (VN_IS(nodep, CFunc) || VN_IS(nodep, Var)) { nodep->user4p(modp); } + if (VN_IS(nodep, CFunc) || VN_IS(nodep, Var)) nodep->user4p(modp); } }; for (AstNode* modp = v3Global.rootp()->modulesp(); modp; modp = modp->nextp()) { @@ -173,7 +173,7 @@ void EmitCBaseVisitorConst::emitVarDecl(const AstVar* nodep, bool asRef) { putns(nodep, "&"); } putns(nodep, nodep->nameProtect()); - if (asRef && refNeedParens) { puts(")"); } + if (asRef && refNeedParens) puts(")"); emitDeclArrayBrackets(nodep); puts(";\n"); } else if (nodep->isIO() && basicp && !basicp->isOpaque()) { @@ -203,7 +203,7 @@ void EmitCBaseVisitorConst::emitVarDecl(const AstVar* nodep, bool asRef) { puts("&"); } puts(nodep->nameProtect()); - if (asRef && refNeedParens) { puts(")"); } + if (asRef && refNeedParens) puts(")"); emitDeclArrayBrackets(nodep); // If it's a packed struct/array then nodep->width is the whole // thing, msb/lsb is just lowest dimension diff --git a/src/V3EmitCImp.cpp b/src/V3EmitCImp.cpp index f24c79a01..9fef152b4 100644 --- a/src/V3EmitCImp.cpp +++ b/src/V3EmitCImp.cpp @@ -858,7 +858,7 @@ class EmitCTrace final : EmitCFunc { void emitTraceValue(AstTraceInc* nodep, int arrayindex) { if (AstVarRef* const varrefp = VN_CAST(nodep->valuep(), VarRef)) { AstVar* const varp = varrefp->varp(); - if (varp->isEvent()) { puts("&"); } + if (varp->isEvent()) puts("&"); puts("("); if (emitTraceIsScBigUint(nodep)) { puts("(uint32_t*)"); diff --git a/src/V3EmitCMake.cpp b/src/V3EmitCMake.cpp index b833ba45f..14ab4fd6e 100644 --- a/src/V3EmitCMake.cpp +++ b/src/V3EmitCMake.cpp @@ -199,7 +199,7 @@ class CMakeEmitter final { *of << "target_link_libraries(${TOP_TARGET_NAME} PRIVATE " << prefix << ")\n"; if (!children.empty()) { *of << "target_link_libraries(" << prefix << " INTERFACE"; - for (const auto& childr : children) { *of << " " << (childr)->hierPrefix(); } + for (const auto& childr : children) *of << " " << (childr)->hierPrefix(); *of << ")\n"; } *of << "verilate(" << prefix << " PREFIX " << prefix << " TOP_MODULE " diff --git a/src/V3EmitCModel.cpp b/src/V3EmitCModel.cpp index 8ed37cbbc..334cad1ea 100644 --- a/src/V3EmitCModel.cpp +++ b/src/V3EmitCModel.cpp @@ -684,14 +684,14 @@ class EmitCModel final : public EmitCFunc { iterateConst(funcp); } - if (m_ofp) { VL_DO_CLEAR(delete m_ofp, m_ofp = nullptr); } + if (m_ofp) VL_DO_CLEAR(delete m_ofp, m_ofp = nullptr); } void main(AstNodeModule* modp) { m_modp = modp; emitHeader(modp); emitImplementation(modp); - if (v3Global.dpi()) { emitDpiExportDispatchers(modp); } + if (v3Global.dpi()) emitDpiExportDispatchers(modp); } // VISITORS diff --git a/src/V3EmitXml.cpp b/src/V3EmitXml.cpp index fc1c98a7b..e0b2edc6f 100644 --- a/src/V3EmitXml.cpp +++ b/src/V3EmitXml.cpp @@ -263,7 +263,7 @@ class EmitXmlFileVisitor final : public VNVisitorConst { puts(" left=\"" + cvtToStr(nodep->left()) + "\""); puts(" right=\"" + cvtToStr(nodep->right()) + "\""); } - if (nodep->isSigned()) { puts(" signed=\"true\""); } + if (nodep->isSigned()) puts(" signed=\"true\""); puts("/>\n"); } void visit(AstIfaceRefDType* nodep) override { diff --git a/src/V3Error.cpp b/src/V3Error.cpp index ed1cdc6c7..6b6b09f73 100644 --- a/src/V3Error.cpp +++ b/src/V3Error.cpp @@ -193,7 +193,7 @@ void V3ErrorGuarded::v3errorEnd(std::ostringstream& sstr, const string& extra) << endl; } } - if (!msg_additional.empty()) { std::cerr << msg_additional; } + if (!msg_additional.empty()) std::cerr << msg_additional; // If first warning is not the user's fault (internal/unsupported) then give the website // Not later warnings, as a internal may be caused by an earlier problem if (tellManual() == 0) { diff --git a/src/V3Error.h b/src/V3Error.h index 5eba645b0..d3546aeba 100644 --- a/src/V3Error.h +++ b/src/V3Error.h @@ -272,7 +272,7 @@ public: bool isRenamed() const { return renamedTo() != V3ErrorCode{EC_MIN}; } bool isUnder(V3ErrorCode other) { // backwards compatibility inheritance-like warnings - if (m_e == other) { return true; } + if (m_e == other) return true; if (other == V3ErrorCode::WIDTH) { return (m_e == WIDTHEXPAND || m_e == WIDTHTRUNC || m_e == WIDTHXZEXPAND); } diff --git a/src/V3Expand.cpp b/src/V3Expand.cpp index 21447053f..1ea5bf865 100644 --- a/src/V3Expand.cpp +++ b/src/V3Expand.cpp @@ -588,7 +588,7 @@ class ExpandVisitor final : public VNVisitor { VL_DO_DANGLING(destp->deleteTree(), destp); } else { UINFO(8, " ASSIGNSEL(const,narrow) " << nodep << endl); - if (destp->isQuad() && !rhsp->isQuad()) { rhsp = new AstCCast{nfl, rhsp, nodep}; } + if (destp->isQuad() && !rhsp->isQuad()) rhsp = new AstCCast{nfl, rhsp, nodep}; AstNodeExpr* oldvalp = destp->cloneTreePure(true); fixCloneLvalue(oldvalp); if (!ones) oldvalp = new AstAnd{lfl, new AstConst{lfl, maskold}, oldvalp}; @@ -656,7 +656,7 @@ class ExpandVisitor final : public VNVisitor { V3Number maskwidth{nodep, destp->widthMin()}; for (int bit = 0; bit < lhsp->widthConst(); bit++) maskwidth.setBit(bit, 1); - if (destp->isQuad() && !rhsp->isQuad()) { rhsp = new AstCCast{nfl, rhsp, nodep}; } + if (destp->isQuad() && !rhsp->isQuad()) rhsp = new AstCCast{nfl, rhsp, nodep}; if (!ones) { oldvalp = new AstAnd{ lfl, @@ -741,7 +741,7 @@ class ExpandVisitor final : public VNVisitor { UASSERT_OBJ(constp, nodep, "Replication value isn't a constant. Checked earlier!"); const uint32_t times = constp->toUInt(); - if (nodep->isQuad() && !lhsp->isQuad()) { lhsp = new AstCCast{fl, lhsp, nodep}; } + if (nodep->isQuad() && !lhsp->isQuad()) lhsp = new AstCCast{fl, lhsp, nodep}; newp = lhsp->cloneTreePure(true); for (unsigned repnum = 1; repnum < times; repnum++) { const int rhsshift = repnum * lhswidth; diff --git a/src/V3FileLine.cpp b/src/V3FileLine.cpp index 6c588ea01..1dbde717e 100644 --- a/src/V3FileLine.cpp +++ b/src/V3FileLine.cpp @@ -406,7 +406,7 @@ bool FileLine::warnIsOff(V3ErrorCode code) const { if ((code.lintError() || code.styleError()) && !msgEn().test(V3ErrorCode::I_LINT)) { return true; } - if ((code.unusedError()) && !msgEn().test(V3ErrorCode::I_UNUSED)) { return true; } + if ((code.unusedError()) && !msgEn().test(V3ErrorCode::I_UNUSED)) return true; return false; } diff --git a/src/V3LinkLevel.cpp b/src/V3LinkLevel.cpp index 79df01beb..76254c77c 100644 --- a/src/V3LinkLevel.cpp +++ b/src/V3LinkLevel.cpp @@ -277,7 +277,7 @@ void V3LinkLevel::wrapTopCell(AstNetlist* rootp) { varp->trace(false); } - if (v3Global.opt.noTraceTop() && varp->isIO()) { varp->trace(false); } + if (v3Global.opt.noTraceTop() && varp->isIO()) varp->trace(false); AstPin* const pinp = new AstPin{ oldvarp->fileline(), 0, varp->name(), diff --git a/src/V3Mutex.h b/src/V3Mutex.h index cbf78b10a..03550b48e 100644 --- a/src/V3Mutex.h +++ b/src/V3Mutex.h @@ -101,7 +101,7 @@ public: } /// Release/unlock mutex void unlock() VL_RELEASE() VL_MT_SAFE { - if (V3MutexConfig::s().enable()) { m_mutex.unlock(); } + if (V3MutexConfig::s().enable()) m_mutex.unlock(); } /// Try to acquire mutex. Returns true on success, and false on failure. bool try_lock() VL_TRY_ACQUIRE(true) VL_MT_SAFE { diff --git a/src/V3Number.cpp b/src/V3Number.cpp index df344bca7..31bb94c25 100644 --- a/src/V3Number.cpp +++ b/src/V3Number.cpp @@ -105,7 +105,7 @@ V3Number::V3Number(VerilogStringLiteral, AstNode* nodep, const string& str) { const int topos = str.length() - 1 - pos; ValueAndX& v = m_data.num()[topos / 4]; for (int bit = 0; bit < 8; ++bit) { - if (str[pos] & (1UL << bit)) { v.m_value |= (1UL << (bit + (topos % 4) * 8)); } + if (str[pos] & (1UL << bit)) v.m_value |= (1UL << (bit + (topos % 4) * 8)); } } } @@ -991,7 +991,7 @@ V3Hash V3Number::toHash() const { if (isString()) { hash += V3Hash{m_data.str()}; } else { - for (int i = 0; i < words(); ++i) { hash += m_data.num()[i].m_value; } + for (int i = 0; i < words(); ++i) hash += m_data.num()[i].m_value; } return hash; } @@ -2053,7 +2053,7 @@ V3Number& V3Number::opModDivGuts(const V3Number& lhs, const V3Number& rhs, bool uint32_t vn[VL_MULS_MAX_WORDS + 1]; // v normalized // Zero for ease of debugging and to save having to zero for shifts - for (int i = 0; i < words; i++) { m_data.num()[i].m_value = 0; } + for (int i = 0; i < words; i++) m_data.num()[i].m_value = 0; for (int i = 0; i < words + 1; i++) { un[i] = vn[i] = 0; } // +1 as vn may get extra word // Algorithm requires divisor MSB to be set @@ -2270,7 +2270,7 @@ V3Number& V3Number::opExtendXZ(const V3Number& lhs, uint32_t lbits) { NUM_ASSERT_OP_ARGS1(lhs); NUM_ASSERT_LOGIC_ARGS1(lhs); setZero(); - for (int bit = 0; bit < width(); bit++) { setBit(bit, lhs.bitIsExtend(bit, lbits)); } + for (int bit = 0; bit < width(); bit++) setBit(bit, lhs.bitIsExtend(bit, lbits)); return *this; } @@ -2499,7 +2499,7 @@ V3Number& V3Number::opReplN(const V3Number& lhs, uint32_t rhsval) { NUM_ASSERT_STRING_ARGS1(lhs); string out; out.reserve(lhs.toString().length() * rhsval); - for (unsigned times = 0; times < rhsval; times++) { out += lhs.toString(); } + for (unsigned times = 0; times < rhsval; times++) out += lhs.toString(); return setString(out); } V3Number& V3Number::opToLowerN(const V3Number& lhs) { diff --git a/src/V3Number.h b/src/V3Number.h index 9b63989e5..0b970b940 100644 --- a/src/V3Number.h +++ b/src/V3Number.h @@ -456,7 +456,7 @@ public: private: uint32_t bitsValue(int lsb, int nbits) const VL_MT_SAFE { uint32_t v = 0; - for (int bitn = 0; bitn < nbits; bitn++) { v |= (bitIs1(lsb + bitn) << bitn); } + for (int bitn = 0; bitn < nbits; bitn++) v |= (bitIs1(lsb + bitn) << bitn); return v; } diff --git a/src/V3OptionParser.cpp b/src/V3OptionParser.cpp index e0d7fbd04..c71a4590e 100644 --- a/src/V3OptionParser.cpp +++ b/src/V3OptionParser.cpp @@ -162,7 +162,7 @@ V3OptionParser::ActionIfs* V3OptionParser::find(const char* optp) { if (act.second->isOnOffAllowed()) { // Find starts with "-no" if (const char* const nop = VString::startsWith(optp, "-no") ? (optp + std::strlen("-no")) : nullptr) { - if (act.first == nop || act.first == ("-"s + nop)) { return act.second.get(); } + if (act.first == nop || act.first == ("-"s + nop)) return act.second.get(); } } else if (act.second->isPartialMatchAllowed()) { if (VString::startsWith(optp, act.first)) return act.second.get(); diff --git a/src/V3Param.cpp b/src/V3Param.cpp index 3b9bb8a83..3ee35eacd 100644 --- a/src/V3Param.cpp +++ b/src/V3Param.cpp @@ -342,7 +342,7 @@ class ParamProcessor final { key += " "; key += paramValueString(dtypep->subDTypep()); } else if (const AstBasicDType* const dtypep = VN_CAST(nodep, BasicDType)) { - if (dtypep->isSigned()) { key += " signed"; } + if (dtypep->isSigned()) key += " signed"; if (dtypep->isRanged()) { key += "[" + cvtToStr(dtypep->left()) + ":" + cvtToStr(dtypep->right()) + "]"; } diff --git a/src/V3ParseGrammar.cpp b/src/V3ParseGrammar.cpp index a34df285a..cca937820 100644 --- a/src/V3ParseGrammar.cpp +++ b/src/V3ParseGrammar.cpp @@ -248,7 +248,7 @@ AstVar* V3ParseGrammar::createVariable(FileLine* fileline, const string& name, } else { nodep->trace(allTracingOn(nodep->fileline())); } - if (nodep->varType().isVPIAccessible()) { nodep->addAttrsp(GRAMMARP->cloneScopedSigAttr()); } + if (nodep->varType().isVPIAccessible()) nodep->addAttrsp(GRAMMARP->cloneScopedSigAttr()); // Remember the last variable created, so we can attach attributes to it in later parsing GRAMMARP->m_varAttrp = nodep; diff --git a/src/V3SplitVar.cpp b/src/V3SplitVar.cpp index fb42a9fe8..23847a076 100644 --- a/src/V3SplitVar.cpp +++ b/src/V3SplitVar.cpp @@ -866,7 +866,7 @@ class PackedVarRef final { static void dedupRefs(std::vector& refs) { // Use raw pointer to dedup std::map nodes; - for (size_t i = 0; i < refs.size(); ++i) { nodes.emplace(refs[i].nodep(), i); } + for (size_t i = 0; i < refs.size(); ++i) nodes.emplace(refs[i].nodep(), i); std::vector vect; vect.reserve(nodes.size()); for (const auto& pair : nodes) vect.push_back(refs[pair.second]); diff --git a/src/V3String.cpp b/src/V3String.cpp index 6df59770c..3ce3d3e57 100644 --- a/src/V3String.cpp +++ b/src/V3String.cpp @@ -544,7 +544,7 @@ string VName::dehash(const string& in) { if (next_dot_pos != string::npos) { // Is there a __DOT__ to add to the dehashed version of 'in'? - if (!dehashed.empty()) { dehashed += "__DOT__"; } + if (!dehashed.empty()) dehashed += "__DOT__"; last_dot_pos = next_dot_pos + DOT_LEN; } else { last_dot_pos = string::npos; diff --git a/src/V3TSP.cpp b/src/V3TSP.cpp index 63312a401..db7f72c02 100644 --- a/src/V3TSP.cpp +++ b/src/V3TSP.cpp @@ -125,7 +125,7 @@ public: const std::list keysToVertexList(const std::vector& odds) { std::list vertices; - for (unsigned i = 0; i < odds.size(); ++i) { vertices.push_back(findVertex(odds.at(i))); } + for (unsigned i = 0; i < odds.size(); ++i) vertices.push_back(findVertex(odds.at(i))); return vertices; } diff --git a/src/V3Table.cpp b/src/V3Table.cpp index c958c87e8..4bda96e1c 100644 --- a/src/V3Table.cpp +++ b/src/V3Table.cpp @@ -110,7 +110,7 @@ public: } AstVarScope* varScopep() { - if (!m_varScopep) { m_varScopep = v3Global.rootp()->constPoolp()->findTable(m_initp); } + if (!m_varScopep) m_varScopep = v3Global.rootp()->constPoolp()->findTable(m_initp); return m_varScopep; } }; @@ -261,7 +261,7 @@ private: VL_MASK_I(m_inWidthBits)); // Set sizes of output tables - for (TableOutputVar& tov : m_outVarps) { tov.setTableSize(VL_MASK_I(m_inWidthBits)); } + for (TableOutputVar& tov : m_outVarps) tov.setTableSize(VL_MASK_I(m_inWidthBits)); // Populate the tables createTables(nodep, outputAssignedTableBuilder); diff --git a/src/V3ThreadPool.cpp b/src/V3ThreadPool.cpp index 9753b59e5..eeaf69aa5 100644 --- a/src/V3ThreadPool.cpp +++ b/src/V3ThreadPool.cpp @@ -27,7 +27,7 @@ void V3ThreadPool::resize(unsigned n) VL_MT_UNSAFE VL_EXCLUDES(m_mutex) VL_EXCLUDES(m_stoppedJobsMutex) VL_EXCLUDES(V3MtDisabledLock::instance()) { // At least one thread (main) n = std::max(1u, n); - if (n == (m_workers.size() + 1)) { return; } + if (n == (m_workers.size() + 1)) return; // This function is not thread-safe and can result in race between threads UASSERT(V3MutexConfig::s().lockConfig(), "Mutex config needs to be locked before starting ThreadPool"); @@ -60,7 +60,7 @@ void V3ThreadPool::resize(unsigned n) VL_MT_UNSAFE VL_EXCLUDES(m_mutex) void V3ThreadPool::suspendMultithreading() VL_MT_SAFE VL_EXCLUDES(m_mutex) VL_EXCLUDES(m_stoppedJobsMutex) { V3LockGuard stoppedJobsLock{m_stoppedJobsMutex}; - if (!m_workers.empty()) { stopOtherThreads(); } + if (!m_workers.empty()) stopOtherThreads(); if (!m_mutex.try_lock()) { v3fatal("Tried to suspend thread pool when other thread uses it."); @@ -75,7 +75,7 @@ void V3ThreadPool::suspendMultithreading() VL_MT_SAFE VL_EXCLUDES(m_mutex) void V3ThreadPool::resumeMultithreading() VL_MT_SAFE VL_EXCLUDES(m_mutex) VL_EXCLUDES(m_stoppedJobsMutex) { - if (!m_mutex.try_lock()) { v3fatal("Tried to resume thread pool when other thread uses it."); } + if (!m_mutex.try_lock()) v3fatal("Tried to resume thread pool when other thread uses it."); { V3LockGuard lock{m_mutex, std::adopt_lock_t{}}; UASSERT(m_multithreadingSuspended, "Multithreading is not suspended"); @@ -103,7 +103,7 @@ void V3ThreadPool::workerJobLoop(int id) VL_MT_SAFE { return !m_queue.empty() || m_shutdown || m_stopRequested; }); if (m_shutdown) return; // Terminate if requested - if (stopRequested()) { continue; } + if (stopRequested()) continue; // Get the job UASSERT(!m_queue.empty(), "Job should be available"); diff --git a/src/V3ThreadPool.h b/src/V3ThreadPool.h index 09b2ba17c..9c880afe0 100644 --- a/src/V3ThreadPool.h +++ b/src/V3ThreadPool.h @@ -307,7 +307,7 @@ public: if (!V3ThreadPool::s().willExecuteSynchronously()) { V3ThreadPool::s().m_stoppedJobsMutex.lock(); - if (V3ThreadPool::s().stopRequested()) { V3ThreadPool::s().waitForResumeRequest(); } + if (V3ThreadPool::s().stopRequested()) V3ThreadPool::s().waitForResumeRequest(); V3ThreadPool::s().stopOtherThreads(); V3ThreadPool::s().m_exclusiveAccess = true; } else { diff --git a/src/V3TraceDecl.cpp b/src/V3TraceDecl.cpp index 1ccba54aa..4bde0eeaa 100644 --- a/src/V3TraceDecl.cpp +++ b/src/V3TraceDecl.cpp @@ -342,7 +342,7 @@ class TraceDeclVisitor final : public VNVisitor { // Gather cells under this scope for (AstNode* stmtp = nodep->modp()->stmtsp(); stmtp; stmtp = stmtp->nextp()) { - if (AstCell* const cellp = VN_CAST(stmtp, Cell)) { m_entries.emplace_back(cellp); } + if (AstCell* const cellp = VN_CAST(stmtp, Cell)) m_entries.emplace_back(cellp); } if (!m_entries.empty()) { diff --git a/src/V3VariableOrder.cpp b/src/V3VariableOrder.cpp index 822ea86cb..6b6baa81d 100644 --- a/src/V3VariableOrder.cpp +++ b/src/V3VariableOrder.cpp @@ -120,7 +120,7 @@ public: // Compute the number of MTasks not shared (Hamming distance) int cost = 0; const size_t size = ExecMTask::numUsedIds(); - for (size_t i = 0; i < size; ++i) { cost += m_mTaskIds.at(i) ^ otherp->m_mTaskIds.at(i); } + for (size_t i = 0; i < size; ++i) cost += m_mTaskIds.at(i) ^ otherp->m_mTaskIds.at(i); return cost; } }; diff --git a/src/V3Width.cpp b/src/V3Width.cpp index bb36b0063..ee949abeb 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -1355,7 +1355,7 @@ class WidthVisitor final : public VNVisitor { } } void visit(AstCLog2* nodep) override { - if (m_vup->prelim()) { iterateCheckSizedSelf(nodep, "LHS", nodep->lhsp(), SELF, BOTH); } + if (m_vup->prelim()) iterateCheckSizedSelf(nodep, "LHS", nodep->lhsp(), SELF, BOTH); } void visit(AstPow* nodep) override { // Pow is special, output sign only depends on LHS sign, but diff --git a/src/VlcMain.cpp b/src/VlcMain.cpp index 00baa18c2..89b592a2d 100644 --- a/src/VlcMain.cpp +++ b/src/VlcMain.cpp @@ -153,7 +153,7 @@ int main(int argc, char** argv) { V3Error::abortIfWarnings(); if (top.opt.unlink()) { const VlStringSet& readFiles = top.opt.readFiles(); - for (const auto& filename : readFiles) { unlink(filename.c_str()); } + for (const auto& filename : readFiles) unlink(filename.c_str()); } } diff --git a/src/VlcTest.h b/src/VlcTest.h index 4d3024c7a..063cf46d7 100644 --- a/src/VlcTest.h +++ b/src/VlcTest.h @@ -104,7 +104,7 @@ public: // CONSTRUCTORS VlcTests() = default; ~VlcTests() { - for (auto it = begin(); it != end(); ++it) { VL_DO_CLEAR(delete *it, *it = nullptr); } + for (auto it = begin(); it != end(); ++it) VL_DO_CLEAR(delete *it, *it = nullptr); } // METHODS diff --git a/src/verilog.y b/src/verilog.y index 4053a2266..57ebbc212 100644 --- a/src/verilog.y +++ b/src/verilog.y @@ -218,7 +218,7 @@ public: m_pinNum = 1; } void pinPop(FileLine* fl) { - if (VL_UNCOVERABLE(m_pinStack.empty())) { fl->v3fatalSrc("Underflow of pin stack"); } + if (VL_UNCOVERABLE(m_pinStack.empty())) fl->v3fatalSrc("Underflow of pin stack"); m_pinNum = m_pinStack.top(); m_pinStack.pop(); } @@ -7488,7 +7488,7 @@ vltOffFront: | yVLT_LINT_OFF { $$ = V3ErrorCode::I_LINT; } | yVLT_LINT_OFF yVLT_D_RULE idAny { const char *codemsg = (*$3).c_str(); - if (V3ErrorCode::unusedMsg(codemsg)) {$$ = V3ErrorCode::I_UNUSED; } + if (V3ErrorCode::unusedMsg(codemsg)) $$ = V3ErrorCode::I_UNUSED; else {$$ = V3ErrorCode{codemsg}; } if ($$ == V3ErrorCode::EC_ERROR) { $1->v3error("Unknown error code: '" << *$3 << "'"); } } ; @@ -7500,7 +7500,7 @@ vltOnFront: | yVLT_LINT_ON { $$ = V3ErrorCode::I_LINT; } | yVLT_LINT_ON yVLT_D_RULE idAny { const char *codemsg = (*$3).c_str(); - if (V3ErrorCode::unusedMsg(codemsg)) {$$ = V3ErrorCode::I_UNUSED; } + if (V3ErrorCode::unusedMsg(codemsg)) $$ = V3ErrorCode::I_UNUSED; else {$$ = V3ErrorCode{codemsg}; } if ($$ == V3ErrorCode::EC_ERROR) { $1->v3error("Unknown error code: '" << *$3 << "'"); } } ;