summaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch5.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-22 14:51:40 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-22 14:51:40 +0000
commit55e8372b4664ca118f73b513edcfa2addd440949 (patch)
tree38cfcc39f78d32f0add42722075410891f22b133 /gcc/ada/sem_ch5.adb
parent99911ab198ba2df7a15d7516654cb8b5d55dcaa6 (diff)
downloadgcc-55e8372b4664ca118f73b513edcfa2addd440949.tar.gz
2010-10-22 Ben Brosgol <brosgol@adacore.com>
* gnat_rm.texi: Add chapter on Ada 2012 support. 2010-10-22 Robert Dewar <dewar@adacore.com> * sem_ch12.adb: Minor reformatting. 2010-10-22 Thomas Quinot <quinot@adacore.com> * exp_dist.adb: Mark missing case of nested package when expanding stubs. 2010-10-22 Ed Schonberg <schonberg@adacore.com> * par-ch10.adb: Discard incomplete with_clause. 2010-10-22 Robert Dewar <dewar@adacore.com> * checks.adb (Enable_Range_Check): Remove code suppressing range check if static predicate present, not needed. * exp_attr.adb (Expand_Pred_Succ): Check Suppress_Assignment_Checks flag * exp_ch3.adb (Expand_N_Object_Declaration): Check Suppress_Assignment_Checks flag. * exp_ch4.adb (Expand_N_In): Make some corrections for proper handling of ranges when predicates are present. * exp_ch5.adb (Expand_Predicated_Loop): New procedure (Expand_N_Assignment_Statement): Check Suppress_Assignment_Checks flag (Expand_N_Loop_Statement): Handle loops over predicated types * sem_case.adb (Analyze_Choices): Remove extra blank in error message. * sem_ch13.adb (Build_Predicate_Function.Add_Call): Suppress info message for inheritance if within a generic instance, not useful there! (Build_Static_Predicate): Optimize test in predicate function based on static ranges determined. * sem_ch5.adb (Analyze_Iteration_Scheme): Error for loop through subtype with non-static predicate. * sinfo.ads, sinfo.adb (Suppress_Assignment_Checks): New flag. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165834 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_ch5.adb')
-rw-r--r--gcc/ada/sem_ch5.adb26
1 files changed, 21 insertions, 5 deletions
diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb
index eceb2818477..9265257a9ef 100644
--- a/gcc/ada/sem_ch5.adb
+++ b/gcc/ada/sem_ch5.adb
@@ -1832,18 +1832,34 @@ package body Sem_Ch5 is
return;
end if;
- -- The subtype indication may denote the completion of an
- -- incomplete type declaration.
+ -- Some additional checks if we are iterating through a type
if Is_Entity_Name (DS)
and then Present (Entity (DS))
and then Is_Type (Entity (DS))
- and then Ekind (Entity (DS)) = E_Incomplete_Type
then
- Set_Entity (DS, Get_Full_View (Entity (DS)));
- Set_Etype (DS, Entity (DS));
+ -- The subtype indication may denote the completion of an
+ -- incomplete type declaration.
+
+ if Ekind (Entity (DS)) = E_Incomplete_Type then
+ Set_Entity (DS, Get_Full_View (Entity (DS)));
+ Set_Etype (DS, Entity (DS));
+ end if;
+
+ -- Attempt to iterate through non-static predicate
+
+ if Is_Discrete_Type (Entity (DS))
+ and then Present (Predicate_Function (Entity (DS)))
+ and then No (Static_Predicate (Entity (DS)))
+ then
+ Bad_Predicated_Subtype_Use
+ ("cannot use subtype& with non-static "
+ & "predicate for loop iteration", DS, Entity (DS));
+ end if;
end if;
+ -- Error if not discrete type
+
if not Is_Discrete_Type (Etype (DS)) then
Wrong_Type (DS, Any_Discrete);
Set_Etype (DS, Any_Type);