Internals: cpplint cleanups. No functional change.

This commit is contained in:
Wilson Snyder 2022-01-08 12:01:39 -05:00
parent 441ecfedc9
commit 15b32dc140
32 changed files with 67 additions and 37 deletions

View File

@ -180,7 +180,7 @@ public:
}
// Internal class access
inline VerilatedFst* spTrace() { return &m_sptrace; };
inline VerilatedFst* spTrace() { return &m_sptrace; }
};
#endif // guard

View File

@ -849,8 +849,8 @@ template <class T_Value, std::size_t T_Depth> 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 {

View File

@ -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) {

View File

@ -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

View File

@ -27,8 +27,12 @@
#include "V3Broken.h"
#include <cmath>
#include <map>
#include <set>
#include <type_traits>
#include <unordered_set>
#include <utility>
#include <vector>
#include "V3Ast__gen_classes.h" // From ./astgen
// Things like:

View File

@ -225,7 +225,7 @@ private:
while (nodep) {
processAndIterate(nodep);
nodep = nodep->nextp();
};
}
}
void pushLocalScope() {
if (m_cfuncp) m_localsStack.emplace_back();

View File

@ -118,7 +118,7 @@ public:
rootFuncp->addStmtsp(callp);
}
}
};
}
private:
VL_UNCOPYABLE(V3CCtorsBuilder);

View File

@ -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)");

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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();

View File

@ -23,6 +23,8 @@
#include "V3Graph.h"
#include <functional>
#include <map>
#include <set>
#include <unordered_map>

View File

@ -29,6 +29,7 @@
#include <set>
#include <string>
#include <utility>
#include <unordered_map>
#include <unordered_set>
#include <vector>

View File

@ -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
}

View File

@ -23,6 +23,8 @@
#include "V3Error.h"
#include "V3Ast.h"
#include <vector>
//============================================================================
class V3LinkLevel final {

View File

@ -23,6 +23,7 @@
#include "V3Error.h"
#include "V3Hash.h"
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>

View File

@ -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

View File

@ -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 <sys/time.h>
# include <sys/wait.h> // Needed on FreeBSD for WIFEXITED
# include <sys/wait.h> // Needed on FreeBSD for WIFEXITED
# include <unistd.h> // usleep
#endif
// clang-format on

View File

@ -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;

View File

@ -26,6 +26,7 @@
#include "V3SymTable.h"
#include <deque>
#include <vector>
//######################################################################
// Symbol table for parsing

View File

@ -24,6 +24,7 @@
#include "V3OrderGraph.h"
#include <list>
#include <unordered_map>
class LogicMTask;
using Vx2MTaskMap = std::unordered_map<const MTaskMoveVertex*, LogicMTask*>;

View File

@ -29,8 +29,9 @@
#include "V3Error.h"
#include <set>
#include <functional>
#include <map>
#include <set>
#include <unordered_map>
//######################################################################

View File

@ -42,6 +42,8 @@
#include <deque>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <vector>
//============================================================================

View File

@ -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) {

View File

@ -26,9 +26,11 @@
#include "V3String.h"
#include <cstdarg>
#include <map>
#include <iomanip>
#include <map>
#include <memory>
#include <unordered_set>
#include <vector>
class VSymGraph;
class VSymEnt;

View File

@ -23,6 +23,8 @@
#include "V3Error.h"
#include <vector>
namespace V3TSP {
// Perform a "Traveling Salesman Problem" optimizing sort
// on any type you like -- so long as inherits from TspStateBase.

View File

@ -23,6 +23,7 @@
#include "V3Error.h"
#include "V3Ast.h"
#include <utility>
#include <vector>
//============================================================================

View File

@ -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);

View File

@ -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");

View File

@ -21,6 +21,7 @@
#include "verilatedos.h"
#include <map>
#include <utility>
#include <vector>
//********************************************************************

View File

@ -21,6 +21,8 @@
#include <algorithm>
#include <fstream>
#include <string>
#include <vector>
//######################################################################