[Ada] Refactor repeated code for real type attributes returning reals
authorPiotr Trojanek <trojanek@adacore.com>
Mon, 23 Nov 2020 22:27:21 +0000 (23:27 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Tue, 15 Dec 2020 11:41:51 +0000 (06:41 -0500)
gcc/ada/

* sem_attr.adb (Analyze_Attribute): Merge identical code for
Large, Small, Safe_Large and Safe_Small attributes.

gcc/ada/sem_attr.adb

index 2e19bf69b41d8c1426aa9a61572a33915ed3bee5..1eb4b81bcb5224d77cd8a85cc3253713145bf3f5 100644 (file)
@@ -4308,7 +4308,11 @@ package body Sem_Attr is
       -- Large --
       -----------
 
-      when Attribute_Large =>
+      when Attribute_Large
+         | Attribute_Small
+         | Attribute_Safe_Large
+         | Attribute_Safe_Small
+      =>
          Check_E0;
          Check_Real_Type;
          Set_Etype (N, Universal_Real);
@@ -5850,10 +5854,7 @@ package body Sem_Attr is
       -- Safe_Large --
       ----------------
 
-      when Attribute_Safe_Large =>
-         Check_E0;
-         Check_Real_Type;
-         Set_Etype (N, Universal_Real);
+      --  Shares processing with Large attribute
 
       ---------------
       -- Safe_Last --
@@ -5865,10 +5866,7 @@ package body Sem_Attr is
       -- Safe_Small --
       ----------------
 
-      when Attribute_Safe_Small =>
-         Check_E0;
-         Check_Real_Type;
-         Set_Etype (N, Universal_Real);
+      --  Shares processing with Large attribute
 
       --------------------------
       -- Scalar_Storage_Order --
@@ -6033,10 +6031,7 @@ package body Sem_Attr is
       -- Small --
       -----------
 
-      when Attribute_Small =>
-         Check_E0;
-         Check_Real_Type;
-         Set_Etype (N, Universal_Real);
+      --  Shares processing with Large attribute
 
       ---------------------------------------
       -- Small_Denominator/Small_Numerator --