Skip to content

Commit b1635c2

Browse files
committed
Cleanup cppcheck
1 parent b8b6e22 commit b1635c2

5 files changed

Lines changed: 33 additions & 28 deletions

File tree

‎cppcheck.sup‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ constVariablePointer:main.cc:425
1515
constVariablePointer:main.cc:675
1616

1717
// const auto should be const
18-
constVariablePointer:elab_expr.cc:566
19-
constVariablePointer:elab_expr.cc:569
20-
constVariablePointer:elab_expr.cc:638
18+
constVariablePointer:elab_expr.cc:628
19+
constVariablePointer:elab_expr.cc:631
20+
constVariablePointer:elab_expr.cc:700
2121

2222
// The reference cannot be const since it is updated in the calling function.
2323
constParameterReference:net_udp.cc:37
@@ -36,23 +36,23 @@ uninitMemberVar:t-dll.cc:41
3636
uninitMemberVar:t-dll.cc:109
3737

3838
// By convention we put statics at the top scope.
39-
variableScope:pform.cc:3632
39+
variableScope:pform.cc:3630
4040

4141
// These are correct and are used to find the base (zero) pin.
42-
thisSubtraction:netlist.h:5376
43-
thisSubtraction:netlist.h:5385
42+
thisSubtraction:netlist.h:5370
43+
thisSubtraction:netlist.h:5379
4444

4545
// This is used when running a debugger
4646
// debugger_release
4747
knownConditionTrueFalse:main.cc:955
4848

4949
// These should be checked, but are not real issues
50-
knownConditionTrueFalse:elaborate.cc:7970
50+
knownConditionTrueFalse:elaborate.cc:8165
5151
knownConditionTrueFalse:elab_sig.cc:272
5252
knownConditionTrueFalse:elab_sig.cc:345
5353

5454
// Yes, it's a duplicate
55-
duplicateCondition:elaborate.cc:8190
55+
duplicateCondition:elaborate.cc:8216
5656

5757
// To complicated to use std::find_if()
5858
useStlAlgorithm:map_named_args.cc:38
@@ -732,9 +732,9 @@ unusedFunction:net_link.cc:283
732732
// intersect()
733733
unusedFunction:net_link.cc:687
734734
// get_def_fileline()
735-
unusedFunction:net_scope.cc:201
735+
unusedFunction:net_scope.cc:200
736736
// get_module_port_info()
737-
unusedFunction:net_scope.cc:617
737+
unusedFunction:net_scope.cc:631
738738
// find_link_signal()
739739
unusedFunction:netlist.cc:113
740740
// find_link()

‎elaborate.cc‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2085,7 +2085,7 @@ void PGModule::elaborate_mod_(Design*des, const Module*rmod, NetScope*scope) con
20852085
// We do not support automatic bits to real conversion
20862086
// for inout ports.
20872087
if ((sig->data_type() == IVL_VT_REAL ) &&
2088-
!prts.empty() && (prts[0]->data_type() != IVL_VT_REAL )) {
2088+
(prts[0]->data_type() != IVL_VT_REAL )) {
20892089
cerr << pins[idx]->get_fileline() << ": error: "
20902090
<< "Cannot automatically connect bit based "
20912091
"inout port " << (idx+1) << " (" << port_name
@@ -2096,7 +2096,7 @@ void PGModule::elaborate_mod_(Design*des, const Module*rmod, NetScope*scope) con
20962096
}
20972097

20982098
// We do not support real inout ports at all.
2099-
if (!prts.empty() && (prts[0]->data_type() == IVL_VT_REAL )) {
2099+
if (prts[0]->data_type() == IVL_VT_REAL ) {
21002100
cerr << pins[idx]->get_fileline() << ": error: "
21012101
<< "No support for connecting real inout ports ("
21022102
"port " << (idx+1) << " (" << port_name
@@ -2150,7 +2150,7 @@ void PGModule::elaborate_mod_(Design*des, const Module*rmod, NetScope*scope) con
21502150
// width cast. Since a real is only one bit the whole
21512151
// thing needs to go to each instance when arrayed.
21522152
if ((sig->data_type() != IVL_VT_REAL ) &&
2153-
!prts.empty() && (prts[0]->data_type() == IVL_VT_REAL )) {
2153+
(prts[0]->data_type() == IVL_VT_REAL )) {
21542154
if (sig->vector_width() % instance.size() != 0) {
21552155
cerr << pins[idx]->get_fileline() << ": error: "
21562156
"When automatically converting a real "
@@ -2175,7 +2175,7 @@ void PGModule::elaborate_mod_(Design*des, const Module*rmod, NetScope*scope) con
21752175
// If we have a bit/vector port driving a single real
21762176
// signal then we convert the value to a real.
21772177
if ((sig->data_type() == IVL_VT_REAL ) &&
2178-
!prts.empty() && (prts[0]->data_type() != IVL_VT_REAL )) {
2178+
(prts[0]->data_type() != IVL_VT_REAL )) {
21792179
prts_vector_width -= prts[0]->vector_width() - 1;
21802180
prts[0] = cast_to_real(des, scope, prts[0]);
21812181
// No support for multiple real drivers.
@@ -2193,7 +2193,7 @@ void PGModule::elaborate_mod_(Design*des, const Module*rmod, NetScope*scope) con
21932193
// If we have a 4-state bit/vector port driving a
21942194
// 2-state signal then we convert the value to 2-state.
21952195
if ((sig->data_type() == IVL_VT_BOOL ) &&
2196-
!prts.empty() && (prts[0]->data_type() == IVL_VT_LOGIC )) {
2196+
(prts[0]->data_type() == IVL_VT_LOGIC )) {
21972197
for (unsigned pidx = 0; pidx < prts.size(); pidx += 1) {
21982198
prts[pidx] = cast_to_int2(des, scope, prts[pidx],
21992199
prts[pidx]->vector_width());
@@ -2203,7 +2203,7 @@ void PGModule::elaborate_mod_(Design*des, const Module*rmod, NetScope*scope) con
22032203
// A real to real connection is not allowed for arrayed
22042204
// instances. You cannot have multiple real drivers.
22052205
if ((sig->data_type() == IVL_VT_REAL ) &&
2206-
!prts.empty() && (prts[0]->data_type() == IVL_VT_REAL ) &&
2206+
(prts[0]->data_type() == IVL_VT_REAL ) &&
22072207
instance.size() != 1) {
22082208
cerr << pins[idx]->get_fileline() << ": error: "
22092209
<< "An arrayed instance of " << rmod->mod_name()
@@ -4689,6 +4689,11 @@ NetProc* PCallTask::elaborate_build_call_(Design*des, NetScope*scope,
46894689
<< peek_tail_name(path_) << "' is not allowed." << endl;
46904690
des->errors++;
46914691
}
4692+
} else {
4693+
cerr << get_fileline() << ": error: trying to generate a call to '"
4694+
<< peek_tail_name(path_) << "' which is not a task of function." << endl;
4695+
des->errors++;
4696+
return nullptr;
46924697
}
46934698

46944699
/* The caller has checked the parms_ size to make sure it

‎parse.y‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ static char *pform_start_block_with_labels(
627627

628628
static PBlock *pform_finish_block(const YYLTYPE&block_loc,
629629
const YYLTYPE&end_loc, const char *type,
630-
char *raw_name, char *end_label,
630+
char *raw_name, const char *end_label,
631631
PBlock::BL_TYPE block_type,
632632
procedural_item_list_t *raw_items)
633633
{

‎tgt-vvp/cppcheck.sup‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ nullPointerOutOfMemory:modpath.c:139 // calloc @ 138
2828
nullPointerOutOfMemory:modpath.c:140 // calloc @ 138
2929
nullPointerOutOfMemory:modpath.c:141 // calloc @ 138
3030
nullPointerOutOfMemory:modpath.c:142 // calloc @ 138
31-
nullPointerOutOfMemory:vvp_process.c:2218 // malloc @ 2216
32-
nullPointerOutOfMemory:vvp_process.c:2219 // malloc @ 2216
31+
nullPointerOutOfMemory:vvp_process.c:2290 // malloc @ 2288
32+
nullPointerOutOfMemory:vvp_process.c:2291 // malloc @ 2288
3333
nullPointerOutOfMemory:vvp_scope.c:876 // calloc @ 865
3434
nullPointerOutOfMemory:vvp_scope.c:900 // calloc @ 865
3535
nullPointerOutOfMemory:vvp_scope.c:1094 // calloc @ 1092

‎vvp/cppcheck.sup‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ duplInheritedMember:symbols.h:112
7878
duplicateValueTernary:class_type.cc:268
7979

8080
// cppcheck is wrong this can be true or false
81-
knownConditionTrueFalse:vthread.cc:3625
81+
knownConditionTrueFalse:vthread.cc:3823
8282
knownConditionTrueFalse:vpi_priv.cc:681
8383
knownConditionTrueFalse:vpi_priv.cc:2030
8484

@@ -92,7 +92,7 @@ knownConditionTrueFalse:vthread.cc:3571
9292
duplicateExpression:vpi_signal.cc:1207
9393

9494
// cppcheck does not relize this is deleted[] in the called routine
95-
leakNoVarFunctionCall:compile.cc:508
95+
leakNoVarFunctionCall:compile.cc:522
9696

9797
// Yes, these are not currently initialized in the constructor
9898
// All are added after __vpiSysTaskCall is built
@@ -151,13 +151,13 @@ knownConditionTrueFalse:vpi_modules.cc:118
151151
redundantAssignment:vpi_modules.cc:117
152152

153153
// cppcheck does not undestand the format types match
154-
invalidScanfArgType_int:compile.cc:653
155-
invalidScanfArgType_int:compile.cc:659
156-
invalidScanfArgType_int:compile.cc:665
157-
invalidScanfArgType_int:vthread.cc:4634
158-
invalidScanfArgType_int:vthread.cc:4637
159-
invalidScanfArgType_int:vthread.cc:4640
160-
invalidScanfArgType_int:vthread.cc:4643
154+
invalidScanfArgType_int:compile.cc:667
155+
invalidScanfArgType_int:compile.cc:673
156+
invalidScanfArgType_int:compile.cc:679
157+
invalidScanfArgType_int:vthread.cc:4832
158+
invalidScanfArgType_int:vthread.cc:4835
159+
invalidScanfArgType_int:vthread.cc:4838
160+
invalidScanfArgType_int:vthread.cc:4841
161161

162162
// The new() operator is always used to allocate space for this class and
163163
// pool is defined there.

0 commit comments

Comments
 (0)