]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Cleanup in type support subprograms code
authorPiotr Trojanek <trojanek@adacore.com>
Wed, 4 Jun 2025 10:08:58 +0000 (12:08 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Thu, 3 Jul 2025 08:16:22 +0000 (10:16 +0200)
Code cleanup; semantics is unaffected.

gcc/ada/ChangeLog:

* exp_tss.adb (TSS): Refactor IF condition to make code smaller.
* lib.adb (Increment_Serial_Number, Synchronize_Serial_Number):
Use type of renamed object when creating renaming.
* lib.ads (Unit_Record): Refine subtype of dependency number.

gcc/ada/exp_tss.adb
gcc/ada/lib.adb
gcc/ada/lib.ads

index 89bcd29c5ad7e3178156b28e0bfd7a8ed7e84a11..89af166a654c747a9d64b124a15805c528210eae 100644 (file)
@@ -504,13 +504,9 @@ package body Exp_Tss is
       Subp : Entity_Id;
 
    begin
-      if No (FN) then
-         return Empty;
-
-      elsif No (TSS_Elist (FN)) then
-         return Empty;
-
-      else
+      if Present (FN)
+        and then Present (TSS_Elist (FN))
+      then
          Elmt := First_Elmt (TSS_Elist (FN));
          while Present (Elmt) loop
             if Is_TSS (Node (Elmt), Nam) then
index a727f48c61138ead11b49f61010b067ffddbd246..3fd9540acb3742af9d81236a85ddabd5d939f18d 100644 (file)
@@ -1062,7 +1062,7 @@ package body Lib is
    -----------------------------
 
    function Increment_Serial_Number return Nat is
-      TSN : Int renames Units.Table (Current_Sem_Unit).Serial_Number;
+      TSN : Nat renames Units.Table (Current_Sem_Unit).Serial_Number;
    begin
       TSN := TSN + 1;
       return TSN;
@@ -1223,7 +1223,7 @@ package body Lib is
    -------------------------------
 
    procedure Synchronize_Serial_Number (SN : Nat) is
-      TSN : Int renames Units.Table (Current_Sem_Unit).Serial_Number;
+      TSN : Nat renames Units.Table (Current_Sem_Unit).Serial_Number;
    begin
       --  We should not be trying to synchronize downward
 
index a085aa7f19f99f2d328ae53ab8805eafa3739cc6..928f6f840c87d60ab28a965fc4f8a8dccd553a4c 100644 (file)
@@ -852,7 +852,7 @@ private
       Source_Index           : Source_File_Index;
       Cunit                  : Node_Id;
       Cunit_Entity           : Entity_Id;
-      Dependency_Num         : Int;
+      Dependency_Num         : Nat;
       Ident_String           : Node_Id;
       Main_Priority          : Int;
       Main_CPU               : Int;