aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2024-04-23 14:37:54 +0200
committerMarc Poulhiès <poulhies@adacore.com>2024-06-13 15:30:28 +0200
commitf90851a93c921babd092551eda1e70718e6494fb (patch)
tree4f62808dd7cf6b9bacfc6cc233c2c4eff991de67
parent22085d1900b9c3e214f837a5549e9c9c56a69b99 (diff)
downloadgcc-f90851a93c921babd092551eda1e70718e6494fb.zip
gcc-f90851a93c921babd092551eda1e70718e6494fb.tar.gz
gcc-f90851a93c921babd092551eda1e70718e6494fb.tar.bz2
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.
-rw-r--r--gcc/ada/layout.adb4
-rw-r--r--gcc/ada/sem_ch13.adb4
-rw-r--r--gcc/ada/sem_ch3.adb3
3 files changed, 4 insertions, 7 deletions
diff --git a/gcc/ada/layout.adb b/gcc/ada/layout.adb
index e43e969..7563562 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 34aef43..32b3333 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 cbe2ef8..633e136 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