]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
a68: remove superfluous code detected by cppcheck [PR algol68/122954]
authorJose E. Marchesi <jose.marchesi@oracle.com>
Tue, 2 Dec 2025 10:06:45 +0000 (11:06 +0100)
committerJose E. Marchesi <jose.marchesi@oracle.com>
Tue, 2 Dec 2025 10:09:08 +0000 (11:09 +0100)
This commits fixes three instances of harmless but redundant code,
detected by cppcheck.

gcc/algol68/ChangeLog

PR algol68/122954
* a68-low-clauses.cc (serial_clause_dsa): Avoid redundant
initialization.
* a68-parser-modes.cc (compute_derived_modes): Likewise.
* a68-low.cc (a68_lower_tree): Remove redundant break.

gcc/algol68/a68-low-clauses.cc
gcc/algol68/a68-low.cc
gcc/algol68/a68-parser-modes.cc

index 77e07b1121b163f507e0da0fabd79119de3cb84f..8cc81500b237be8369a87fc168d9732ba27e4dd9 100644 (file)
@@ -58,9 +58,7 @@
 static bool
 serial_clause_dsa (NODE_T *p)
 {
-  NODE_T *s = NEXT (SUB (p));
-
-  for (s = p; SUB (s) &&  IS (s, SERIAL_CLAUSE); s = SUB (s))
+  for (NODE_T *s = p; SUB (s) &&  IS (s, SERIAL_CLAUSE); s = SUB (s))
     {
       if (DYNAMIC_STACK_ALLOCS (s))
        return true;
index 109620248fb171f271b2a616152e9f2a92fc45bf..ac603ef13e79731bcc0bfe250909ae5d1a02c92d 100644 (file)
@@ -1479,7 +1479,6 @@ a68_lower_tree (NODE_T *p, LOW_CTX_T ctx)
     case PACKET:
       res = lower_packet (p, ctx);
       break;
-      break;
     case PRELUDE_PACKET:
       res = lower_prelude_packet (p, ctx);
       break;
index 4a0128667ca0b4ead5b680f6042bbf345d40519e..83f40a0615a77164278b7d09e6ce9c059057e665 100644 (file)
@@ -1202,10 +1202,9 @@ compute_derived_modes (MODULE_T *mod)
 
          for (; s != NO_PACK; FORWARD (s))
            {
-             PACK_T *t = NEXT (s);
              bool x = true;
 
-             for (t = NEXT (s); t != NO_PACK && x; FORWARD (t))
+             for (PACK_T *t = NEXT (s); t != NO_PACK && x; FORWARD (t))
                {
                  if (TEXT (s) == TEXT (t))
                    {