[Ada] Refactor repeated code for real type attributes returning booleans
authorPiotr Trojanek <trojanek@adacore.com>
Mon, 23 Nov 2020 22:28:46 +0000 (23:28 +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
Machine_Overflows and Machine_Rounds attributes.

gcc/ada/sem_attr.adb

index 1eb4b81bcb5224d77cd8a85cc3253713145bf3f5..7b6c66c4b4a438ffe1fe4b720c3d64c57d727958 100644 (file)
@@ -4733,7 +4733,9 @@ package body Sem_Attr is
       -- Machine_Overflows --
       -----------------------
 
-      when Attribute_Machine_Overflows =>
+      when Attribute_Machine_Overflows
+         | Attribute_Machine_Rounds
+      =>
          Check_Real_Type;
          Check_E0;
          Set_Etype (N, Standard_Boolean);
@@ -4757,10 +4759,7 @@ package body Sem_Attr is
       -- Machine_Rounds --
       --------------------
 
-      when Attribute_Machine_Rounds =>
-         Check_Real_Type;
-         Check_E0;
-         Set_Etype (N, Standard_Boolean);
+      --  Shares processing with Machine_Overflows attribute
 
       ------------------
       -- Machine_Size --