https://gcc.gnu.org/g:f90851a93c921babd092551eda1e70718e6494fb

commit r15-1262-gf90851a93c921babd092551eda1e70718e6494fb
Author: Piotr Trojanek <troja...@adacore.com>
Date:   Tue Apr 23 14:37:54 2024 +0200

    ada: Simplify checks for Address and Object_Size clauses
    
    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.

Diff:
---
 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 e43e96905e9d..75635622c89d 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 34aef4345013..32b3333c1570 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 cbe2ef8be543..633e1367aee8 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

Reply via email to