Commit 30168043 by Arnaud Charlet

[multiple changes]

2011-11-21  Robert Dewar  <dewar@adacore.com>

	* exp_ch6.adb: Minor reformatting.

2011-11-21  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch12.adb (Check_Formal_Package_Instance): If a formal
	subprogram of the formal package is covered by an others
	association with a box initialization, no check is needed
	against the actual in the instantiation of the formal package.

2011-11-21  Robert Dewar  <dewar@adacore.com>

	* sem_elab.adb (Check_Internal_Call_Continue): Suppress junk
	elab warning from within precondition/postcondition etc.

From-SVN: r181561
parent bdf69d33
......@@ -8532,8 +8532,8 @@ package body Exp_Ch6 is
return False;
-- Handle a corner case, a cross-dialect subp renaming. For example,
-- an Ada 2012 renaming of an Ada 05 subprogram. This can occur when a
-- non-Ada 2012 unit references predefined run-time units.
-- an Ada 2012 renaming of an Ada 2005 subprogram. This can occur when
-- an Ada 2005 (or earlier) unit references predefined run-time units.
elsif Present (Alias (Func_Id)) then
......
......@@ -5076,6 +5076,18 @@ package body Sem_Ch12 is
then
null;
-- If the formal package has an "others" box association that
-- covers this formal, there is no need for a check either.
elsif Nkind (Unit_Declaration_Node (E2)) in
N_Formal_Subprogram_Declaration
and then Box_Present (Unit_Declaration_Node (E2))
then
null;
-- Otherwise the actual in the formal and the actual in the
-- instantiation of the formal must match, up to renamings.
else
Check_Mismatch
(Ekind (E2) /= Ekind (E1) or else (Alias (E1)) /= Alias (E2));
......@@ -12383,9 +12395,11 @@ package body Sem_Ch12 is
procedure Reset_Entity (N : Node_Id) is
procedure Set_Global_Type (N : Node_Id; N2 : Node_Id);
-- If the type of N2 is global to the generic unit. Save the type in
-- the generic node.
-- What does this comment mean???
-- If the type of N2 is global to the generic unit, save the type in
-- the generic node. Just as we perform name capture for explicit
-- references within the generic, we must capture the global types
-- of local entities because they may participate in resolution in
-- the instance.
function Top_Ancestor (E : Entity_Id) return Entity_Id;
-- Find the ultimate ancestor of the current unit. If it is not a
......
......@@ -2130,7 +2130,32 @@ package body Sem_Elab is
end if;
-- Here is the case of calling a subprogram where the body has not yet
-- been encountered, a warning message is needed.
-- been encountered. A warning message is needed, except if this is the
-- case of appearing within an aspect specification that results in
-- a check call, we do not really have such a situation, so no warning
-- is needed (e.g., the case of a precondition, where the call appears
-- textually before the body, but in actual fact is moved to the
-- appropriate subprogram body and so does not need a check).
declare
P : Node_Id;
begin
P := Parent (N);
loop
if Nkind (P) in N_Subexpr then
P := Parent (P);
elsif Nkind (P) = N_If_Statement
and then Nkind (Original_Node (P)) = N_Pragma
and then Present (Corresponding_Aspect (Original_Node (P)))
then
return;
else
exit;
end if;
end loop;
end;
-- Not that special case, warning and dynamic check is required
-- If we have nothing in the call stack, then this is at the outer
-- level, and the ABE is bound to occur.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment