From 73fe16797b7cc9e9a41794780d7e448b1d4b2b1e Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Fri, 4 Nov 2011 14:55:34 +0100 Subject: [multiple changes] 2011-11-04 Gary Dismukes * bindgen.adb (Gen_Elab_Calls): In the case of the AAMP target, set elaboration entities to 1 rather than incrementing. 2011-11-04 Ed Schonberg * sem_ch10.adb (Install_Limited_With_Unit): To establish the proper entities on the ancestors of a child unit that appear in a limited_with clause, follow the unit links because the units are not analyzed and scope information is incomplete. 2011-11-04 Eric Botcazou * exp_ch4.adb (Expand_N_Selected_Component): Refine code setting the Atomic_Sync_Required flag to detect one more case. * exp_util.adb (Activate_Atomic_Synchronization): Refine code setting the Atomic_Sync_Required flag to exclude more cases, depending on the parent of the node to be examined. 2011-11-04 Bob Duff * g-excact.adb: Minor: use named notation. 2011-11-04 Ed Schonberg * sem_ch5.adb: Improve error messages for illegal iterators. From-SVN: r180952 --- gcc/ada/sem_ch5.adb | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'gcc/ada/sem_ch5.adb') diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb index 1b0f919..2ddf1af 100644 --- a/gcc/ada/sem_ch5.adb +++ b/gcc/ada/sem_ch5.adb @@ -2429,8 +2429,17 @@ package body Sem_Ch5 is -- The type of the loop variable is the Iterator_Element aspect of -- the container type. - Set_Etype (Def_Id, - Entity (Find_Aspect (Typ, Aspect_Iterator_Element))); + declare + Element : constant Entity_Id := + Find_Aspect (Typ, Aspect_Iterator_Element); + begin + if No (Element) then + Error_Msg_NE ("cannot iterate over&", N, Typ); + return; + else + Set_Etype (Def_Id, Entity (Element)); + end if; + end; else -- For an iteration of the form IN, the name must denote an @@ -2440,12 +2449,18 @@ package body Sem_Ch5 is if Is_Entity_Name (Original_Node (Name (N))) and then not Is_Iterator (Typ) then - Error_Msg_N - ("name must be an iterator, not a container", Name (N)); + if No (Find_Aspect (Typ, Aspect_Iterator_Element)) then + Error_Msg_NE + ("cannot iterate over&", Name (N), Typ); + else + + Error_Msg_N + ("name must be an iterator, not a container", Name (N)); + end if; Error_Msg_NE - ("\to iterate directly over a container, write `of &`", - Name (N), Original_Node (Name (N))); + ("\to iterate directly over the elements of a container, " & + "write `of &`", Name (N), Original_Node (Name (N))); end if; -- The result type of Iterate function is the classwide type of -- cgit v1.1