Internals: Fix cppcheck warnings. No functional change.

This commit is contained in:
Wilson Snyder 2015-10-04 13:11:32 -04:00
parent f71d904a9b
commit 5de83c9805
7 changed files with 23 additions and 15 deletions

View File

@ -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</*verilator clocker*/> in
RTL file to mark the signal directly.

View File

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

View File

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

View File

@ -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: "<<line);
return line;
}
// cppcheck-suppress unusedFunction
// cppcheck-suppress unusedFunction unusedPrivateFunction
void writeFilter(const string& out) {
if (debug()>=6) { UINFO(6,"filter-out: "<<out); if (out[out.length()-1]!='\n') cout<<endl; }
if (!m_pid) { v3error("--pipe-filter: write to closed file\n"); m_readEof = true; stop(); }

View File

@ -446,17 +446,19 @@ class SliceVisitor : public AstNVisitor {
if ((int)(dim - varDim.second) < 0) {
// Unpacked dimensions are referenced first, make sure we have them all
nodep->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*) {

View File

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

View File

@ -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="([^"]+)"/) {