Fix cppcheck 1.71 issues. No functional change intended.

This commit is contained in:
Wilson Snyder 2016-02-04 18:30:21 -05:00
parent d1acaea611
commit b488666c1e
7 changed files with 18 additions and 10 deletions

View File

@ -650,6 +650,7 @@ IData _vl_vsscanf(FILE* fp, // If a fscanf
_vl_vsss_skipspace(fp,floc,fromp,fstr);
_vl_vsss_read(fp,floc,fromp,fstr, tmp, "+-.0123456789eE");
if (!tmp[0]) goto done;
// cppcheck-suppress unusedStructMember // It's used
union { double r; vlsint64_t ld; } u;
u.r = strtod(tmp, NULL);
VL_SET_WQ(owp,u.ld);

View File

@ -102,7 +102,8 @@ string AstNode::encodeName(const string& namein) {
} else if (pos[0]=='_') {
if (pos[1]=='_') {
out += "_"; out += "__05F"; // hex(_) = 0x5F
pos++;
++pos;
if (pos==namein.end()) break;
} else {
out += pos[0];
}
@ -198,7 +199,7 @@ string AstNode::prettyName(const string& namein) {
}
else {
pretty += pos[0];
pos++;
++pos;
}
}
if (pretty.substr(0,4) == "TOP.") pretty.replace(0,4,"");

View File

@ -36,7 +36,7 @@
//######################################################################
// Emit statements and math operators
class EmitXmlFileVisitor : public EmitCBaseVisitor {
class EmitXmlFileVisitor : public AstNVisitor {
// MEMBERS
V3OutFile* m_ofp;

View File

@ -473,9 +473,8 @@ private:
nodep->rhsp()->iterateAndNext(*this);
if (optimizable()) {
AstNode* vscp;
if (varrefp) {
vscp = varOrScope(varrefp);
AstNode* vscp = varOrScope(varrefp);
V3Number outnum = V3Number(nodep->fileline());
if (V3Number* vscpnump = fetchOutNumberNull(vscp)) {
outnum = *vscpnump;

View File

@ -275,8 +275,8 @@ class SliceVisitor : public AstNVisitor {
}
UINFO(9," ArraySel-child: "<<topp<<endl);
AstArraySel* newp = new AstArraySel(nodep->fileline(), topp,
// "lsb-lsb": Arrays are zero-based so index 0 is always lsb
new AstConst(nodep->fileline(), lsb-lsb));
// Arrays are zero-based so index 0 is always lsb (e.g. lsb-lsb -> 0)
new AstConst(nodep->fileline(), 0));
if (!newp->dtypep()) {
newp->v3fatalSrc("ArraySel dtyping failed when resolving slice"); // see ArraySel constructor
}

View File

@ -325,7 +325,7 @@ private:
}
}
void visit(AstSel* nodep, AstNUser*) {
virtual void visit(AstSel* nodep, AstNUser*) {
nodep->iterateChildren(*this);
if (!nodep->user1SetOnce()) {
// Guard against reading/writing past end of bit vector array

View File

@ -9,7 +9,12 @@ use Pod::Usage;
use strict;
use vars qw ($Debug $VERSION);
$VERSION = '3.857';
$VERSION = '3.881';
our %SuppressMap = (
# New cpp check error Can suppress with old error
'nullPointerRedundantCheck' => 'nullPointer',
);
#======================================================================
# main
@ -44,6 +49,7 @@ sub process {
my $cmd = join(' ',@Opt_Args);
print "\t$cmd\n" if $Debug;
my $fh = IO::File->new("$cmd 2>&1 |");
$fh or die "%Error: '$cmd' failed: $!\n";
my %uniq;
my %errs;
while (defined(my $line = $fh->getline())) {
@ -115,7 +121,8 @@ sub _suppress {
if ($line =~ /cppcheck-suppress((\s+\S+)+)/) {
my $supids = $1;
foreach my $supid (split /\s+/, $supids) {
if ($supid eq $id) {
if ($supid eq $id
|| $supid eq $SuppressMap{$id}) {
return 1;
}
}