From 5de83c98059e20c9969c413d08eb8260b9782660 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sun, 4 Oct 2015 13:11:32 -0400 Subject: [PATCH] Internals: Fix cppcheck warnings. No functional change. --- bin/verilator | 2 +- include/verilated_save.h | 2 +- include/verilated_vpi.h | 1 - src/V3File.cpp | 4 ++-- src/V3Slice.cpp | 22 ++++++++++++---------- src/V3Width.cpp | 5 +++++ src/cppcheck_filtered | 2 ++ 7 files changed, 23 insertions(+), 15 deletions(-) diff --git a/bin/verilator b/bin/verilator index db6ddcff4..6123f11d5 100755 --- a/bin/verilator +++ b/bin/verilator @@ -472,7 +472,7 @@ Verilator will mark the signal as clocker and propagate the clocker attribute automatically to other signals derived from that. In this way, Verilator will try to avoid taking the clocker signal into checking list. -Note signal-name is specified by the RTL hiearchy path. For example, v.foo.bar. +Note signal-name is specified by the RTL hierarchy path. For example, v.foo.bar. If the signal is the input to top-module, the directly the signal name. If you find it difficult to find the exact name, try to use C in RTL file to mark the signal directly. diff --git a/include/verilated_save.h b/include/verilated_save.h index e4aec588e..8a4189795 100644 --- a/include/verilated_save.h +++ b/include/verilated_save.h @@ -225,7 +225,7 @@ inline VerilatedSerialize& operator<<(VerilatedSerialize& os, string& rhs) { return os.write(rhs.data(), len); } inline VerilatedDeserialize& operator>>(VerilatedDeserialize& os, string& rhs) { - vluint32_t len; + vluint32_t len=0; os>>len; rhs.resize(len); return os.read((void*)rhs.data(), len); diff --git a/include/verilated_vpi.h b/include/verilated_vpi.h index ead2edf9c..064b2b0f0 100644 --- a/include/verilated_vpi.h +++ b/include/verilated_vpi.h @@ -318,7 +318,6 @@ class VerilatedVpi { struct product_info { PLI_BYTE8* product; - PLI_BYTE8* version; }; VpioCbList m_cbObjLists[CB_ENUM_MAX_VALUE]; // Callbacks for each supported reason diff --git a/src/V3File.cpp b/src/V3File.cpp index b32d9e885..60a3b31c3 100644 --- a/src/V3File.cpp +++ b/src/V3File.cpp @@ -363,7 +363,7 @@ private: } return out; } - // cppcheck-suppress unusedFunction + // cppcheck-suppress unusedFunction unusedPrivateFunction string readFilterLine() { // Slow, but we don't need it much UINFO(9,"readFilterLine\n"); @@ -381,7 +381,7 @@ private: UINFO(6,"filter-line-in: "<=6) { UINFO(6,"filter-out: "<v3error("Unary operator used across unpacked dimensions"); - } else if ((int)(dim - (varDim.second)) < 0) { - // Implicit packed dimensions are allowed, make them explicit - uint32_t newDim = (varDim.second) - dim; - AstNode* clonep = nodep->lhsp()->cloneTree(false); - clonep->user1p(refp); - AstNode* newp = insertImplicit(clonep, dim+1, newDim); - nodep->lhsp()->replaceWith(newp); refp = NULL; - int clones = countClones(nodep->lhsp()->castArraySel()); - nodep->user2(clones); - SliceCloneVisitor scv(nodep); } + //Dead code + //else if ((int)(dim - (varDim.second)) < 0) { + // // Implicit packed dimensions are allowed, make them explicit + // uint32_t newDim = (varDim.second) - dim; + // AstNode* clonep = nodep->lhsp()->cloneTree(false); + // clonep->user1p(refp); + // AstNode* newp = insertImplicit(clonep, dim+1, newDim); + // nodep->lhsp()->replaceWith(newp); VL_DANGLING(refp); + // int clones = countClones(nodep->lhsp()->castArraySel()); + // nodep->user2(clones); + // SliceCloneVisitor scv(nodep); + //} } } virtual void visit(AstRedOr* nodep, AstNUser*) { diff --git a/src/V3Width.cpp b/src/V3Width.cpp index 344281533..909b27291 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -2820,6 +2820,7 @@ private: underp = underp->acceptSubtreeReturnEdits(*this,WidthVP(SELF,PRELIM).p()); AstNodeDType* expDTypep = underp->findUInt32DType(); underp = iterateCheck(nodep,"file_descriptor",underp,SELF,FINAL,expDTypep,EXTEND_EXP); + if (underp) {} // cppcheck } void iterateCheckReal (AstNode* nodep, const char* side, AstNode* underp, Stage stage) { // Coerce child to real if not already. Child is self-determined @@ -2835,6 +2836,7 @@ private: AstNodeDType* expDTypep = nodep->findDoubleDType(); underp = iterateCheck(nodep,side,underp,SELF,FINAL,expDTypep,EXTEND_EXP); } + if (underp) {} // cppcheck } void iterateCheckString (AstNode* nodep, const char* side, AstNode* underp, Stage stage) { if (stage & PRELIM) { @@ -2844,6 +2846,7 @@ private: AstNodeDType* expDTypep = nodep->findStringDType(); underp = iterateCheck(nodep,side,underp,SELF,FINAL,expDTypep,EXTEND_EXP); } + if (underp) {} // cppcheck } void iterateCheckSizedSelf (AstNode* nodep, const char* side, AstNode* underp, Determ determ, Stage stage) { @@ -2856,6 +2859,7 @@ private: underp = checkCvtUS(underp); AstNodeDType* expDTypep = underp->dtypep(); underp = iterateCheck(nodep,side,underp,SELF,FINAL,expDTypep,EXTEND_EXP); + if (underp) {} // cppcheck } void iterateCheckAssign(AstNode* nodep, const char* side, AstNode* rhsp, Stage stage, AstNodeDType* lhsDTypep) { @@ -2867,6 +2871,7 @@ private: && nodep->castNodeAssign()->lhsp()->castNodeStream()); rhsp = iterateCheck(nodep,side,rhsp,ASSIGN,FINAL,lhsDTypep,lhsStream?EXTEND_OFF:EXTEND_LHS); //if (debug()) nodep->dumpTree(cout,"-checkout: "); + if (rhsp) {} // cppcheck } void iterateCheckBool (AstNode* nodep, const char* side, AstNode* underp, Stage stage) { diff --git a/src/cppcheck_filtered b/src/cppcheck_filtered index 69a45e689..29a86bf83 100755 --- a/src/cppcheck_filtered +++ b/src/cppcheck_filtered @@ -70,6 +70,8 @@ sub process { # Output if ($line =~ /^cppcheck --/) { print $line if $Debug; + } elsif ($line =~ m!^\d+/\d+ files checked!) { + print $line; } else { my $suppress; if ($line =~ /file="([^"]+)"\s+line="(\d+)"\s+id="([^"]+)"/) {