Internals: Cleanup cppcheck c casts. No functional change intended.
This commit is contained in:
parent
631714c50a
commit
997d5ecdf1
|
|
@ -410,7 +410,7 @@ CPPCHECK_FLAGS = --enable=all
|
|||
CPPCHECK_FLAGS += --inline-suppr
|
||||
CPPCHECK_FLAGS += --suppressions-list=$(srcdir)/src/cppcheck-suppressions.txt
|
||||
CPPCHECK_FLAGS += --cppcheck-build-dir=$(CPPCHECK_CACHE)
|
||||
CPPCHECK_FLAGS += -DVL_DEBUG=1 -DVL_CPPCHECK=1 -D__GNUC__=1
|
||||
CPPCHECK_FLAGS += -DVL_DEBUG=1 -DVL_CPPCHECK=1 -DINFILTER_PIPE=1 -D__GNUC__=1
|
||||
CPPCHECK_FLAGS += -j$(CPPCHECK_JOBS)
|
||||
CPPCHECK_INC = -I$(srcdir)/include
|
||||
CPPCHECK_INC += -I$(srcdir)/include/gtkwave
|
||||
|
|
|
|||
|
|
@ -1755,7 +1755,7 @@ uint64_t VL_MURMUR64_HASH(const char* key) VL_PURE {
|
|||
|
||||
uint64_t h = seed ^ (len * m);
|
||||
|
||||
const uint64_t* data = (const uint64_t*)key;
|
||||
const uint64_t* data = reinterpret_cast<const uint64_t*>(key);
|
||||
const uint64_t* end = data + (len / 8);
|
||||
|
||||
while (data != end) {
|
||||
|
|
@ -1769,7 +1769,7 @@ uint64_t VL_MURMUR64_HASH(const char* key) VL_PURE {
|
|||
h *= m;
|
||||
}
|
||||
|
||||
const unsigned char* data2 = (const unsigned char*)data;
|
||||
const unsigned char* data2 = reinterpret_cast<const unsigned char*>(data);
|
||||
|
||||
switch (len & 7) {
|
||||
case 7: h ^= uint64_t(data2[6]) << 48; /* fallthrough */
|
||||
|
|
@ -3379,7 +3379,7 @@ VerilatedModule::VerilatedModule(const char* namep)
|
|||
|
||||
VerilatedModule::~VerilatedModule() {
|
||||
// Memory cleanup - not called during normal operation
|
||||
// NOLINTNEXTLINE(google-readability-casting)
|
||||
// cppcheck-suppress cstyleCast // NOLINTNEXTLINE(google-readability-casting)
|
||||
if (m_namep) VL_DO_CLEAR(free((void*)(m_namep)), m_namep = nullptr);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -298,7 +298,7 @@ inline VerilatedDeserialize& operator>>(VerilatedDeserialize& os, std::string& r
|
|||
uint32_t len = 0;
|
||||
os >> len;
|
||||
rhs.resize(len);
|
||||
// NOLINTNEXTLINE(google-readability-casting)
|
||||
// cppcheck-suppress cstyleCast // NOLINTNEXTLINE(google-readability-casting)
|
||||
return os.read((void*)(rhs.data()), len);
|
||||
}
|
||||
VerilatedSerialize& operator<<(VerilatedSerialize& os, VerilatedContext* rhsp);
|
||||
|
|
|
|||
|
|
@ -499,7 +499,7 @@ private:
|
|||
|
||||
public:
|
||||
// CONSTRUCTORS
|
||||
// cppcheck-suppress uninitMember // m_defaultValue isn't defaulted, caller's constructor must
|
||||
// cppcheck-suppress uninitMemberVar // m_defaultValue isn't defaulted, caller must
|
||||
VlQueue() = default;
|
||||
~VlQueue() = default;
|
||||
VlQueue(const VlQueue&) = default;
|
||||
|
|
|
|||
|
|
@ -3147,7 +3147,7 @@ void vl_get_value_array(vpiHandle object, p_vpi_arrayvalue arrayvalue_p, const P
|
|||
"increase and recompile");
|
||||
}
|
||||
|
||||
PLI_INT16* shortintsp = (PLI_INT16*)out_data;
|
||||
PLI_INT16* shortintsp = reinterpret_cast<PLI_INT16*>(out_data);
|
||||
arrayvalue_p->value.shortints = shortintsp;
|
||||
|
||||
if (varp->vltype() == VLVT_UINT8) {
|
||||
|
|
@ -3166,7 +3166,7 @@ void vl_get_value_array(vpiHandle object, p_vpi_arrayvalue arrayvalue_p, const P
|
|||
"increase and recompile");
|
||||
}
|
||||
|
||||
PLI_INT32* integersp = (PLI_INT32*)out_data;
|
||||
PLI_INT32* integersp = reinterpret_cast<PLI_INT32*>(out_data);
|
||||
arrayvalue_p->value.integers = integersp;
|
||||
|
||||
if (varp->vltype() == VLVT_UINT8) {
|
||||
|
|
@ -3188,7 +3188,7 @@ void vl_get_value_array(vpiHandle object, p_vpi_arrayvalue arrayvalue_p, const P
|
|||
"increase and recompile");
|
||||
}
|
||||
|
||||
PLI_INT64* longintsp = (PLI_INT64*)out_data;
|
||||
PLI_INT64* longintsp = reinterpret_cast<PLI_INT64*>(out_data);
|
||||
arrayvalue_p->value.longints = longintsp;
|
||||
|
||||
if (varp->vltype() == VLVT_UINT8) {
|
||||
|
|
@ -3213,7 +3213,7 @@ void vl_get_value_array(vpiHandle object, p_vpi_arrayvalue arrayvalue_p, const P
|
|||
"increase and recompile");
|
||||
}
|
||||
|
||||
p_vpi_vecval vectorsp = (p_vpi_vecval)out_data;
|
||||
p_vpi_vecval vectorsp = reinterpret_cast<p_vpi_vecval>(out_data);
|
||||
arrayvalue_p->value.vectors = vectorsp;
|
||||
|
||||
if (varp->vltype() == VLVT_UINT8) {
|
||||
|
|
@ -3241,7 +3241,7 @@ void vl_get_value_array(vpiHandle object, p_vpi_arrayvalue arrayvalue_p, const P
|
|||
"increase and recompile");
|
||||
}
|
||||
|
||||
PLI_BYTE8* valuep = (PLI_BYTE8*)out_data;
|
||||
PLI_BYTE8* valuep = reinterpret_cast<PLI_BYTE8*>(out_data);
|
||||
arrayvalue_p->value.rawvals = valuep;
|
||||
|
||||
if (varp->vltype() == VLVT_UINT8) {
|
||||
|
|
@ -3269,7 +3269,7 @@ void vl_get_value_array(vpiHandle object, p_vpi_arrayvalue arrayvalue_p, const P
|
|||
"increase and recompile");
|
||||
}
|
||||
|
||||
PLI_BYTE8* valuep = (PLI_BYTE8*)out_data;
|
||||
PLI_BYTE8* valuep = reinterpret_cast<PLI_BYTE8*>(out_data);
|
||||
arrayvalue_p->value.rawvals = valuep;
|
||||
|
||||
if (varp->vltype() == VLVT_UINT8) {
|
||||
|
|
|
|||
|
|
@ -1258,7 +1258,7 @@ char* AstNode::dumpTreeJsonGdb(const char* str) { return strdup(str); }
|
|||
// allow for passing pointer literals like 0x42.. without manual cast
|
||||
char* AstNode::dumpTreeJsonGdb(intptr_t nodep) {
|
||||
if (!nodep) return strdup("{\"addr\":\"NULL\"}\n");
|
||||
return dumpTreeJsonGdb((const AstNode*)nodep);
|
||||
return dumpTreeJsonGdb(reinterpret_cast<const AstNode*>(nodep));
|
||||
}
|
||||
// cppcheck-suppress unusedFunction // Debug only
|
||||
void AstNode::dumpGdb(const AstNode* nodep) { // For GDB only // LCOV_EXCL_LINE
|
||||
|
|
|
|||
|
|
@ -503,7 +503,7 @@ public:
|
|||
AstVar* varp() const VL_MT_STABLE { return m_varp; } // [After Link] Pointer to variable
|
||||
void varp(AstVar* varp) {
|
||||
m_varp = varp;
|
||||
dtypeFrom((AstNode*)varp);
|
||||
dtypeFrom(reinterpret_cast<AstNode*>(varp));
|
||||
}
|
||||
AstVarScope* varScopep() const { return m_varScopep; }
|
||||
void varScopep(AstVarScope* varscp) { m_varScopep = varscp; }
|
||||
|
|
@ -767,7 +767,9 @@ public:
|
|||
AstNode* classOrPackageNodep() const { return m_classOrPackageNodep; }
|
||||
void classOrPackageNodep(AstNode* nodep) { m_classOrPackageNodep = nodep; }
|
||||
AstPackage* packagep() const { return VN_CAST(classOrPackageNodep(), Package); }
|
||||
void classOrPackagep(AstNodeModule* nodep) { m_classOrPackageNodep = (AstNode*)nodep; }
|
||||
void classOrPackagep(AstNodeModule* nodep) {
|
||||
m_classOrPackageNodep = reinterpret_cast<AstNode*>(nodep);
|
||||
}
|
||||
|
||||
string emitVerilog() override { V3ERROR_NA_RETURN(""); }
|
||||
string emitC() override { V3ERROR_NA_RETURN(""); }
|
||||
|
|
@ -4474,7 +4476,7 @@ class AstFuncRef final : public AstNodeFTaskRef {
|
|||
public:
|
||||
inline AstFuncRef(FileLine* fl, AstFunc* taskp, AstNodeExpr* pinsp);
|
||||
AstFuncRef(FileLine* fl, AstParseRef* namep, AstNodeExpr* pinsp)
|
||||
: ASTGEN_SUPER_FuncRef(fl, (AstNode*)namep, pinsp) {}
|
||||
: ASTGEN_SUPER_FuncRef(fl, reinterpret_cast<AstNode*>(namep), pinsp) {}
|
||||
AstFuncRef(FileLine* fl, const string& name, AstNodeExpr* pinsp)
|
||||
: ASTGEN_SUPER_FuncRef(fl, name, pinsp) {}
|
||||
ASTGEN_MEMBERS_AstFuncRef;
|
||||
|
|
@ -4525,7 +4527,7 @@ class AstTaskRef final : public AstNodeFTaskRef {
|
|||
public:
|
||||
inline AstTaskRef(FileLine* fl, AstTask* taskp, AstNodeExpr* pinsp);
|
||||
AstTaskRef(FileLine* fl, AstParseRef* namep, AstNodeExpr* pinsp)
|
||||
: ASTGEN_SUPER_TaskRef(fl, (AstNode*)namep, pinsp) {
|
||||
: ASTGEN_SUPER_TaskRef(fl, reinterpret_cast<AstNode*>(namep), pinsp) {
|
||||
dtypeSetVoid();
|
||||
}
|
||||
AstTaskRef(FileLine* fl, const string& name, AstNodeExpr* pinsp)
|
||||
|
|
|
|||
|
|
@ -1092,7 +1092,8 @@ class AstAssignAlias final : public AstNodeAssign {
|
|||
// If both sides are wires, there's no LHS vs RHS,
|
||||
public:
|
||||
AstAssignAlias(FileLine* fl, AstVarRef* lhsp, AstVarRef* rhsp)
|
||||
: ASTGEN_SUPER_AssignAlias(fl, (AstNodeExpr*)lhsp, (AstNodeExpr*)rhsp) {}
|
||||
: ASTGEN_SUPER_AssignAlias(fl, reinterpret_cast<AstNodeExpr*>(lhsp),
|
||||
reinterpret_cast<AstNodeExpr*>(rhsp)) {}
|
||||
ASTGEN_MEMBERS_AstAssignAlias;
|
||||
AstNodeAssign* cloneType(AstNodeExpr* lhsp, AstNodeExpr* rhsp) override {
|
||||
V3ERROR_NA_RETURN(nullptr);
|
||||
|
|
|
|||
|
|
@ -364,7 +364,7 @@ uint64_t VString::hashMurmur(const string& str) VL_PURE {
|
|||
|
||||
uint64_t h = seed ^ (len * m);
|
||||
|
||||
const uint64_t* data = (const uint64_t*)key;
|
||||
const uint64_t* data = reinterpret_cast<const uint64_t*>(key);
|
||||
const uint64_t* end = data + (len / 8);
|
||||
|
||||
while (data != end) {
|
||||
|
|
@ -378,7 +378,7 @@ uint64_t VString::hashMurmur(const string& str) VL_PURE {
|
|||
h *= m;
|
||||
}
|
||||
|
||||
const unsigned char* data2 = (const unsigned char*)data;
|
||||
const unsigned char* data2 = reinterpret_cast<const unsigned char*>(data);
|
||||
|
||||
switch (len & 7) {
|
||||
case 7: h ^= uint64_t(data2[6]) << 48; /* fallthrough */
|
||||
|
|
|
|||
|
|
@ -308,11 +308,11 @@ public:
|
|||
if (AstNode* const refp = nodep->op4p()) deleteVerticesFromSubtreeRecurse(refp);
|
||||
}
|
||||
void setTristate(AstNode* nodep) { makeVertex(nodep)->isTristate(true); }
|
||||
bool isTristate(AstNode* nodep) {
|
||||
bool isTristate(const AstNode* nodep) {
|
||||
const TristateVertex* const vertexp = reinterpret_cast<TristateVertex*>(nodep->user4p());
|
||||
return vertexp && vertexp->isTristate();
|
||||
}
|
||||
bool feedsTri(AstNode* nodep) {
|
||||
bool feedsTri(const AstNode* nodep) {
|
||||
const TristateVertex* const vertexp = reinterpret_cast<TristateVertex*>(nodep->user4p());
|
||||
return vertexp && vertexp->feedsTri();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
// Version 2.0.
|
||||
// SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
cstyleCast
|
||||
ctunullpointer
|
||||
derefInvalidIteratorRedundantCheck
|
||||
nullPointer
|
||||
|
|
|
|||
Loading…
Reference in New Issue