[Ada] Refactor repeated code for real type attributes returning integers
authorPiotr Trojanek <trojanek@adacore.com>
Mon, 23 Nov 2020 22:30:32 +0000 (23:30 +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_Radix and Mantissa attributes.

gcc/ada/sem_attr.adb

index 7b6c66c4b4a438ffe1fe4b720c3d64c57d727958..30fdfb8c55d62e5fff3e849a0612580654284770 100644 (file)
@@ -4744,7 +4744,9 @@ package body Sem_Attr is
       -- Machine_Radix --
       -------------------
 
-      when Attribute_Machine_Radix =>
+      when Attribute_Machine_Radix
+         | Attribute_Mantissa
+      =>
          Check_Real_Type;
          Check_E0;
          Set_Etype (N, Universal_Integer);
@@ -4775,10 +4777,7 @@ package body Sem_Attr is
       -- Mantissa --
       --------------
 
-      when Attribute_Mantissa =>
-         Check_E0;
-         Check_Real_Type;
-         Set_Etype (N, Universal_Integer);
+      --  Shares processing with Machine_Radix attribute
 
       ---------
       -- Max --