diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2024-05-10 17:11:24 +0200 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2024-06-14 09:34:18 +0200 |
commit | 34935c45c6e13093f9e2c2b1bc36483818152e9c (patch) | |
tree | 0359fe1c3102d63a1cbb8835ce6278d30c91a343 /gcc/ada | |
parent | 02263316169d4299df24ef91b4d469d3a3d50220 (diff) | |
download | gcc-34935c45c6e13093f9e2c2b1bc36483818152e9c.zip gcc-34935c45c6e13093f9e2c2b1bc36483818152e9c.tar.gz gcc-34935c45c6e13093f9e2c2b1bc36483818152e9c.tar.bz2 |
ada: Minor tweaks to processing of Aggregate aspect
The main one is to give the error for Aggregate applied to array types from
Analyze_Aspects_At_Freeze_Point instead of Check_Aspect_At_Freeze_Point, as
for the other aspects. The message is also changed to be more direct.
gcc/ada/
* aspects.ads (Operational_Aspect): Alphabetize.
* sem_ch13.ads (Analyze_Aspects_At_Freeze_Point): Fix description.
* sem_ch13.adb (Analyze_Aspects_At_Freeze_Point) <Aggregate>: Give
the error for array types here instead of...
(Analyze_Aspect_Specifications) <Aggregate>: Adjust comment.
(Check_Aspect_At_Freeze_Point) <Aggregate>: ...here.
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/aspects.ads | 4 | ||||
-rw-r--r-- | gcc/ada/sem_ch13.adb | 17 | ||||
-rw-r--r-- | gcc/ada/sem_ch13.ads | 9 |
3 files changed, 15 insertions, 15 deletions
diff --git a/gcc/ada/aspects.ads b/gcc/ada/aspects.ads index 3cc62de..1acbec8 100644 --- a/gcc/ada/aspects.ads +++ b/gcc/ada/aspects.ads @@ -325,12 +325,12 @@ package Aspects is -- List is currently incomplete ??? Operational_Aspect : constant array (Aspect_Id) of Boolean := - (Aspect_Constant_Indexing => True, + (Aspect_Aggregate => True, + Aspect_Constant_Indexing => True, Aspect_Default_Iterator => True, Aspect_Iterator_Element => True, Aspect_Iterable => True, Aspect_Variable_Indexing => True, - Aspect_Aggregate => True, others => False); -- The following array indicates aspects for which multiple occurrences of diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 46a359f..caebe2e 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -1367,7 +1367,11 @@ package body Sem_Ch13 is Validate_Storage_Model_Type_Aspect (E, ASN); when Aspect_Aggregate => - null; + if Is_Array_Type (E) then + Error_Msg_N + ("aspect Aggregate may not be applied to array type", + ASN); + end if; when others => null; @@ -1384,7 +1388,7 @@ package body Sem_Ch13 is Next_Rep_Item (ASN); end loop; - -- Make a second pass for a Full_Access_Only entry + -- Make a second pass for a Full_Access_Only entry, see above why ASN := First_Rep_Item (E); while Present (ASN) loop @@ -4130,8 +4134,8 @@ package body Sem_Ch13 is end if; when Aspect_Aggregate => - -- We will be checking that the aspect is not specified on a - -- non-array type in Check_Aspect_At_Freeze_Point + -- We will be checking that the aspect is not specified on + -- an array type in Analyze_Aspects_At_Freeze_Point. Validate_Aspect_Aggregate (Expr); @@ -11378,11 +11382,6 @@ package body Sem_Ch13 is return; when Aspect_Aggregate => - if Is_Array_Type (Entity (ASN)) then - Error_Msg_N - ("aspect& can only be applied to non-array type", - Ident); - end if; Resolve_Aspect_Aggregate (Entity (ASN), Expression (ASN)); return; diff --git a/gcc/ada/sem_ch13.ads b/gcc/ada/sem_ch13.ads index 2bdca95..aeacda8 100644 --- a/gcc/ada/sem_ch13.ads +++ b/gcc/ada/sem_ch13.ads @@ -312,10 +312,11 @@ package Sem_Ch13 is -- Quite an awkward approach, but this is an awkard requirement procedure Analyze_Aspects_At_Freeze_Point (E : Entity_Id); - -- Analyzes all the delayed aspects for entity E at freezing point. This - -- includes dealing with inheriting delayed aspects from the parent type - -- in the case where a derived type is frozen. Callers should check that - -- Has_Delayed_Aspects (E) is True before calling this routine. + -- Analyzes all the delayed aspects for entity E at the freeze point. Note + -- that this does not include dealing with inheriting delayed aspects from + -- the parent or base type in the case where a derived type or a subtype is + -- frozen. Callers should check that Has_Delayed_Aspects (E) is True before + -- calling this routine. procedure Check_Aspects_At_End_Of_Declarations (E : Entity_Id); -- Performs the processing described above at the freeze all point, and |