From 11700d5713d3d7f654882af03d39e73f491b309d Mon Sep 17 00:00:00 2001 From: charlet Date: Fri, 4 Nov 2011 13:55:34 +0000 Subject: 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@180952 138bc75d-0d04-0410-961f-82ee72b054a4 --- 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 1b0f919d3ff..2ddf1af53bb 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.2.1 From b74a14bb163329689def4dc4f555fc410b6b6f79 Mon Sep 17 00:00:00 2001 From: charlet Date: Fri, 4 Nov 2011 14:10:21 +0000 Subject: Minor reformatting. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@180957 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/sem_ch5.adb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'gcc/ada/sem_ch5.adb') diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb index 2ddf1af53bb..0e6c5cf98bd 100644 --- a/gcc/ada/sem_ch5.adb +++ b/gcc/ada/sem_ch5.adb @@ -2431,7 +2431,7 @@ package body Sem_Ch5 is declare Element : constant Entity_Id := - Find_Aspect (Typ, Aspect_Iterator_Element); + Find_Aspect (Typ, Aspect_Iterator_Element); begin if No (Element) then Error_Msg_NE ("cannot iterate over&", N, Typ); @@ -2453,7 +2453,6 @@ package body Sem_Ch5 is 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; -- cgit v1.2.1