diff --git a/include/verilated_fst_c.h b/include/verilated_fst_c.h index 3b1e1e802..efce5ef9c 100644 --- a/include/verilated_fst_c.h +++ b/include/verilated_fst_c.h @@ -180,7 +180,7 @@ public: } // Internal class access - inline VerilatedFst* spTrace() { return &m_sptrace; }; + inline VerilatedFst* spTrace() { return &m_sptrace; } }; #endif // guard diff --git a/include/verilated_types.h b/include/verilated_types.h index 2cd6020c9..1a340400c 100644 --- a/include/verilated_types.h +++ b/include/verilated_types.h @@ -849,8 +849,8 @@ template struct VlUnpacked final { WData* data() { return &m_storage[0]; } const WData* data() const { return &m_storage[0]; } - T_Value& operator[](size_t index) { return m_storage[index]; }; - const T_Value& operator[](size_t index) const { return m_storage[index]; }; + T_Value& operator[](size_t index) { return m_storage[index]; } + const T_Value& operator[](size_t index) const { return m_storage[index]; } // Dumping. Verilog: str = $sformatf("%p", assoc) std::string to_string() const { diff --git a/include/verilated_vpi.cpp b/include/verilated_vpi.cpp index 01cf09a95..82fb58233 100644 --- a/include/verilated_vpi.cpp +++ b/include/verilated_vpi.cpp @@ -1697,7 +1697,7 @@ void vl_get_value(const VerilatedVar* varp, void* varDatap, p_vpi_value valuep, // Maximum required size is for binary string, one byte per bit plus null termination static VL_THREAD_LOCAL char t_outStr[VL_VALUE_STRING_MAX_WORDS * VL_EDATASIZE + 1]; // cppcheck-suppress variableScope - const static VL_THREAD_LOCAL int t_outStrSz = sizeof(t_outStr) - 1; + static const VL_THREAD_LOCAL int t_outStrSz = sizeof(t_outStr) - 1; // We used to presume vpiValue.format = vpiIntVal or if single bit vpiScalarVal // This may cause backward compatibility issues with older code. if (valuep->format == vpiVectorVal) { diff --git a/src/V3Active.cpp b/src/V3Active.cpp index 95d130f6b..32dcef12e 100644 --- a/src/V3Active.cpp +++ b/src/V3Active.cpp @@ -163,9 +163,9 @@ public: LatchDetectGraphVertex* outVertexp; if (!nodep->varp()->user1p()) { // Not seen this output before outVertexp = addOutputVertex(nodep); - } else + } else { outVertexp = castVertexp(nodep->varp()->user1p()); - + } new V3GraphEdge(this, m_curVertexp, outVertexp, 1); } // Run latchCheckInternal on each variable assigned by the always block to see if all control diff --git a/src/V3Ast.h b/src/V3Ast.h index b0df2cd20..406b13cd2 100644 --- a/src/V3Ast.h +++ b/src/V3Ast.h @@ -27,8 +27,12 @@ #include "V3Broken.h" #include +#include +#include #include #include +#include +#include #include "V3Ast__gen_classes.h" // From ./astgen // Things like: diff --git a/src/V3Broken.cpp b/src/V3Broken.cpp index f553f34a4..918df5292 100644 --- a/src/V3Broken.cpp +++ b/src/V3Broken.cpp @@ -225,7 +225,7 @@ private: while (nodep) { processAndIterate(nodep); nodep = nodep->nextp(); - }; + } } void pushLocalScope() { if (m_cfuncp) m_localsStack.emplace_back(); diff --git a/src/V3CCtors.cpp b/src/V3CCtors.cpp index 72d5fe893..2ebb9f73c 100644 --- a/src/V3CCtors.cpp +++ b/src/V3CCtors.cpp @@ -118,7 +118,7 @@ public: rootFuncp->addStmtsp(callp); } } - }; + } private: VL_UNCOPYABLE(V3CCtorsBuilder); diff --git a/src/V3Const.cpp b/src/V3Const.cpp index f1a65ce5c..45d9bcfcb 100644 --- a/src/V3Const.cpp +++ b/src/V3Const.cpp @@ -951,8 +951,9 @@ private: } else if (VN_IS(nodep->rhsp(), And)) { andp = VN_AS(nodep->rhsp(), And); ap = nodep->lhsp(); - } else + } else { return false; + } const AstNodeUniop* notp; AstNode* cp; if (VN_IS(andp->lhsp(), Not)) { @@ -3204,11 +3205,11 @@ private: // Non-zero on one side or the other TREEOP ("AstAnd {$lhsp.isAllOnes, $rhsp}", "replaceWRhs(nodep)"); TREEOP ("AstLogAnd{$lhsp.isNeqZero, $rhsp}", "replaceWRhs(nodep)"); - TREEOP ("AstOr {$lhsp.isAllOnes, $rhsp, isTPure($rhsp)}", "replaceWLhs(nodep)"); //->allOnes + TREEOP ("AstOr {$lhsp.isAllOnes, $rhsp, isTPure($rhsp)}", "replaceWLhs(nodep)"); // ->allOnes TREEOP ("AstLogOr {$lhsp.isNeqZero, $rhsp}", "replaceNum(nodep,1)"); TREEOP ("AstAnd {$lhsp, $rhsp.isAllOnes}", "replaceWLhs(nodep)"); TREEOP ("AstLogAnd{$lhsp, $rhsp.isNeqZero}", "replaceWLhs(nodep)"); - TREEOP ("AstOr {$lhsp, $rhsp.isAllOnes, isTPure($lhsp)}", "replaceWRhs(nodep)"); //->allOnes + TREEOP ("AstOr {$lhsp, $rhsp.isAllOnes, isTPure($lhsp)}", "replaceWRhs(nodep)"); // ->allOnes TREEOP ("AstLogOr {$lhsp, $rhsp.isNeqZero, isTPure($lhsp), nodep->isPure()}", "replaceNum(nodep,1)"); TREEOP ("AstXor {$lhsp.isAllOnes, $rhsp}", "AstNot{$rhsp}"); TREEOP ("AstMul {$lhsp.isOne, $rhsp}", "replaceWRhs(nodep)"); diff --git a/src/V3EmitCFunc.cpp b/src/V3EmitCFunc.cpp index da6e090c9..5c3808332 100644 --- a/src/V3EmitCFunc.cpp +++ b/src/V3EmitCFunc.cpp @@ -79,8 +79,9 @@ void EmitCFunc::emitOpName(AstNode* nodep, const string& format, AstNode* lhsp, if (needComma) { if (pos[1] == ' ') { nextComma = ", "; - } else + } else { nextComma = ","; + } needComma = false; } if (pos[1] == ' ') ++pos; // Must do even if no nextComma diff --git a/src/V3File.cpp b/src/V3File.cpp index 360af0302..a910a2490 100644 --- a/src/V3File.cpp +++ b/src/V3File.cpp @@ -55,7 +55,7 @@ // clang-format on // If change this code, run a test with the below size set very small -//#define INFILTER_IPC_BUFSIZ 16 +// #define INFILTER_IPC_BUFSIZ 16 constexpr int INFILTER_IPC_BUFSIZ = (64 * 1024); // For debug, try this as a small number constexpr int INFILTER_CACHE_MAX = (64 * 1024); // Maximum bytes to cache if same file read twice diff --git a/src/V3FileLine.cpp b/src/V3FileLine.cpp index 05fd04e49..29d99d7c4 100644 --- a/src/V3FileLine.cpp +++ b/src/V3FileLine.cpp @@ -37,7 +37,8 @@ // FileLineSingleton class functions string FileLineSingleton::filenameLetters(int fileno) { - const int size = 1 + (64 / 4); // Each letter retires more than 4 bits of a > 64 bit number + constexpr int size + = 1 + (64 / 4); // Each letter retires more than 4 bits of a > 64 bit number char out[size]; char* op = out + size - 1; *--op = '\0'; // We build backwards diff --git a/src/V3Graph.cpp b/src/V3Graph.cpp index 5005582ba..d47b786a6 100644 --- a/src/V3Graph.cpp +++ b/src/V3Graph.cpp @@ -371,7 +371,7 @@ void V3Graph::dumpDotFile(const string& filename, bool colorAsSubgraph) const { *logp << "\tn" << edgep->fromp()->dotName() << fromVnum << " -> n" << edgep->top()->dotName() << toVnum << " [" - //<<"fontsize=8 label=\""<<(edgep->name()!="" ? edgep->name() : "\\E")<<"\"" + // <<"fontsize=8 label=\""<<(edgep->name()!="" ? edgep->name() : "\\E")<<"\"" << "fontsize=8 label=\"" << (edgep->dotLabel() != "" ? edgep->dotLabel() : "") << "\"" << " weight=" << edgep->weight() << " color=" << edgep->dotColor(); diff --git a/src/V3GraphStream.h b/src/V3GraphStream.h index 1c92b3fce..f05e9a37e 100644 --- a/src/V3GraphStream.h +++ b/src/V3GraphStream.h @@ -23,6 +23,8 @@ #include "V3Graph.h" +#include +#include #include #include diff --git a/src/V3HierBlock.h b/src/V3HierBlock.h index 363c616db..7a01dd1a2 100644 --- a/src/V3HierBlock.h +++ b/src/V3HierBlock.h @@ -29,6 +29,7 @@ #include #include #include +#include #include #include diff --git a/src/V3LinkDot.cpp b/src/V3LinkDot.cpp index 7bec4d6b3..91b3d5864 100644 --- a/src/V3LinkDot.cpp +++ b/src/V3LinkDot.cpp @@ -512,8 +512,9 @@ public: if (it2 != m_scopeAliasMap[samn].end()) { srcp = it2->second; continue; - } else + } else { break; + } } UINFO(9, " iiasa: Insert alias se" << lhsp << " (" << lhsp->nodep()->typeName() << ") <- se" << srcp << " " << srcp->nodep() @@ -623,8 +624,9 @@ public: } break; } - } else + } else { break; + } } if (!lookupSymp) return nullptr; // Not found } diff --git a/src/V3LinkLevel.h b/src/V3LinkLevel.h index afb8c07ef..49e56254b 100644 --- a/src/V3LinkLevel.h +++ b/src/V3LinkLevel.h @@ -23,6 +23,8 @@ #include "V3Error.h" #include "V3Ast.h" +#include + //============================================================================ class V3LinkLevel final { diff --git a/src/V3Number.h b/src/V3Number.h index 438dbe576..67cdab14e 100644 --- a/src/V3Number.h +++ b/src/V3Number.h @@ -23,6 +23,7 @@ #include "V3Error.h" #include "V3Hash.h" +#include #include #include #include diff --git a/src/V3Number_test.cpp b/src/V3Number_test.cpp index 1cffd5eae..f7dc63484 100644 --- a/src/V3Number_test.cpp +++ b/src/V3Number_test.cpp @@ -99,8 +99,9 @@ void test(const string& lhss, const string& op, const string& rhss, const string gotnum.opLogAnd(lhnum, rhnum); } else if (op == "||") { gotnum.opLogOr(lhnum, rhnum); - } else + } else { v3fatalSrc("Bad opcode: " << op); + } UINFO(0, "------- Test:\n" << " " << lhnum << " " << op << endl diff --git a/src/V3Os.cpp b/src/V3Os.cpp index 4a64819ba..33d8e2a5b 100644 --- a/src/V3Os.cpp +++ b/src/V3Os.cpp @@ -52,16 +52,16 @@ // These macros taken from gdbsupport/gdb_wait.h in binutils-gdb # ifndef WIFEXITED # ifdef __MINGW32__ -# define WIFEXITED(w) (((w) & 0xC0000000) == 0) -# define WEXITSTATUS(w) ((w) & ~0xC0000000) +# define WIFEXITED(w) (((w) & 0xC0000000) == 0) +# define WEXITSTATUS(w) ((w) & ~0xC0000000) # else -# define WIFEXITED(w) (((w) & 0377) == 0) -# define WEXITSTATUS(w) (((w) >> 8) & 0377) +# define WIFEXITED(w) (((w) & 0377) == 0) +# define WEXITSTATUS(w) (((w) >> 8) & 0377) # endif # endif #else # include -# include // Needed on FreeBSD for WIFEXITED +# include // Needed on FreeBSD for WIFEXITED # include // usleep #endif // clang-format on diff --git a/src/V3ParseGrammar.cpp b/src/V3ParseGrammar.cpp index 6589cbe11..3f3d06909 100644 --- a/src/V3ParseGrammar.cpp +++ b/src/V3ParseGrammar.cpp @@ -271,8 +271,9 @@ string V3ParseGrammar::deQuote(FileLine* fileline, string text) { } else if (isalnum(*cp)) { fileline->v3error("Unknown escape sequence: \\" << *cp); break; - } else + } else { newtext += *cp; + } } } else if (*cp == '\\') { quoted = true; diff --git a/src/V3ParseSym.h b/src/V3ParseSym.h index 6ff760def..4da0c735c 100644 --- a/src/V3ParseSym.h +++ b/src/V3ParseSym.h @@ -26,6 +26,7 @@ #include "V3SymTable.h" #include +#include //###################################################################### // Symbol table for parsing diff --git a/src/V3Partition.h b/src/V3Partition.h index 7eaec699e..d6155a852 100644 --- a/src/V3Partition.h +++ b/src/V3Partition.h @@ -24,6 +24,7 @@ #include "V3OrderGraph.h" #include +#include class LogicMTask; using Vx2MTaskMap = std::unordered_map; diff --git a/src/V3Scoreboard.h b/src/V3Scoreboard.h index e7f45bb78..7130e7284 100644 --- a/src/V3Scoreboard.h +++ b/src/V3Scoreboard.h @@ -29,8 +29,9 @@ #include "V3Error.h" -#include +#include #include +#include #include //###################################################################### diff --git a/src/V3Simulate.h b/src/V3Simulate.h index d9d4cb990..18a866566 100644 --- a/src/V3Simulate.h +++ b/src/V3Simulate.h @@ -42,6 +42,8 @@ #include #include +#include +#include #include //============================================================================ diff --git a/src/V3Subst.cpp b/src/V3Subst.cpp index ed49980ac..ff8122533 100644 --- a/src/V3Subst.cpp +++ b/src/V3Subst.cpp @@ -117,7 +117,7 @@ public: m_words[word].m_complex = true; } void assignComplex() { m_whole.m_complex = true; } - void consumeWhole() { //==consumeComplex as we don't know the difference + void consumeWhole() { // ==consumeComplex as we don't know the difference m_whole.m_use = true; } void consumeWord(int word) { diff --git a/src/V3SymTable.h b/src/V3SymTable.h index e25c381be..a594a4541 100644 --- a/src/V3SymTable.h +++ b/src/V3SymTable.h @@ -26,9 +26,11 @@ #include "V3String.h" #include -#include #include +#include #include +#include +#include class VSymGraph; class VSymEnt; diff --git a/src/V3TSP.h b/src/V3TSP.h index fa71487cb..8df9a2f2f 100644 --- a/src/V3TSP.h +++ b/src/V3TSP.h @@ -23,6 +23,8 @@ #include "V3Error.h" +#include + namespace V3TSP { // Perform a "Traveling Salesman Problem" optimizing sort // on any type you like -- so long as inherits from TspStateBase. diff --git a/src/V3Task.h b/src/V3Task.h index ce574420d..33e11512d 100644 --- a/src/V3Task.h +++ b/src/V3Task.h @@ -23,6 +23,7 @@ #include "V3Error.h" #include "V3Ast.h" +#include #include //============================================================================ diff --git a/src/V3Unknown.cpp b/src/V3Unknown.cpp index 2347d1550..d71317e58 100644 --- a/src/V3Unknown.cpp +++ b/src/V3Unknown.cpp @@ -276,13 +276,13 @@ private: UINFO(4, " COUNTBITS(" << dropop[0] << dropop[1] << dropop[2] << " " << nodep << endl); AstNode* nonXp = nullptr; - if (!dropop[0]) + if (!dropop[0]) { nonXp = nodep->rhsp(); - else if (!dropop[1]) + } else if (!dropop[1]) { nonXp = nodep->thsp(); - else if (!dropop[2]) + } else if (!dropop[2]) { nonXp = nodep->fhsp(); - else { // Was all X-s + } else { // Was all X-s UINFO(4, " COUNTBITS('x)->0 " << nodep << endl); AstConst* const newp = new AstConst(nodep->fileline(), AstConst::BitFalse()); nodep->replaceWith(newp); diff --git a/src/Verilator.cpp b/src/Verilator.cpp index 031e18008..e63305c74 100644 --- a/src/Verilator.cpp +++ b/src/Verilator.cpp @@ -246,7 +246,7 @@ static void process() { } } - //--PRE-FLAT OPTIMIZATIONS------------------ + // --PRE-FLAT OPTIMIZATIONS------------------ // Initial const/dead to reduce work for ordering code V3Const::constifyAll(v3Global.rootp()); @@ -257,7 +257,7 @@ static void process() { V3Error::abortIfErrors(); - //--FLATTENING--------------- + // --FLATTENING--------------- if (!(v3Global.opt.xmlOnly() && !v3Global.opt.flatten())) { // We're going to flatten the hierarchy, so as many optimizations that @@ -277,7 +277,7 @@ static void process() { V3Class::classAll(v3Global.rootp()); } - //--SCOPE BASED OPTIMIZATIONS-------------- + // --SCOPE BASED OPTIMIZATIONS-------------- if (!(v3Global.opt.xmlOnly() && !v3Global.opt.flatten())) { // Cleanup @@ -412,7 +412,7 @@ static void process() { if (v3Global.opt.stats()) V3Stats::statsStageAll(v3Global.rootp(), "Scoped"); } - //--MODULE OPTIMIZATIONS-------------- + // --MODULE OPTIMIZATIONS-------------- if (!v3Global.opt.xmlOnly()) { // Split deep blocks to appease MSVC++. Must be before Localize. @@ -435,7 +435,7 @@ static void process() { V3Error::abortIfErrors(); - //--GENERATION------------------ + // --GENERATION------------------ if (!v3Global.opt.xmlOnly()) { // Remove unused vars @@ -580,7 +580,7 @@ static void verilate(const string& argString) { v3fatalSrc("VERILATOR_DEBUG_SKIP_IDENTICAL w/ --skip-identical: Changes found\n"); } // LCOV_EXCL_STOP - //--FRONTEND------------------ + // --FRONTEND------------------ // Cleanup V3Os::unlinkRegexp(v3Global.opt.hierTopDataDir(), v3Global.opt.prefix() + "_*.tree"); diff --git a/src/VlcSource.h b/src/VlcSource.h index 84075ee1f..f8dece1a8 100644 --- a/src/VlcSource.h +++ b/src/VlcSource.h @@ -21,6 +21,7 @@ #include "verilatedos.h" #include +#include #include //******************************************************************** diff --git a/src/VlcTop.cpp b/src/VlcTop.cpp index b68e8e475..1d57c23ce 100644 --- a/src/VlcTop.cpp +++ b/src/VlcTop.cpp @@ -21,6 +21,8 @@ #include #include +#include +#include //######################################################################