aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/atree.adb
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.adb
parentd51bf619f723292fd1475deb58b7b14144495648 (diff)
downloadgcc-bcc0f556a7ed261d8270a925fd4823c7136783f0.zip
gcc-bcc0f556a7ed261d8270a925fd4823c7136783f0.tar.gz
gcc-bcc0f556a7ed261d8270a925fd4823c7136783f0.tar.bz2
[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.adb')
-rw-r--r--gcc/ada/atree.adb5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/ada/atree.adb b/gcc/ada/atree.adb
index 5c60a472..b342add 100644
--- a/gcc/ada/atree.adb
+++ b/gcc/ada/atree.adb
@@ -1940,11 +1940,12 @@ package body Atree is
V13 : Node_Kind;
V14 : Node_Kind;
V15 : Node_Kind;
- V16 : Node_Kind) return Boolean
+ V16 : Node_Kind;
+ V17 : Node_Kind) return Boolean
is
begin
return Nkind_In (Nkind (N), V1, V2, V3, V4, V5, V6, V7, V8, V9, V10,
- V11, V12, V13, V14, V15, V16);
+ V11, V12, V13, V14, V15, V16, V17);
end Nkind_In;
--------