From: Piotr Trojanek <troja...@adacore.com>

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.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 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 89bcd29c5ad..89af166a654 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 a727f48c611..3fd9540acb3 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 a085aa7f19f..928f6f840c8 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;
-- 
2.43.0

Reply via email to