aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/lib-xref.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2004-12-08 12:47:21 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2004-12-08 12:47:21 +0100
commit1a1035e41b21a28386d0a85e108d582db4ee9a6a (patch)
tree2dce85e50d1c540821c9ea5d07628a8f8eaca246 /gcc/ada/lib-xref.adb
parent4722c5d693d886d22da0a52e8a8133e0e33bdd30 (diff)
downloadgcc-1a1035e41b21a28386d0a85e108d582db4ee9a6a.zip
gcc-1a1035e41b21a28386d0a85e108d582db4ee9a6a.tar.gz
gcc-1a1035e41b21a28386d0a85e108d582db4ee9a6a.tar.bz2
lib-xref.adb (Generate_Reference): Handle properly a reference to an entry formal...
* lib-xref.adb (Generate_Reference): Handle properly a reference to an entry formal, when an accept statement has a pragma Unreferenced for it. * sem_ch9.adb (Analyze_Accept_Statement): Reset the Is_Referenced flag and the Has_Pragma_Unreferenced flag for each formal before analyzing the body, to ensure that warnings are properly emitted for each accept statement of a given task entry. From-SVN: r91888
Diffstat (limited to 'gcc/ada/lib-xref.adb')
-rw-r--r--gcc/ada/lib-xref.adb28
1 files changed, 22 insertions, 6 deletions
diff --git a/gcc/ada/lib-xref.adb b/gcc/ada/lib-xref.adb
index f2158ce..b446b99 100644
--- a/gcc/ada/lib-xref.adb
+++ b/gcc/ada/lib-xref.adb
@@ -33,6 +33,7 @@ with Namet; use Namet;
with Nlists; use Nlists;
with Opt; use Opt;
with Sem_Prag; use Sem_Prag;
+with Sem_Util; use Sem_Util;
with Sinfo; use Sinfo;
with Sinput; use Sinput;
with Snames; use Snames;
@@ -377,14 +378,29 @@ package body Lib.Xref is
then
null;
- -- For now, ignore case of parameter to entry, since we don't deal
- -- correctly with the case of multiple accepts for the same entry.
- -- To deal with this we would have to put the flag on the body
- -- entity, but that's not easy, since everyone references the spec
- -- entity. To be looked at later to improve this case ???
+ -- For entry formals, we want to place the warning on the
+ -- corresponding entity in the accept statement. The current
+ -- scope is the body of the accept, so we find the formal
+ -- whose name matches that of the entry formal (there is no
+ -- link between the two entities, and the one in the accept
+ -- statement is only used for conformance checking).
elsif Ekind (Scope (E)) = E_Entry then
- null;
+ declare
+ BE : Entity_Id;
+
+ begin
+ BE := First_Entity (Current_Scope);
+ while Present (BE) loop
+ if Chars (BE) = Chars (E) then
+ Error_Msg_NE
+ ("?pragma Unreferenced given for&", N, BE);
+ exit;
+ end if;
+
+ Next_Entity (BE);
+ end loop;
+ end;
-- Here we issue the warning, since this is a real reference