https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122954
Bug ID: 122954
Summary: algol68, meet cppcheck
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: algol68
Assignee: algol68 at gcc dot gnu.org
Reporter: dcb314 at hotmail dot com
Target Milestone: ---
Created attachment 62966
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=62966&action=edit
a list of small performance problems
As is usual with any new gcc language, I let cppcheck
have a look at the source code.
I found the following:
1.
trunk/gcc/algol68/a68-low.cc:1482:7: style: Consecutive return, break,
continue, goto or throw statements are unnecessary. [duplicateBreak]
Source code is
case PACKET:
res = lower_packet (p, ctx);
break;
break;
2.
trunk/gcc/algol68/a68-low-clauses.cc:63:10: style: Redundant initialization for
's'. The initialized value is overwritten before it is read.
[redundantInitialization]
NODE_T *s = NEXT (SUB (p));
for (s = p; SUB (s) && IS (s, SERIAL_CLAUSE); s = SUB (s))
3.
trunk/gcc/algol68/a68-parser-modes.cc:1208:15: style: Redundant initialization
for 't'. The initialized value is overwritten before it is read.
[redundantInitialization]
PACK_T *t = NEXT (s);
bool x = true;
for (t = NEXT (s); t != NO_PACK && x; FORWARD (t))
4.
trunk/gcc/algol68/a68-parser-moids-equivalence.cc:109:15: style: Return value
'a==b' is always false [knownConditionTrueFalse]
else if (IS (a, STANDARD))
return (a == b);
Earlier in the chain is
else if (a == b)
return true;
There were also 154 occurrences of this type of message:
trunk/gcc/algol68/a68-low.cc:1189:41: performance: Function parameter 'ctx'
should be passed by const reference. [passedByValue]
I have attached a file of these.