mirror of
https://github.com/verilator/verilator.git
synced 2025-04-21 12:06:55 +00:00
Fix cppcheck 1.71 issues. No functional change intended.
This commit is contained in:
parent
d1acaea611
commit
b488666c1e
@ -650,6 +650,7 @@ IData _vl_vsscanf(FILE* fp, // If a fscanf
|
|||||||
_vl_vsss_skipspace(fp,floc,fromp,fstr);
|
_vl_vsss_skipspace(fp,floc,fromp,fstr);
|
||||||
_vl_vsss_read(fp,floc,fromp,fstr, tmp, "+-.0123456789eE");
|
_vl_vsss_read(fp,floc,fromp,fstr, tmp, "+-.0123456789eE");
|
||||||
if (!tmp[0]) goto done;
|
if (!tmp[0]) goto done;
|
||||||
|
// cppcheck-suppress unusedStructMember // It's used
|
||||||
union { double r; vlsint64_t ld; } u;
|
union { double r; vlsint64_t ld; } u;
|
||||||
u.r = strtod(tmp, NULL);
|
u.r = strtod(tmp, NULL);
|
||||||
VL_SET_WQ(owp,u.ld);
|
VL_SET_WQ(owp,u.ld);
|
||||||
|
@ -102,7 +102,8 @@ string AstNode::encodeName(const string& namein) {
|
|||||||
} else if (pos[0]=='_') {
|
} else if (pos[0]=='_') {
|
||||||
if (pos[1]=='_') {
|
if (pos[1]=='_') {
|
||||||
out += "_"; out += "__05F"; // hex(_) = 0x5F
|
out += "_"; out += "__05F"; // hex(_) = 0x5F
|
||||||
pos++;
|
++pos;
|
||||||
|
if (pos==namein.end()) break;
|
||||||
} else {
|
} else {
|
||||||
out += pos[0];
|
out += pos[0];
|
||||||
}
|
}
|
||||||
@ -198,7 +199,7 @@ string AstNode::prettyName(const string& namein) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pretty += pos[0];
|
pretty += pos[0];
|
||||||
pos++;
|
++pos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pretty.substr(0,4) == "TOP.") pretty.replace(0,4,"");
|
if (pretty.substr(0,4) == "TOP.") pretty.replace(0,4,"");
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
//######################################################################
|
//######################################################################
|
||||||
// Emit statements and math operators
|
// Emit statements and math operators
|
||||||
|
|
||||||
class EmitXmlFileVisitor : public EmitCBaseVisitor {
|
class EmitXmlFileVisitor : public AstNVisitor {
|
||||||
// MEMBERS
|
// MEMBERS
|
||||||
V3OutFile* m_ofp;
|
V3OutFile* m_ofp;
|
||||||
|
|
||||||
|
@ -473,9 +473,8 @@ private:
|
|||||||
nodep->rhsp()->iterateAndNext(*this);
|
nodep->rhsp()->iterateAndNext(*this);
|
||||||
|
|
||||||
if (optimizable()) {
|
if (optimizable()) {
|
||||||
AstNode* vscp;
|
|
||||||
if (varrefp) {
|
if (varrefp) {
|
||||||
vscp = varOrScope(varrefp);
|
AstNode* vscp = varOrScope(varrefp);
|
||||||
V3Number outnum = V3Number(nodep->fileline());
|
V3Number outnum = V3Number(nodep->fileline());
|
||||||
if (V3Number* vscpnump = fetchOutNumberNull(vscp)) {
|
if (V3Number* vscpnump = fetchOutNumberNull(vscp)) {
|
||||||
outnum = *vscpnump;
|
outnum = *vscpnump;
|
||||||
|
@ -275,8 +275,8 @@ class SliceVisitor : public AstNVisitor {
|
|||||||
}
|
}
|
||||||
UINFO(9," ArraySel-child: "<<topp<<endl);
|
UINFO(9," ArraySel-child: "<<topp<<endl);
|
||||||
AstArraySel* newp = new AstArraySel(nodep->fileline(), topp,
|
AstArraySel* newp = new AstArraySel(nodep->fileline(), topp,
|
||||||
// "lsb-lsb": Arrays are zero-based so index 0 is always lsb
|
// Arrays are zero-based so index 0 is always lsb (e.g. lsb-lsb -> 0)
|
||||||
new AstConst(nodep->fileline(), lsb-lsb));
|
new AstConst(nodep->fileline(), 0));
|
||||||
if (!newp->dtypep()) {
|
if (!newp->dtypep()) {
|
||||||
newp->v3fatalSrc("ArraySel dtyping failed when resolving slice"); // see ArraySel constructor
|
newp->v3fatalSrc("ArraySel dtyping failed when resolving slice"); // see ArraySel constructor
|
||||||
}
|
}
|
||||||
|
@ -325,7 +325,7 @@ private:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void visit(AstSel* nodep, AstNUser*) {
|
virtual void visit(AstSel* nodep, AstNUser*) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (!nodep->user1SetOnce()) {
|
if (!nodep->user1SetOnce()) {
|
||||||
// Guard against reading/writing past end of bit vector array
|
// Guard against reading/writing past end of bit vector array
|
||||||
|
@ -9,7 +9,12 @@ use Pod::Usage;
|
|||||||
use strict;
|
use strict;
|
||||||
use vars qw ($Debug $VERSION);
|
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
|
# main
|
||||||
@ -44,6 +49,7 @@ sub process {
|
|||||||
my $cmd = join(' ',@Opt_Args);
|
my $cmd = join(' ',@Opt_Args);
|
||||||
print "\t$cmd\n" if $Debug;
|
print "\t$cmd\n" if $Debug;
|
||||||
my $fh = IO::File->new("$cmd 2>&1 |");
|
my $fh = IO::File->new("$cmd 2>&1 |");
|
||||||
|
$fh or die "%Error: '$cmd' failed: $!\n";
|
||||||
my %uniq;
|
my %uniq;
|
||||||
my %errs;
|
my %errs;
|
||||||
while (defined(my $line = $fh->getline())) {
|
while (defined(my $line = $fh->getline())) {
|
||||||
@ -115,7 +121,8 @@ sub _suppress {
|
|||||||
if ($line =~ /cppcheck-suppress((\s+\S+)+)/) {
|
if ($line =~ /cppcheck-suppress((\s+\S+)+)/) {
|
||||||
my $supids = $1;
|
my $supids = $1;
|
||||||
foreach my $supid (split /\s+/, $supids) {
|
foreach my $supid (split /\s+/, $supids) {
|
||||||
if ($supid eq $id) {
|
if ($supid eq $id
|
||||||
|
|| $supid eq $SuppressMap{$id}) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user