===================================================================
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
+-- Copyright (C) 1992-2016, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -759,9 +759,16 @@
Ent := Entity (N);
Expr := NE_Ent.Entity;
loop
- -- Here if at outer level of entity name in reference
+ -- Here if at outer level of entity name in reference (handle
+ -- also the direct use of Text_IO in the pragma). For example:
+ -- pragma Restrictions (No_Use_Of_Entity => Text_IO.Put);
- if Scope (Ent) = Standard_Standard then
+ if Scope (Ent) = Standard_Standard
+ or else (Nkind (Expr) = N_Identifier
+ and then Chars (Ent) = Name_Text_IO
+ and then Chars (Scope (Ent)) = Name_Ada
+ and then Scope (Scope (Ent)) = Standard_Standard)
+ then
if Nkind_In (Expr, N_Identifier, N_Operator_Symbol)
and then Chars (Ent) = Chars (Expr)
then
@@ -774,22 +781,19 @@
return;
else
- goto Continue;
+ exit;
end if;
-- Here if at outer level of entity name in table
elsif Nkind_In (Expr, N_Identifier, N_Operator_Symbol) then
- goto Continue;
+ exit;
-- Here if neither at the outer level
else
pragma Assert (Nkind (Expr) = N_Selected_Component);
-
- if Chars (Selector_Name (Expr)) /= Chars (Ent) then
- goto Continue;
- end if;
+ exit when Chars (Selector_Name (Expr)) /= Chars (Ent);
end if;
-- Move up a level
@@ -800,10 +804,6 @@
end loop;
Expr := Prefix (Expr);
-
- -- Entry did not match
-
- <<Continue>> null;
end loop;
end;
end loop;
===================================================================
@@ -1112,7 +1112,7 @@
-- Find actual that corresponds to a given a formal parameter. If the
-- actuals are positional, return the next one, if any. If the actuals
-- are named, scan the parameter associations to find the right one.
- -- A_F is the corresponding entity in the analyzed generic,which is
+ -- A_F is the corresponding entity in the analyzed generic, which is
-- placed on the selector name for ASIS use.
--
-- In Ada 2005, a named association may be given with a box, in which
@@ -1257,7 +1257,7 @@
elsif No (Selector_Name (Actual)) then
Found_Assoc := Actual;
- Act := Explicit_Generic_Actual_Parameter (Actual);
+ Act := Explicit_Generic_Actual_Parameter (Actual);
Num_Matched := Num_Matched + 1;
Next (Actual);
@@ -1271,12 +1271,17 @@
Prev := Empty;
while Present (Actual) loop
- if Chars (Selector_Name (Actual)) = Chars (F) then
+ if Nkind (Actual) = N_Others_Choice then
+ Found_Assoc := Empty;
+ Act := Empty;
+
+ elsif Chars (Selector_Name (Actual)) = Chars (F) then
Set_Entity (Selector_Name (Actual), A_F);
Set_Etype (Selector_Name (Actual), Etype (A_F));
Generate_Reference (A_F, Selector_Name (Actual));
+
Found_Assoc := Actual;
- Act := Explicit_Generic_Actual_Parameter (Actual);
+ Act := Explicit_Generic_Actual_Parameter (Actual);
Num_Matched := Num_Matched + 1;
exit;
end if;
===================================================================
@@ -6224,6 +6224,8 @@
if Is_Overloadable (Id) and then not Is_Overloaded (N) then
Generate_Reference (Id, N);
end if;
+
+ Check_Restriction_No_Use_Of_Entity (N);
end Find_Expanded_Name;
-------------------------