mirror of
https://github.com/verilator/verilator.git
synced 2025-01-01 04:07:34 +00:00
Internal: clang-tidy fixes. No functional change.
This commit is contained in:
parent
d4f7f5297a
commit
e6f345e45d
@ -50,7 +50,7 @@ inline size_t vl_hash_bytes(const void* vbufp, size_t nbytes) {
|
||||
const vluint8_t* bufp = static_cast<const vluint8_t*>(vbufp);
|
||||
size_t hash = 0;
|
||||
for (size_t i = 0; i < nbytes; i++) {
|
||||
hash = bufp[i] + 31u * hash; // the K&R classic!
|
||||
hash = bufp[i] + 31U * hash; // the K&R classic!
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
@ -110,10 +110,11 @@ string AstNodeCCall::hiernameProtect() const {
|
||||
|
||||
void AstNodeCond::numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs,
|
||||
const V3Number& ths) {
|
||||
if (lhs.isNeqZero())
|
||||
if (lhs.isNeqZero()) {
|
||||
out.opAssign(rhs);
|
||||
else
|
||||
} else {
|
||||
out.opAssign(ths);
|
||||
}
|
||||
}
|
||||
|
||||
int AstBasicDType::widthAlignBytes() const {
|
||||
|
@ -250,7 +250,7 @@ public:
|
||||
return (m_on > rh.m_on);
|
||||
}
|
||||
};
|
||||
std::ostream& operator<<(std::ostream& os, V3ConfigIgnoresLine rhs) {
|
||||
std::ostream& operator<<(std::ostream& os, const V3ConfigIgnoresLine& rhs) {
|
||||
return os << rhs.m_lineno << ", " << rhs.m_code << ", " << rhs.m_on;
|
||||
}
|
||||
|
||||
@ -456,8 +456,8 @@ void V3Config::addVarAttr(FileLine* fl, const string& module, const string& ftas
|
||||
}
|
||||
}
|
||||
|
||||
void V3Config::addWaiver(V3ErrorCode code, const string& filename, const string& match) {
|
||||
V3ConfigResolver::s().files().at(filename).addWaiver(code, match);
|
||||
void V3Config::addWaiver(V3ErrorCode code, const string& filename, const string& message) {
|
||||
V3ConfigResolver::s().files().at(filename).addWaiver(code, message);
|
||||
}
|
||||
|
||||
void V3Config::applyCase(AstCase* nodep) {
|
||||
|
@ -33,14 +33,14 @@ public:
|
||||
static void addCoverageBlockOff(const string& file, int lineno);
|
||||
static void addCoverageBlockOff(const string& module, const string& blockname);
|
||||
static void addIgnore(V3ErrorCode code, bool on, const string& filename, int min, int max);
|
||||
static void addWaiver(V3ErrorCode code, const string& filename, const string& msg);
|
||||
static void addWaiver(V3ErrorCode code, const string& filename, const string& message);
|
||||
static void addInline(FileLine* fl, const string& module, const string& ftask, bool on);
|
||||
static void addVarAttr(FileLine* fl, const string& module, const string& ftask,
|
||||
const string& signal, AstAttrType type, AstSenTree* nodep);
|
||||
static void applyCase(AstCase* nodep);
|
||||
static void applyCoverageBlock(AstNodeModule* modulep, AstBegin* nodep);
|
||||
static void applyIgnores(FileLine* filelinep);
|
||||
static void applyModule(AstNodeModule* nodep);
|
||||
static void applyModule(AstNodeModule* modulep);
|
||||
static void applyFTask(AstNodeModule* modulep, AstNodeFTask* ftaskp);
|
||||
static void applyVarAttr(AstNodeModule* modulep, AstNodeFTask* ftaskp, AstVar* varp);
|
||||
static bool waive(FileLine* filelinep, V3ErrorCode code, const string& match);
|
||||
|
@ -2924,9 +2924,10 @@ void EmitCImp::emitInt(AstNodeModule* modp) {
|
||||
|
||||
string section;
|
||||
section = "\n// PORTS\n";
|
||||
if (modp->isTop())
|
||||
if (modp->isTop()) {
|
||||
section += ("// The application code writes and reads these signals to\n"
|
||||
"// propagate new values into/out from the Verilated model.\n");
|
||||
}
|
||||
emitVarList(modp->stmtsp(), EVL_CLASS_IO, "", section /*ref*/);
|
||||
|
||||
section = "\n// LOCAL SIGNALS\n";
|
||||
@ -3452,24 +3453,24 @@ class EmitCTrace : EmitCStmts {
|
||||
}
|
||||
}
|
||||
// clang-format off
|
||||
else if (vartype == AstVarType::GPARAM) fstvt = "FST_VT_VCD_PARAMETER";
|
||||
else if (vartype == AstVarType::LPARAM) fstvt = "FST_VT_VCD_PARAMETER";
|
||||
else if (vartype == AstVarType::SUPPLY0) fstvt = "FST_VT_VCD_SUPPLY0";
|
||||
else if (vartype == AstVarType::SUPPLY1) fstvt = "FST_VT_VCD_SUPPLY1";
|
||||
else if (vartype == AstVarType::TRI0) fstvt = "FST_VT_VCD_TRI0";
|
||||
else if (vartype == AstVarType::TRI1) fstvt = "FST_VT_VCD_TRI1";
|
||||
else if (vartype == AstVarType::TRIWIRE) fstvt = "FST_VT_VCD_TRI";
|
||||
else if (vartype == AstVarType::WIRE) fstvt = "FST_VT_VCD_WIRE";
|
||||
else if (vartype == AstVarType::PORT) fstvt = "FST_VT_VCD_WIRE";
|
||||
else if (vartype == AstVarType::GPARAM) { fstvt = "FST_VT_VCD_PARAMETER"; }
|
||||
else if (vartype == AstVarType::LPARAM) { fstvt = "FST_VT_VCD_PARAMETER"; }
|
||||
else if (vartype == AstVarType::SUPPLY0) { fstvt = "FST_VT_VCD_SUPPLY0"; }
|
||||
else if (vartype == AstVarType::SUPPLY1) { fstvt = "FST_VT_VCD_SUPPLY1"; }
|
||||
else if (vartype == AstVarType::TRI0) { fstvt = "FST_VT_VCD_TRI0"; }
|
||||
else if (vartype == AstVarType::TRI1) { fstvt = "FST_VT_VCD_TRI1"; }
|
||||
else if (vartype == AstVarType::TRIWIRE) { fstvt = "FST_VT_VCD_TRI"; }
|
||||
else if (vartype == AstVarType::WIRE) { fstvt = "FST_VT_VCD_WIRE"; }
|
||||
else if (vartype == AstVarType::PORT) { fstvt = "FST_VT_VCD_WIRE"; }
|
||||
//
|
||||
else if (kwd == AstBasicDTypeKwd::INTEGER) fstvt = "FST_VT_VCD_INTEGER";
|
||||
else if (kwd == AstBasicDTypeKwd::BIT) fstvt = "FST_VT_SV_BIT";
|
||||
else if (kwd == AstBasicDTypeKwd::LOGIC) fstvt = "FST_VT_SV_LOGIC";
|
||||
else if (kwd == AstBasicDTypeKwd::INT) fstvt = "FST_VT_SV_INT";
|
||||
else if (kwd == AstBasicDTypeKwd::SHORTINT) fstvt = "FST_VT_SV_SHORTINT";
|
||||
else if (kwd == AstBasicDTypeKwd::LONGINT) fstvt = "FST_VT_SV_LONGINT";
|
||||
else if (kwd == AstBasicDTypeKwd::BYTE) fstvt = "FST_VT_SV_BYTE";
|
||||
else fstvt = "FST_VT_SV_BIT";
|
||||
else if (kwd == AstBasicDTypeKwd::INTEGER) { fstvt = "FST_VT_VCD_INTEGER"; }
|
||||
else if (kwd == AstBasicDTypeKwd::BIT) { fstvt = "FST_VT_SV_BIT"; }
|
||||
else if (kwd == AstBasicDTypeKwd::LOGIC) { fstvt = "FST_VT_SV_LOGIC"; }
|
||||
else if (kwd == AstBasicDTypeKwd::INT) { fstvt = "FST_VT_SV_INT"; }
|
||||
else if (kwd == AstBasicDTypeKwd::SHORTINT) { fstvt = "FST_VT_SV_SHORTINT"; }
|
||||
else if (kwd == AstBasicDTypeKwd::LONGINT) { fstvt = "FST_VT_SV_LONGINT"; }
|
||||
else if (kwd == AstBasicDTypeKwd::BYTE) { fstvt = "FST_VT_SV_BYTE"; }
|
||||
else { fstvt = "FST_VT_SV_BIT"; }
|
||||
// clang-format on
|
||||
//
|
||||
// Not currently supported
|
||||
|
@ -496,7 +496,8 @@ private:
|
||||
void startFilter(const string& command) {
|
||||
if (command == "") {} // Prevent Unused
|
||||
#ifdef INFILTER_PIPE
|
||||
int fd_stdin[2], fd_stdout[2];
|
||||
int fd_stdin[2];
|
||||
int fd_stdout[2];
|
||||
static const int P_RD = 0;
|
||||
static const int P_WR = 1;
|
||||
|
||||
|
@ -58,7 +58,7 @@ class GateVarVertex;
|
||||
class GateGraphBaseVisitor {
|
||||
public:
|
||||
V3Graph* m_graphp; // Graph this class is visiting
|
||||
GateGraphBaseVisitor(V3Graph* graphp)
|
||||
explicit GateGraphBaseVisitor(V3Graph* graphp)
|
||||
: m_graphp(graphp) {}
|
||||
virtual ~GateGraphBaseVisitor() {}
|
||||
virtual VNUser visit(GateLogicVertex* vertexp, VNUser vu = VNUser(0)) = 0;
|
||||
|
@ -283,12 +283,12 @@ string V3Os::trueRandom(size_t size) {
|
||||
uint64_t V3Os::timeUsecs() {
|
||||
#if defined(_WIN32) || defined(__MINGW32__)
|
||||
// Microseconds between 1601-01-01 00:00:00 UTC and 1970-01-01 00:00:00 UTC
|
||||
static const uint64_t EPOCH_DIFFERENCE_USECS = 11644473600000000ull;
|
||||
static const uint64_t EPOCH_DIFFERENCE_USECS = 11644473600000000ULL;
|
||||
|
||||
FILETIME ft; // contains number of 0.1us intervals since the beginning of 1601 UTC.
|
||||
GetSystemTimeAsFileTime(&ft);
|
||||
uint64_t us
|
||||
= ((static_cast<uint64_t>(ft.dwHighDateTime) << 32) + ft.dwLowDateTime + 5ull) / 10ull;
|
||||
= ((static_cast<uint64_t>(ft.dwHighDateTime) << 32) + ft.dwLowDateTime + 5ULL) / 10ULL;
|
||||
return us - EPOCH_DIFFERENCE_USECS;
|
||||
#else
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init)
|
||||
|
@ -143,7 +143,7 @@ void V3ParseImp::verilatorCmtLint(const char* textp, bool warnOff) {
|
||||
while (*sp && isspace(*sp)) sp++;
|
||||
string msg = sp;
|
||||
string::size_type pos;
|
||||
if ((pos = msg.find('*')) != string::npos) { msg.erase(pos); }
|
||||
if ((pos = msg.find('*')) != string::npos) msg.erase(pos);
|
||||
if (!(parsep()->fileline()->warnOff(msg, warnOff))) {
|
||||
if (!parsep()->optFuture(msg)) {
|
||||
yyerrorf("Unknown verilator lint message code: %s, in %s", msg.c_str(), textp);
|
||||
|
@ -146,7 +146,7 @@ public:
|
||||
|
||||
void ppline(const char* textp);
|
||||
void linenoInc() { fileline()->linenoInc(); }
|
||||
void verilatorCmtLint(const char* textp, bool on);
|
||||
void verilatorCmtLint(const char* textp, bool warnOff);
|
||||
void verilatorCmtLintSave();
|
||||
void verilatorCmtLintRestore();
|
||||
void verilatorCmtBad(const char* textp);
|
||||
|
@ -2356,7 +2356,7 @@ void V3Partition::hashGraphDebug(const V3Graph* graphp, const char* debugName) {
|
||||
for (const V3GraphVertex* vxp = graphp->verticesBeginp(); vxp; vxp = vxp->verticesNextp()) {
|
||||
for (const V3GraphEdge* edgep = vxp->outBeginp(); edgep; edgep = edgep->outNextp()) {
|
||||
const V3GraphVertex* top = edgep->top();
|
||||
hash = vx2Id[top] + 31u * hash; // The K&R hash function
|
||||
hash = vx2Id[top] + 31U * hash; // The K&R hash function
|
||||
}
|
||||
}
|
||||
UINFO(0, "Hash of shape (not contents) of " << debugName << " = " << cvtToStr(hash) << endl);
|
||||
|
@ -1215,10 +1215,13 @@ int V3PreProcImp::getStateToken() {
|
||||
UINFO(5, "``-end-defarg Out:" << out << endl);
|
||||
statePop();
|
||||
}
|
||||
if (!m_off) unputDefrefString(out);
|
||||
if (!m_off) {
|
||||
unputDefrefString(out);
|
||||
}
|
||||
// Prevent problem when EMPTY="" in `ifdef NEVER `define `EMPTY
|
||||
else if (stateIsDefname())
|
||||
else if (stateIsDefname()) {
|
||||
unputDefrefString("__IF_OFF_IGNORED_DEFINE");
|
||||
}
|
||||
m_lexp->m_parenLevel = 0;
|
||||
} else { // Finished a defref inside a upper defref
|
||||
// Can't subst now, or
|
||||
@ -1433,10 +1436,13 @@ int V3PreProcImp::getStateToken() {
|
||||
UINFO(5, "``-end-defref Out:" << out << endl);
|
||||
statePop();
|
||||
}
|
||||
if (!m_off) unputDefrefString(out);
|
||||
if (!m_off) {
|
||||
unputDefrefString(out);
|
||||
}
|
||||
// Prevent problem when EMPTY="" in `ifdef NEVER `define `EMPTY
|
||||
else if (stateIsDefname())
|
||||
else if (stateIsDefname()) {
|
||||
unputDefrefString("__IF_OFF_IGNORED_DEFINE");
|
||||
}
|
||||
} else {
|
||||
// Inside another define.
|
||||
// Can't subst now, or
|
||||
|
@ -949,7 +949,8 @@ public:
|
||||
points.push_back(std::make_pair(it->msb() + 1, true)); // End of a region
|
||||
}
|
||||
if (skipUnused && !m_rhs.empty()) { // Range to be read must be kept, so add points here
|
||||
int lsb = m_basicp->msb() + 1, msb = m_basicp->lsb() - 1;
|
||||
int lsb = m_basicp->msb() + 1;
|
||||
int msb = m_basicp->lsb() - 1;
|
||||
for (size_t i = 0; i < m_rhs.size(); ++i) {
|
||||
lsb = std::min(lsb, m_rhs[i].lsb());
|
||||
msb = std::max(msb, m_rhs[i].msb());
|
||||
|
@ -523,7 +523,8 @@ public:
|
||||
// For test purposes, each TspTestState is merely a point
|
||||
// on the Cartesian plane; cost is the linear distance
|
||||
// between two points.
|
||||
unsigned xabs, yabs;
|
||||
unsigned xabs;
|
||||
unsigned yabs;
|
||||
xabs = diff(otherp->m_xpos, m_xpos);
|
||||
yabs = diff(otherp->m_ypos, m_ypos);
|
||||
return lround(sqrt(xabs * xabs + yabs * yabs));
|
||||
|
@ -2842,9 +2842,9 @@ private:
|
||||
patp->dtypep(vdtypep);
|
||||
AstNode* valuep = patternMemberValueIterate(patp);
|
||||
{ // Packed. Convert to concat for now.
|
||||
if (!newp)
|
||||
if (!newp) {
|
||||
newp = valuep;
|
||||
else {
|
||||
} else {
|
||||
AstConcat* concatp = new AstConcat(patp->fileline(), newp, valuep);
|
||||
newp = concatp;
|
||||
newp->dtypeSetLogicSized(concatp->lhsp()->width()
|
||||
|
@ -46,8 +46,8 @@ class VlcOptions {
|
||||
|
||||
private:
|
||||
// METHODS
|
||||
void showVersion(bool verbose);
|
||||
bool onoff(const char* sw, const char* arg, bool& flag);
|
||||
static void showVersion(bool verbose);
|
||||
static bool onoff(const char* sw, const char* arg, bool& flag);
|
||||
|
||||
public:
|
||||
// CONSTRUCTORS
|
||||
|
Loading…
Reference in New Issue
Block a user