summaryrefslogtreecommitdiff
path: root/gcc/ada/par-ch9.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-12 09:10:13 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-12 09:10:13 +0000
commit30e864df6d529a64c380fc365bdc8f9368cf5e51 (patch)
tree34e72a80fb14595699c393795268345a17abec04 /gcc/ada/par-ch9.adb
parent5a80f21c5e77531666ddb20fce50ea8b1663cffc (diff)
downloadgcc-30e864df6d529a64c380fc365bdc8f9368cf5e51.tar.gz
2010-10-12 Robert Dewar <dewar@adacore.com>
* aspects.ads, aspects.adb (Move_Aspects): New procedure. * atree.ads, atree.adb: (New_Copy): Does not copy aspect specifications * sinfo.ads, par-ch3.adb, par-ch6.adb, par-ch7.adb, par-ch9.adb, par-endh.adb, par-ch13.adb, par-ch12.adb: Modify grammar to include aspect specifications. Recognize aspect specifications for all cases * par.adb: Recognize aspect specifications for all cases * sem_ch12.ads, sem_ch12.adb (Copy_Generic_Node): Copies aspect specifications. * sem_ch3.adb (Analyze_Subtype_Declaration): Improve patch to freeze generic actual types (was missing some guards before). * sem_ch9.adb (Analyze_Single_Protected_Declaration): Copy aspects to generated object (Analyze_Single_Task_Declaration): Copy aspects to generated object 2010-10-12 Eric Botcazou <ebotcazou@adacore.com> * usage.adb (usage): Adjust line for -gnatn switch. 2010-10-12 Robert Dewar <dewar@adacore.com> * sem_attr.adb (Eval_Attribute): Only leave change active for aspect spec case. 2010-10-12 Ed Schonberg <schonberg@adacore.com> * sem_ch6.adb (Analyze_Subprogram_Declaration): If this is a declaration of a null procedure resolve the types of the profile of the generated null body now. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165353 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/par-ch9.adb')
-rw-r--r--gcc/ada/par-ch9.adb55
1 files changed, 39 insertions, 16 deletions
diff --git a/gcc/ada/par-ch9.adb b/gcc/ada/par-ch9.adb
index 5b1d6c7bd1f..8914a2f9a1d 100644
--- a/gcc/ada/par-ch9.adb
+++ b/gcc/ada/par-ch9.adb
@@ -40,23 +40,33 @@ package body Ch9 is
function P_Entry_Body_Formal_Part return Node_Id;
function P_Entry_Declaration return Node_Id;
function P_Entry_Index_Specification return Node_Id;
- function P_Protected_Definition return Node_Id;
function P_Protected_Operation_Declaration_Opt return Node_Id;
function P_Protected_Operation_Items return List_Id;
- function P_Task_Definition return Node_Id;
function P_Task_Items return List_Id;
+ function P_Protected_Definition (Decl : Node_Id) return Node_Id;
+ -- Parses protected definition and following aspect specifications if
+ -- present. The argument is the declaration node to which the aspect
+ -- specifications are to be attached.
+
+ function P_Task_Definition (Decl : Node_Id) return Node_Id;
+ -- Parses task definition and following aspect specifications if present.
+ -- The argument is the declaration node to which the aspect specifications
+ -- are to be attached.
+
-----------------------------
-- 9.1 Task (also 10.1.3) --
-----------------------------
-- TASK_TYPE_DECLARATION ::=
-- task type DEFINING_IDENTIFIER [KNOWN_DISCRIMINANT_PART]
- -- [is [new INTERFACE_LIST with] TASK_DEFINITION];
+ -- [is [new INTERFACE_LIST with] TASK_DEFINITION]
+ -- [ASPECT_SPECIFICATIONS];
-- SINGLE_TASK_DECLARATION ::=
-- task DEFINING_IDENTIFIER
- -- [is [new INTERFACE_LIST with] TASK_DEFINITION];
+ -- [is [new INTERFACE_LIST with] TASK_DEFINITION]
+ -- [ASPECT_SPECIFICATIONS];
-- TASK_BODY ::=
-- task body DEFINING_IDENTIFIER is
@@ -143,10 +153,17 @@ package body Ch9 is
end if;
end if;
+ -- If we have aspect definitions present here, then we do not have
+ -- a task definition present.
+
+ if Aspect_Specifications_Present then
+ P_Aspect_Specifications (Task_Node);
+
-- Parse optional task definition. Note that P_Task_Definition scans
- -- out the semicolon as well as the task definition itself.
+ -- out the semicolon and possible aspect specifications as well as
+ -- the task definition itself.
- if Token = Tok_Semicolon then
+ elsif Token = Tok_Semicolon then
-- A little check, if the next token after semicolon is
-- Entry, then surely the semicolon should really be IS
@@ -156,10 +173,13 @@ package body Ch9 is
if Token = Tok_Entry then
Error_Msg_SP -- CODEFIX
("|"";"" should be IS");
- Set_Task_Definition (Task_Node, P_Task_Definition);
+ Set_Task_Definition (Task_Node, P_Task_Definition (Task_Node));
else
Pop_Scope_Stack; -- Remove unused entry
end if;
+
+ -- Here we have a task definition
+
else
TF_Is; -- must have IS if no semicolon
@@ -194,7 +214,7 @@ package body Ch9 is
end if;
end if;
- Set_Task_Definition (Task_Node, P_Task_Definition);
+ Set_Task_Definition (Task_Node, P_Task_Definition (Task_Node));
end if;
return Task_Node;
@@ -233,7 +253,7 @@ package body Ch9 is
-- Error recovery: cannot raise Error_Resync
- function P_Task_Definition return Node_Id is
+ function P_Task_Definition (Decl : Node_Id) return Node_Id is
Def_Node : Node_Id;
begin
@@ -253,7 +273,7 @@ package body Ch9 is
end loop;
end if;
- End_Statements (Def_Node);
+ End_Statements (Def_Node, Decl);
return Def_Node;
end P_Task_Definition;
@@ -347,11 +367,13 @@ package body Ch9 is
-- PROTECTED_TYPE_DECLARATION ::=
-- protected type DEFINING_IDENTIFIER [KNOWN_DISCRIMINANT_PART]
- -- is [new INTERFACE_LIST with] PROTECTED_DEFINITION;
+ -- is [new INTERFACE_LIST with] PROTECTED_DEFINITION
+ -- [ASPECT_SPECIFICATIONS];
-- SINGLE_PROTECTED_DECLARATION ::=
-- protected DEFINING_IDENTIFIER
-- is [new INTERFACE_LIST with] PROTECTED_DEFINITION;
+ -- [ASPECT_SPECIFICATIONS];
-- PROTECTED_BODY ::=
-- protected body DEFINING_IDENTIFIER is
@@ -464,8 +486,8 @@ package body Ch9 is
End_Label => Empty));
SIS_Entry_Active := False;
- End_Statements (Protected_Definition (Protected_Node));
- Scan; -- past semicolon
+ End_Statements
+ (Protected_Definition (Protected_Node), Protected_Node);
return Protected_Node;
end if;
@@ -503,7 +525,8 @@ package body Ch9 is
Scan; -- past WITH
end if;
- Set_Protected_Definition (Protected_Node, P_Protected_Definition);
+ Set_Protected_Definition
+ (Protected_Node, P_Protected_Definition (Protected_Node));
return Protected_Node;
end if;
end P_Protected;
@@ -538,7 +561,7 @@ package body Ch9 is
-- Error recovery: cannot raise Error_Resync
- function P_Protected_Definition return Node_Id is
+ function P_Protected_Definition (Decl : Node_Id) return Node_Id is
Def_Node : Node_Id;
Item_Node : Node_Id;
@@ -584,7 +607,7 @@ package body Ch9 is
end loop Declaration_Loop;
end loop Private_Loop;
- End_Statements (Def_Node);
+ End_Statements (Def_Node, Decl);
return Def_Node;
end P_Protected_Definition;