diff options
author | Bob Duff <duff@adacore.com> | 2024-01-09 07:59:22 -0500 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2024-05-07 09:55:53 +0200 |
commit | ceaae63a4b4bae36eb2b693ee862f91267dfb62a (patch) | |
tree | f6db50b3f53960e46e55ee274ec1b5df04696ef9 /gcc/ada/aspects.adb | |
parent | 8a116c6539b044ec20bd9fd604887a0a2e21a10e (diff) | |
download | gcc-ceaae63a4b4bae36eb2b693ee862f91267dfb62a.zip gcc-ceaae63a4b4bae36eb2b693ee862f91267dfb62a.tar.gz gcc-ceaae63a4b4bae36eb2b693ee862f91267dfb62a.tar.bz2 |
ada: Aspects on multiple component declarations
This patch fixes a bug where aspect specifications were ignored
on all but the last of multiple component declarations.
For example, in a record type with components "X, Y: T with Volatile;"
only Y was marked Volatile; X was not. Both should be marked Volatile.
The fix is in Par.Ch3.P_Component_Items, where P_Aspect_Specifications
needs to be called each time through the loop.
In addition, various minor cleanups.
gcc/ada/
* par-ch3.adb (P_Component_Items): Move P_Aspect_Specifications
into the loop, so aspects can be attached to multiple component
declarations.
(P_Type_Declaration, P_Subtype_Declaration)
(P_Known_Discriminant_Part_Opt): Remove default for Semicolon in
calls to P_Aspect_Specifications.
* gen_il-gen-gen_nodes.adb (N_Discriminant_Specification): Add
Aspect_Specifications field to N_Discriminant_Specification, which
was missing.
* aspects.adb (Has_Aspect_Specifications_Flag): Make it True for
N_Discriminant_Specification.
* par-ch13.adb: Remove default for Semicolon in calls to
P_Aspect_Specifications.
(Get_Aspect_Specifications): Misc cleanup.
(P_Aspect_Specifications): Remove comment. It's not clear what
"the flag" is referring to, but anyway the first part of the
comment is obvious, and the second part is apparently obsolete.
Misc cleanup.
* par.adb (P_Aspect_Specifications, Get_Aspect_Specifications):
Remove default for Semicolon; calls are more readable that way.
Improve comments.
* par-ch12.adb: Remove default for Semicolon in calls to
P_Aspect_Specifications.
* par-ch6.adb: Likewise.
* par-ch7.adb: Likewise.
* par-ch9.adb: Likewise.
* par-endh.adb: Likewise.
Diffstat (limited to 'gcc/ada/aspects.adb')
-rw-r--r-- | gcc/ada/aspects.adb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/ada/aspects.adb b/gcc/ada/aspects.adb index 0d4988a..696ee67 100644 --- a/gcc/ada/aspects.adb +++ b/gcc/ada/aspects.adb @@ -450,6 +450,7 @@ package body Aspects is Has_Aspect_Specifications_Flag : constant array (Node_Kind) of Boolean := (N_Abstract_Subprogram_Declaration => True, N_Component_Declaration => True, + N_Discriminant_Specification => True, N_Entry_Body => True, N_Entry_Declaration => True, N_Exception_Declaration => True, @@ -471,8 +472,8 @@ package body Aspects is N_Package_Body_Stub => True, N_Package_Declaration => True, N_Package_Instantiation => True, - N_Package_Specification => True, N_Package_Renaming_Declaration => True, + N_Package_Specification => True, N_Parameter_Specification => True, N_Private_Extension_Declaration => True, N_Private_Type_Declaration => True, |