[Ada] Refactor repeated code for size attributes
authorPiotr Trojanek <trojanek@adacore.com>
Mon, 23 Nov 2020 23:05:44 +0000 (00:05 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Tue, 15 Dec 2020 11:41:52 +0000 (06:41 -0500)
gcc/ada/

* sem_attr.adb (Analyze_Attribute): Merge identical code for
Size, Object_Size and Value_Size attributes.

gcc/ada/sem_attr.adb

index 0771961..308e5cf 100644 (file)
@@ -4766,7 +4766,10 @@ package body Sem_Attr is
       -- Machine_Size --
       ------------------
 
-      when Attribute_Machine_Size =>
+      when Attribute_Machine_Size
+         | Attribute_Object_Size
+         | Attribute_Value_Size
+      =>
          Check_E0;
          Check_Type;
          Check_Not_Incomplete_Type;
@@ -4993,11 +4996,7 @@ package body Sem_Attr is
       -- Object_Size --
       -----------------
 
-      when Attribute_Object_Size =>
-         Check_E0;
-         Check_Type;
-         Check_Not_Incomplete_Type;
-         Set_Etype (N, Universal_Integer);
+      --  Shares processing with Machine_Size attribute
 
       ---------
       -- Old --
@@ -7161,11 +7160,7 @@ package body Sem_Attr is
       -- Value_Size --
       ----------------
 
-      when Attribute_Value_Size =>
-         Check_E0;
-         Check_Type;
-         Check_Not_Incomplete_Type;
-         Set_Etype (N, Universal_Integer);
+      --  Shares processing with Machine_Size attribute
 
       -------------
       -- Version --