https://gcc.gnu.org/g:2bf031a5ac1927108185f8f3d4396d6d97967a7e

commit r16-1933-g2bf031a5ac1927108185f8f3d4396d6d97967a7e
Author: Piotr Trojanek <troja...@adacore.com>
Date:   Wed Jun 4 12:08:58 2025 +0200

    ada: Cleanup in type support subprograms code
    
    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.

Diff:
---
 gcc/ada/exp_tss.adb | 10 +++-------
 gcc/ada/lib.adb     |  4 ++--
 gcc/ada/lib.ads     |  2 +-
 3 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/gcc/ada/exp_tss.adb b/gcc/ada/exp_tss.adb
index 89bcd29c5ad7..89af166a654c 100644
--- a/gcc/ada/exp_tss.adb
+++ b/gcc/ada/exp_tss.adb
@@ -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
diff --git a/gcc/ada/lib.adb b/gcc/ada/lib.adb
index a727f48c6113..3fd9540acb37 100644
--- a/gcc/ada/lib.adb
+++ b/gcc/ada/lib.adb
@@ -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
 
diff --git a/gcc/ada/lib.ads b/gcc/ada/lib.ads
index a085aa7f19f9..928f6f840c87 100644
--- a/gcc/ada/lib.ads
+++ b/gcc/ada/lib.ads
@@ -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;

Reply via email to