aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/par-ch4.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2011-08-30 16:56:45 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2011-08-30 16:56:45 +0200
commitc37cbdc310038863a55e9f4a4669dbba964f289e (patch)
treeb835d16538f8d08c37359d2bcd6b1863c3b2195e /gcc/ada/par-ch4.adb
parentf8dd28d62d1d014c1599b1a345d7bab0ede255ab (diff)
downloadgcc-c37cbdc310038863a55e9f4a4669dbba964f289e.zip
gcc-c37cbdc310038863a55e9f4a4669dbba964f289e.tar.gz
gcc-c37cbdc310038863a55e9f4a4669dbba964f289e.tar.bz2
[multiple changes]
2011-08-30 Jose Ruiz <ruiz@adacore.com> * s-taskin.ads (Common_ATCB): Add field domain which contains the dispatching domain to which the task belongs. * s-taskin.adb (Initialize): Create the default system dispatching domain and make the environment task part of it. * s-mudido.ads: Add this new spec for standard Ada 2012 package Ada.Multiprocessors.Dispatching_Domains. * s-mudido.adb: Add this new body for targets not supporting dispatching domains. * s-mudido-affinity.adb: Add this new body for targets supporting dispatching domains setting the affinity to a CPU set. * bindgen.adb (Dispatching_Domain_Used, Check_Dispatching_Domains_Used, Gen_Adainit): When package System.Multiprocessors.Dispatching_Domains is used we call the procedure to signal that when we are about to call the main subprogram no new dispatching domain can be created. (Check_File_In_Partition): Factor out the common functionality used by Check_System_Restrictions_Used and Check_Dispatching_Domains_Used. * s-tassta.adb (Create_Task): Tasks inherit the dispatching domain of their activators. * s-taprop.ads (Set_Task_Affinity): Add this new procedure to set task affinities. * s-taprop-dummy.adb, s-taprop-hpux-dce.adb, s-taprop-irix.adb, s-taprop-posix.adb, s-taprop-tru64.adb, s-taprop-vms.adb (Set_Task_Affinity): Dummy null body for these targets not supporting task affinities. s-taprop-linux.adb, s-taprop-mingw.adb, s-taprop-solaris.adb, s-taprop-vxworks.adb (Create_Task, Enter_Task, Initialize): Handle dispatching domains and set the affinity of the environment task. (Set_Task_Affinity): Procedure that uses the underlying CPU set functionality to handle dispatching domains, pragma CPU and Task_Info. s-winext.ads (SetThreadAffinityMask): Import this function needed to set CPU masks. * s-osinte-solaris.ads (psetit_t, pset_create, pset_assign, pset_bind): Import the functionality to handle CPU set affinities. * affinity.c: New file. * s-osinte-vxworks.ads, s-vxwext.ads, s-vxwext-kernel.ads, s-vxwext-rtp.ads (taskMaskAffinitySet): Add this new spec for setting affinity masks. * s-vxwext.adb, s-vxwext-kernel.adb, s-vxwext-rtp.adb (taskMaskAffinitySet): Body returning an error indicating that task affinities are not supported. Makefile.rtl: Indicate that s-mudido is part of libgnarl. * gcc-interface/Makefile.in (LIBGNAT_TARGET_PAIRS for VxWorks SMP, Solaris, Windows, and {x86,PowerPC, ia64,x86_64} Linux): Use the s-mudido-affinity.adb body which supports task affinities. 2011-08-30 Thomas quinot <quinot@adacore.com> * sem_ch13.adb: Minor reformatting. 2011-08-30 Vincent Celier <celier@adacore.com> * vms_conv.adb (Process_Argument): When the qualifier /UNCHECKED_SHARED_LIB_IMPORTS is for GNAT COMPILE, do not put the corresponding switch --unchecked-shared-lib-imports after -cargs, as it is for gnatmake, not for the compiler. 2011-08-30 Ed Schonberg <schonberg@adacore.com> * sem_ch4.adb (Analyze_Quantified_Expression): Analyze iterator specification and condition only in Semantics_Only mode. Otherwise the analysis is done after expression has been rewritten as loop. * sem_ch5.adb (Analyze_Iterator_Specification): Always generate a temporary for the iterator name (the domain of iteration) because it may need finalization actions and these must be generated outside of the loop. * sem_res.adb (Resolve_Quantified_Expression): Resolve only in Semantic_Only mode. * exp_ch4.adb (Expand_Quantified_Expression): Analyze and resolve once rewritten as loop. * exp_ch5.adb (Expand_Iterator_Loop): Code clean-up, now that the iterator is always an expression. 2011-08-30 Robert Dewar <dewar@adacore.com> * par-ch4.adb (P_Unparen_Cond_Case_Quant_Expression): New function (P_Expression_If_OK): New spec checks parens (P_Expression_Or_Range_Attribute_If_OK): New spec checks parens * par.adb (P_Expression_If_OK): New spec checks parens (P_Expression_Or_Range_Attribute_If_OK): New spec checks parens From-SVN: r178321
Diffstat (limited to 'gcc/ada/par-ch4.adb')
-rw-r--r--gcc/ada/par-ch4.adb90
1 files changed, 73 insertions, 17 deletions
diff --git a/gcc/ada/par-ch4.adb b/gcc/ada/par-ch4.adb
index f2758ae..85b4024 100644
--- a/gcc/ada/par-ch4.adb
+++ b/gcc/ada/par-ch4.adb
@@ -91,6 +91,12 @@ package body Ch4 is
-- prefix. The current token is known to be an apostrophe and the
-- following token is known to be RANGE.
+ function P_Unparen_Cond_Case_Quant_Expression return Node_Id;
+ -- This function is called with Token pointing to IF, CASE, or FOR, in a
+ -- context that allows a case, conditional, or quantified expression if
+ -- it is surrounded by parentheses. If not surrounded by parentheses, the
+ -- expression is still returned, but an error message is issued.
+
-------------------------
-- Bad_Range_Attribute --
-------------------------
@@ -470,8 +476,8 @@ package body Ch4 is
end if;
end if;
- -- We come here with an OK attribute scanned, and the
- -- corresponding Attribute identifier node stored in Ident_Node.
+ -- We come here with an OK attribute scanned, and corresponding
+ -- Attribute identifier node stored in Ident_Node.
Prefix_Node := Name_Node;
Name_Node := New_Node (N_Attribute_Reference, Prev_Token_Ptr);
@@ -658,7 +664,7 @@ package body Ch4 is
Error_Msg
("expect identifier in parameter association",
Sloc (Expr_Node));
- Scan; -- past arrow
+ Scan; -- past arrow
elsif not Comma_Present then
T_Right_Paren;
@@ -1640,18 +1646,18 @@ package body Ch4 is
-- This function is identical to the normal P_Expression, except that it
-- also permits the appearance of a case, conditional, or quantified
- -- expression without the usual surrounding parentheses.
+ -- expression if the call immediately follows a left paren, and followed
+ -- by a right parenthesis. These forms are allowed if these conditions
+ -- are not met, but an error message will be issued.
function P_Expression_If_OK return Node_Id is
begin
- if Token = Tok_Case then
- return P_Case_Expression;
+ -- Case of conditional, case or quantified expression
- elsif Token = Tok_If then
- return P_Conditional_Expression;
+ if Token = Tok_Case or else Token = Tok_If or else Token = Tok_For then
+ return P_Unparen_Cond_Case_Quant_Expression;
- elsif Token = Tok_For then
- return P_Quantified_Expression;
+ -- Normal case, not case/conditional/quantified expression
else
return P_Expression;
@@ -1749,18 +1755,18 @@ package body Ch4 is
end P_Expression_Or_Range_Attribute;
-- Version that allows a non-parenthesized case, conditional, or quantified
- -- expression
+ -- expression if the call immediately follows a left paren, and followed
+ -- by a right parenthesis. These forms are allowed if these conditions
+ -- are not met, but an error message will be issued.
function P_Expression_Or_Range_Attribute_If_OK return Node_Id is
begin
- if Token = Tok_Case then
- return P_Case_Expression;
+ -- Case of conditional, case or quantified expression
- elsif Token = Tok_If then
- return P_Conditional_Expression;
+ if Token = Tok_Case or else Token = Tok_If or else Token = Tok_For then
+ return P_Unparen_Cond_Case_Quant_Expression;
- elsif Token = Tok_For then
- return P_Quantified_Expression;
+ -- Normal case, not one of the above expression types
else
return P_Expression_Or_Range_Attribute;
@@ -3059,4 +3065,54 @@ package body Ch4 is
end if;
end P_Membership_Test;
+ ------------------------------------------
+ -- P_Unparen_Cond_Case_Quant_Expression --
+ ------------------------------------------
+
+ function P_Unparen_Cond_Case_Quant_Expression return Node_Id is
+ Lparen : constant Boolean := Prev_Token = Tok_Left_Paren;
+ Result : Node_Id;
+
+ begin
+ -- Case expression
+
+ if Token = Tok_Case then
+ Result := P_Case_Expression;
+
+ if not (Lparen and then Token = Tok_Right_Paren) then
+ Error_Msg_N
+ ("case expression must be parenthesized!", Result);
+ end if;
+
+ -- Conditional expression
+
+ elsif Token = Tok_If then
+ Result := P_Conditional_Expression;
+
+ if not (Lparen and then Token = Tok_Right_Paren) then
+ Error_Msg_N
+ ("conditional expression must be parenthesized!", Result);
+ end if;
+
+ -- Quantified expression
+
+ elsif Token = Tok_For then
+ Result := P_Quantified_Expression;
+
+ if not (Lparen and then Token = Tok_Right_Paren) then
+ Error_Msg_N
+ ("quantified expression must be parenthesized!", Result);
+ end if;
+
+ -- No other possibility should exist (caller was supposed to check)
+
+ else
+ raise Program_Error;
+ end if;
+
+ -- Return expression (possibly after having given message)
+
+ return Result;
+ end P_Unparen_Cond_Case_Quant_Expression;
+
end Ch4;