]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix code quality issue in table.adb
authorViljar Indus <indus@adacore.com>
Tue, 22 Jul 2025 07:17:59 +0000 (10:17 +0300)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Mon, 4 Aug 2025 13:04:09 +0000 (15:04 +0200)
gcc/ada/ChangeLog:

* table.adb (Max): Move variable to the body and initialize
it with the same value as in the Init function.
* table.ads (Max): Likewise.

gcc/ada/table.adb
gcc/ada/table.ads

index 37c49494197c7f8b1dbb012628a575db6d54d113..31891de87db4378d1c94320d0c2033e33c1f5057 100644 (file)
@@ -40,6 +40,9 @@ package body Table is
       Min : constant Int := Int (Table_Low_Bound);
       --  Subscript of the minimum entry in the currently allocated table
 
+      Max : Int := Min + (Table_Initial * Table_Factor) - 1;
+      --  Subscript of the maximum entry in the currently allocated table
+
       Length : Int := 0;
       --  Number of entries in currently allocated table. The value of zero
       --  ensures that we initially allocate the table.
index 22e9172bc480a042a8729629a7d41a9acabd72cf..623ce14711b927bc559f2a5ed8723ae1380c8f6d 100644 (file)
@@ -223,9 +223,6 @@ package Table is
       --  the official interfaces (since a modification to Last may require a
       --  reallocation of the table).
 
-      Max : Int;
-      --  Subscript of the maximum entry in the currently allocated table
-
       type Saved_Table is record
          Last_Val : Int;
          Max      : Int;