aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_dim.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2012-10-01 15:21:34 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2012-10-01 15:21:34 +0200
commit804fc056d55a4098d7a4a1fc895579aaf1bb3080 (patch)
tree3e50d4f87942db537688cbf1da9753c4af48b621 /gcc/ada/sem_dim.adb
parenta91e9ac73ddc90a31f5f9afcbc73558cb0e56006 (diff)
downloadgcc-804fc056d55a4098d7a4a1fc895579aaf1bb3080.zip
gcc-804fc056d55a4098d7a4a1fc895579aaf1bb3080.tar.gz
gcc-804fc056d55a4098d7a4a1fc895579aaf1bb3080.tar.bz2
[multiple changes]
2012-10-01 Ed Schonberg <schonberg@adacore.com> * checks.adb (Apply_Predicate_Check): If the predicate is a static one and the operand is static, evaluate the predicate at compile time. * sem_eval.ads, sem_eval.adb (Eval_Static_Predicate_Check): new procedure, to evaluate a static predicate check whenever possible. * sem_res.adb (Resolve_Type_Conversion): Apply predicate check on the conversion if the target type has predicates. 2012-10-01 Vincent Pucci <pucci@adacore.com> * sem_dim.adb (Has_Symbols): Complain if parameter Symbol has been provided by the user in the dimension output call. From-SVN: r191921
Diffstat (limited to 'gcc/ada/sem_dim.adb')
-rw-r--r--gcc/ada/sem_dim.adb46
1 files changed, 40 insertions, 6 deletions
diff --git a/gcc/ada/sem_dim.adb b/gcc/ada/sem_dim.adb
index d752607..4902ae3 100644
--- a/gcc/ada/sem_dim.adb
+++ b/gcc/ada/sem_dim.adb
@@ -2703,7 +2703,8 @@ package body Sem_Dim is
-----------------
function Has_Symbols return Boolean is
- Actual : Node_Id;
+ Actual : Node_Id;
+ Actual_Str : Node_Id;
begin
Actual := First (Actuals);
@@ -2711,16 +2712,49 @@ package body Sem_Dim is
-- Look for a symbols parameter association in the list of actuals
while Present (Actual) loop
- if Nkind (Actual) = N_Parameter_Association
+ -- Positional parameter association case when the actual is a
+ -- string literal.
+
+ if Nkind (Actual) = N_String_Literal then
+ Actual_Str := Actual;
+
+ -- Named parameter association case when the selector name is
+ -- Symbol.
+
+ elsif Nkind (Actual) = N_Parameter_Association
and then Chars (Selector_Name (Actual)) = Name_Symbol
then
+ Actual_Str := Explicit_Actual_Parameter (Actual);
+
+ -- Ignore all other cases
+
+ else
+ Actual_Str := Empty;
+ end if;
+
+ if Present (Actual_Str) then
-- Return True if the actual comes from source or if the string
-- of symbols doesn't have the default value (i.e. it is "").
- return Comes_From_Source (Actual)
- or else
- String_Length
- (Strval (Explicit_Actual_Parameter (Actual))) /= 0;
+ if Comes_From_Source (Actual)
+ or else String_Length (Strval (Actual_Str)) /= 0
+ then
+ -- Complain only if the actual comes from source or if it
+ -- hasn't been fully analyzed yet.
+
+ if Comes_From_Source (Actual)
+ or else not Analyzed (Actual)
+ then
+ Error_Msg_N ("Symbol parameter should not be provided",
+ Actual);
+ Error_Msg_N ("\reserved for compiler use only", Actual);
+ end if;
+
+ return True;
+
+ else
+ return False;
+ end if;
end if;
Next (Actual);