From: Piotr Trojanek <troja...@adacore.com>

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.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/layout.adb   | 4 ++--
 gcc/ada/sem_ch13.adb | 4 +---
 gcc/ada/sem_ch3.adb  | 3 +--
 3 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/gcc/ada/layout.adb b/gcc/ada/layout.adb
index e43e96905e9..75635622c89 100644
--- a/gcc/ada/layout.adb
+++ b/gcc/ada/layout.adb
@@ -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
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index 34aef434501..32b3333c157 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -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;
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index cbe2ef8be54..633e1367aee 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -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
-- 
2.45.1

Reply via email to