summaryrefslogtreecommitdiff
path: root/gcc/ada/atree.ads
diff options
context:
space:
mode:
authorBob Duff <duff@adacore.com>2020-04-06 16:35:31 -0400
committerPierre-Marie de Rodat <derodat@adacore.com>2020-06-16 09:07:16 -0400
commitbcc0f556a7ed261d8270a925fd4823c7136783f0 (patch)
tree194cf316372122615b32cfac0b8155f5c179edd9 /gcc/ada/atree.ads
parentd51bf619f723292fd1475deb58b7b14144495648 (diff)
downloadgcc-bcc0f556a7ed261d8270a925fd4823c7136783f0.tar.gz
[Ada] Declare expressions
2020-06-16 Bob Duff <duff@adacore.com> gcc/ada/ * par-ch4.adb (P_Case_Expression): Move to be local. (P_Declare_Expression): New parsing routine. (P_Unparen_Cond_Expr_Etc): New name for P_Unparen_Cond_Case_Quant_Expression which was missing one case in its name (iterated component association), and we're adding a new case (declare expression), so lets use "Etc" instead of trying to pack all those things into the name. Add call to P_Declare_Expression, and check for missing parens. (P_Expression_If_OK, P_Expression_Or_Range_Attribute_If_OK): Add Tok_Declare. * par.adb (P_Basic_Declarative_Items): Add parameter Declare_Expression so we can tailor the error message about incorrect bodies. (P_Case_Expression): Move to body. * par-ch3.adb (P_Basic_Declarative_Items): Tailor the error message about incorrect bodies. * par-ch7.adb (P_Package): Pass Declare_Expression => False to P_Basic_Declarative_Items. * sem.ads (In_Declare_Expr): Counter used to determine whether we are analyzing a declare_expression. Needed to give errors about things that are not allowed in declare_expression, such as the 'Access attribute. * sem.adb (Do_Analyze): Save/restore In_Declare_Expr. * sem_ch4.adb (Analyze_Expression_With_Actions): Give this node its own scope. That seems better in general, but it is necessary for declare_expressions. For example, an identifier declared in a declare_expression should not clash with the same identifier in an outer scope. If this is a declare_expression, indicated by Comes_From_Source, then check legality rules, and incr/decr In_Declare_Expr. * sem_aggr.adb (Resolve_Aggregate): Allow an applicable index constraint for a declare_expression, so if its expression is an array aggregate, it can have "others => ...". * sem_attr.adb (Analyze_Access_Attribute): Disallow these attributes in declare_expressions. Add comment to make it clear that Unrestricted_Access is included. * sinfo.ads, sinfo.adb, atree.ads, atree.adb: Remove the now-incorrect comment in sinfo.ads that says N_Expression_With_Actions has no proper scope. Add 17-parameter versions of Nkind_In. Remove the 16-parameter versions of Nkind_In.
Diffstat (limited to 'gcc/ada/atree.ads')
-rw-r--r--gcc/ada/atree.ads5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/ada/atree.ads b/gcc/ada/atree.ads
index f9ebc38e554..68415d49ecb 100644
--- a/gcc/ada/atree.ads
+++ b/gcc/ada/atree.ads
@@ -772,7 +772,7 @@ package Atree is
V10 : Node_Kind;
V11 : Node_Kind) return Boolean;
- -- 12..15-parameter versions are not yet needed
+ -- 12..16-parameter versions are not yet needed
function Nkind_In
(N : Node_Id;
@@ -791,7 +791,8 @@ package Atree is
V13 : Node_Kind;
V14 : Node_Kind;
V15 : Node_Kind;
- V16 : Node_Kind) return Boolean;
+ V16 : Node_Kind;
+ V17 : Node_Kind) return Boolean;
pragma Inline (Nkind_In);
-- Inline all above functions