From: Ghjuvan Lacambre Date: Wed, 18 Nov 2020 10:23:05 +0000 (+0100) Subject: [Ada] Implement AI12-0398-1/03 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9189557557feb9439d6ab0aff2b8dbedea97a15a;p=gcc.git [Ada] Implement AI12-0398-1/03 gcc/ada/ * par-ch3.adb (P_Discriminant_Part_Opt): Parse aspects, update documentation. * par-ch6.adb (P_Return_Statement): Likewise. * par-ch9.adb (P_Entry_Index_Specification): Likewise. --- diff --git a/gcc/ada/par-ch3.adb b/gcc/ada/par-ch3.adb index 017a0a1abf8..5a993bf2b1c 100644 --- a/gcc/ada/par-ch3.adb +++ b/gcc/ada/par-ch3.adb @@ -3002,9 +3002,9 @@ package body Ch3 is -- DISCRIMINANT_SPECIFICATION ::= -- DEFINING_IDENTIFIER_LIST : [NULL_EXCLUSION] SUBTYPE_MARK - -- [:= DEFAULT_EXPRESSION] + -- [:= DEFAULT_EXPRESSION] [ASPECT_SPECIFICATION] -- | DEFINING_IDENTIFIER_LIST : ACCESS_DEFINITION - -- [:= DEFAULT_EXPRESSION] + -- [:= DEFAULT_EXPRESSION] [ASPECT_SPECIFICATION] -- If no known discriminant part is present, then No_List is returned @@ -3098,6 +3098,10 @@ package body Ch3 is Set_Expression (Specification_Node, Init_Expr_Opt (True)); + if Token = Tok_With then + P_Aspect_Specifications (Specification_Node, False); + end if; + if Ident > 1 then Set_Prev_Ids (Specification_Node, True); end if; diff --git a/gcc/ada/par-ch6.adb b/gcc/ada/par-ch6.adb index 0fcd23ab914..f65c6f6f815 100644 --- a/gcc/ada/par-ch6.adb +++ b/gcc/ada/par-ch6.adb @@ -1770,7 +1770,8 @@ package body Ch6 is -- -- EXTENDED_RETURN_STATEMENT ::= -- return DEFINING_IDENTIFIER : [aliased] RETURN_SUBTYPE_INDICATION - -- [:= EXPRESSION] [do + -- [:= EXPRESSION] + -- [ASPECT_SPECIFICATION] [do -- HANDLED_SEQUENCE_OF_STATEMENTS -- end return]; -- @@ -1916,6 +1917,7 @@ package body Ch6 is Ret_Sloc : constant Source_Ptr := Token_Ptr; Ret_Strt : constant Column_Number := Start_Column; Ret_Node : Node_Id; + Decl : Node_Id; -- Start of processing for P_Return_Statement @@ -1955,8 +1957,12 @@ package body Ch6 is end if; Ret_Node := New_Node (N_Extended_Return_Statement, Ret_Sloc); - Set_Return_Object_Declarations - (Ret_Node, New_List (P_Return_Object_Declaration)); + Decl := P_Return_Object_Declaration; + Set_Return_Object_Declarations (Ret_Node, New_List (Decl)); + + if Token = Tok_With then + P_Aspect_Specifications (Decl, False); + end if; if Token = Tok_Do then Push_Scope_Stack; diff --git a/gcc/ada/par-ch9.adb b/gcc/ada/par-ch9.adb index 2672e52d525..7877adcd228 100644 --- a/gcc/ada/par-ch9.adb +++ b/gcc/ada/par-ch9.adb @@ -1316,6 +1316,7 @@ package body Ch9 is -- ENTRY_INDEX_SPECIFICATION ::= -- for DEFINING_IDENTIFIER in DISCRETE_SUBTYPE_DEFINITION + -- [ASPECT_SPECIFICATION] -- Error recovery: can raise Error_Resync @@ -1329,6 +1330,11 @@ package body Ch9 is T_In; Set_Discrete_Subtype_Definition (Iterator_Node, P_Discrete_Subtype_Definition); + + if Token = Tok_With then + P_Aspect_Specifications (Iterator_Node, False); + end if; + return Iterator_Node; end P_Entry_Index_Specification;