]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Simplify checks for Address and Object_Size clauses
authorPiotr Trojanek <trojanek@adacore.com>
Tue, 23 Apr 2024 12:37:54 +0000 (14:37 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Thu, 13 Jun 2024 13:30:28 +0000 (15:30 +0200)
Where possible, we can use high-level wrapper routines instead of the
low-level Get_Attribute_Definition_Clause.

Code cleanup; semantics is unaffected.

gcc/ada/

* layout.adb (Layout_Type): Use high-level wrapper routine.
* sem_ch13.adb (Inherit_Delayed_Rep_Aspects): Likewise.
* sem_ch3.adb (Analyze_Object_Declaration): Likewise.

gcc/ada/layout.adb
gcc/ada/sem_ch13.adb
gcc/ada/sem_ch3.adb

index e43e96905e9df43b57c6f4f2446f10ce54069185..75635622c89d9be0304054f4bec45a64efed5ece 100644 (file)
@@ -607,8 +607,8 @@ package body Layout is
                Error_Msg_Uint_1 := RM_Size (E);
                Error_Msg_F
                  ("object size is too small, minimum allowed is ^",
-                  Expression (Get_Attribute_Definition_Clause
-                                             (E, Attribute_Object_Size)));
+                  Expression (Object_Size_Clause (E)));
+
             end if;
 
             --  Adjust Esize up to RM_Size value
index 34aef43450132ad4db7759a89c4f23063549dcba..32b3333c1570f6cd5d146abadb342f2b45a52af5 100644 (file)
@@ -14157,9 +14157,7 @@ package body Sem_Ch13 is
                      | Aspect_Size
                   =>
                      if not Has_Size_Clause (Typ)
-                       and then
-                         No (Get_Attribute_Definition_Clause
-                               (Typ, Attribute_Object_Size))
+                       and then No (Object_Size_Clause (Typ))
                      then
                         Set_Esize (Typ, Esize (P));
                      end if;
index cbe2ef8be543490945ffcc6627b7bb2f7a788fe3..633e1367aee8116d2e09925cb8578c86acf9903f 100644 (file)
@@ -5246,8 +5246,7 @@ package body Sem_Ch3 is
                E := First_Entity (Etype (Id));
                while Present (E) loop
                   if Ekind (E) = E_Entry
-                    and then Present (Get_Attribute_Definition_Clause
-                                        (E, Attribute_Address))
+                    and then Present (Address_Clause (E))
                   then
                      Error_Msg_Warn := SPARK_Mode /= On;
                      Error_Msg_N