diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2012-11-06 10:44:51 +0100 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2012-11-06 10:44:51 +0100 |
commit | 6bc057a79e2cef15d7dfd1170c1043cb0f271b04 (patch) | |
tree | a6504859fca4e60b28f22d72a2d374e0cfd7e0a9 /gcc/ada/par-ch4.adb | |
parent | 3c55062f3030f6dcd365f89ba9ecfea2131889b4 (diff) | |
download | gcc-6bc057a79e2cef15d7dfd1170c1043cb0f271b04.zip gcc-6bc057a79e2cef15d7dfd1170c1043cb0f271b04.tar.gz gcc-6bc057a79e2cef15d7dfd1170c1043cb0f271b04.tar.bz2 |
[multiple changes]
2012-11-06 Thomas Quinot <quinot@adacore.com>
* s-oscons-tmplt.c: Interfaces.C now needs to be WITH'd even
on platforms that do not support sockets (for the benefit of
subtype IOCTL_Req_T).
2012-11-06 Ed Schonberg <schonberg@adacore.com>
* par-ch4.adb (P_Primary): if-expressions, case-expressions,
and quantified expressions are legal if surrounded by parentheses
from an enclosing context, such as a call or an instantiation.
2012-11-06 Yannick Moy <moy@adacore.com>
* impunit.adb (Get_Kind_Of_Unit): Return appropriate kind for
predefined implementation files, instead of returning
Not_Predefined_Unit on all .adb files.
2012-11-06 Tristan Gingold <gingold@adacore.com>
* exp_ch9.adb (Build_Activation_Chain_Entity): Return immediately if
partition elaboration policy is sequential.
(Build_Task_Activation_Call): Likewise. Use
Activate_Restricted_Tasks on restricted profile.
(Make_Task_Create_Call): Do not use the _Chain
parameter if elaboration policy is sequential. Call
Create_Restricted_Task_Sequential in that case.
* exp_ch3.adb (Build_Initialization_Call): Change condition to
support concurrent elaboration policy.
(Build_Record_Init_Proc): Likewise.
(Init_Formals): Likewise.
* bindgen.adb (Gen_Adainit): Declare Partition_Elaboration_Policy
and set it in generated code if the elaboration policy is
sequential. The procedure called to activate all tasks is now
named __gnat_activate_all_tasks.
* rtsfind.adb (RE_Activate_Restricted_Task,
RE_Create_Restricted_Task_Sequential): New RE_Id literals.
* s-tarest.adb (Create_Restricted_Task): Added to create a task without
adding it on an activation chain.
(Activate_Tasks): Has now a Chain parameter.
(Activate_All_Tasks_Sequential): Added. Called by the binder to
activate all tasks.
(Activate_Restricted_Tasks): Added. Called during elaboration to
activate tasks of the units.
* s-tarest.ads: Remove pragma Partition_Elaboration_Policy.
(Partition_Elaboration_Policy): New variable (set by the binder).
(Create_Restricted_Task): Revert removal of the chain parameter.
(Create_Restricted_Task_Sequential): New procedure.
(Activate_Restricted_Tasks): Revert removal.
(Activate_All_Tasks_Sequential): New procedure.
From-SVN: r193214
Diffstat (limited to 'gcc/ada/par-ch4.adb')
-rw-r--r-- | gcc/ada/par-ch4.adb | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/gcc/ada/par-ch4.adb b/gcc/ada/par-ch4.adb index 352feea..c3a7a4a 100644 --- a/gcc/ada/par-ch4.adb +++ b/gcc/ada/par-ch4.adb @@ -2359,6 +2359,8 @@ package body Ch4 is -- Error recovery: can raise Error_Resync function P_Primary return Node_Id is + Lparen : constant Boolean := Prev_Token = Tok_Left_Paren; + Scan_State : Saved_Scan_State; Node1 : Node_Id; @@ -2475,11 +2477,18 @@ package body Ch4 is return Error; -- If this looks like an if expression, then treat it that way - -- with an error message. + -- with an error message if not explicitly surrounded by + -- parentheses. elsif Ada_Version >= Ada_2012 then - Error_Msg_SC ("if expression must be parenthesized"); - return P_If_Expression; + Node1 := P_If_Expression; + + if not (Lparen and then Token = Tok_Right_Paren) then + Error_Msg + ("if expression must be parenthesized", Sloc (Node1)); + end if; + + return Node1; -- Otherwise treat as misused identifier @@ -2507,11 +2516,17 @@ package body Ch4 is return Error; -- If this looks like a case expression, then treat it that way - -- with an error message. + -- with an error message if not within parentheses. elsif Ada_Version >= Ada_2012 then - Error_Msg_SC ("case expression must be parenthesized"); - return P_Case_Expression; + Node1 := P_Case_Expression; + + if not (Lparen and then Token = Tok_Right_Paren) then + Error_Msg + ("case expression must be parenthesized", Sloc (Node1)); + end if; + + return Node1; -- Otherwise treat as misused identifier @@ -2528,8 +2543,15 @@ package body Ch4 is return Error; elsif Ada_Version >= Ada_2012 then - Error_Msg_SC ("quantified expression must be parenthesized"); - return P_Quantified_Expression; + Node1 := P_Quantified_Expression; + + if not (Lparen and then Token = Tok_Right_Paren) then + Error_Msg + ("quantified expression must be parenthesized", + Sloc (Node1)); + end if; + + return Node1; else |