summaryrefslogtreecommitdiff
path: root/gcc/ada/par_sco.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2014-07-18 09:39:09 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2014-07-18 09:39:09 +0000
commitb1e1a36a7ccb837e49d4c7e07b81b0c4bd235f8e (patch)
tree043b7e25fcb9978f88516a350571ec4b665f9ec1 /gcc/ada/par_sco.adb
parent360f426f448d6b90959acf9d33197465e886967d (diff)
downloadgcc-b1e1a36a7ccb837e49d4c7e07b81b0c4bd235f8e.tar.gz
2014-07-18 Thomas Quinot <quinot@adacore.com>
* freeze.adb (Check_Component_Storage_Order): Fix enforcement of nesting rules for composites with different SSOs. 2014-07-18 Thomas Quinot <quinot@adacore.com> * par_sco.adb (Is_Logical_Operator): An If_Expression is not a proper logical operator. (Has_Decision): An If_Expression indicates the presence of a decision although it is not a logical operator. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@212793 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/par_sco.adb')
-rw-r--r--gcc/ada/par_sco.adb21
1 files changed, 13 insertions, 8 deletions
diff --git a/gcc/ada/par_sco.adb b/gcc/ada/par_sco.adb
index 0f923ca2c39..215a81a9116 100644
--- a/gcc/ada/par_sco.adb
+++ b/gcc/ada/par_sco.adb
@@ -100,10 +100,10 @@ package body Par_SCO is
-- contains a logical operator in its subtree).
function Is_Logical_Operator (N : Node_Id) return Boolean;
- -- N is the node for a subexpression. This procedure just tests N to see
- -- if it is a logical operator (including short circuit conditions, but
- -- excluding OR and AND) and returns True if so. It also returns True for
- -- an if expression. False in all other cases, no other processing is done.
+ -- N is the node for a subexpression. This procedure determines whether N
+ -- a logical operator (including short circuit conditions, but excluding
+ -- OR and AND) and returns True if so. Note that in cases where True is
+ -- returned, callers assume Nkind (N) in N_Op.
function To_Source_Location (S : Source_Ptr) return Source_Location;
-- Converts Source_Ptr value to Source_Location (line/col) format
@@ -307,6 +307,9 @@ package body Par_SCO is
function Has_Decision (N : Node_Id) return Boolean is
function Check_Node (N : Node_Id) return Traverse_Result;
+ -- Determine if Nkind (N) indicates the presence of a decision (i.e.
+ -- N is a logical operator -- a decision in itelsf -- or an
+ -- IF-expression -- whose Condition attribute is a decision).
----------------
-- Check_Node --
@@ -314,7 +317,7 @@ package body Par_SCO is
function Check_Node (N : Node_Id) return Traverse_Result is
begin
- if Is_Logical_Operator (N) then
+ if Is_Logical_Operator (N) or else Nkind (N) = N_If_Expression then
return Abandon;
else
return OK;
@@ -346,7 +349,8 @@ package body Par_SCO is
begin
SCO_Unit_Number_Table.Init;
- -- Set dummy 0'th entry in place for sort
+ -- The SCO_Unit_Number_Table entry with index 0 is intentionally set
+ -- aside to be used as temporary for sorting.
SCO_Unit_Number_Table.Increment_Last;
end Initialize;
@@ -357,7 +361,7 @@ package body Par_SCO is
function Is_Logical_Operator (N : Node_Id) return Boolean is
begin
- return Nkind_In (N, N_Op_Not, N_And_Then, N_Or_Else, N_If_Expression);
+ return Nkind_In (N, N_Op_Not, N_And_Then, N_Or_Else);
end Is_Logical_Operator;
-----------------------
@@ -456,7 +460,8 @@ package body Par_SCO is
if Nkind_In (N, N_Op_Or, N_Or_Else) then
C := '|';
- else
+
+ else pragma Assert (Nkind_In (N, N_Op_And, N_And_Then));
C := '&';
end if;
end if;