aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2011-11-21 12:26:14 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2011-11-21 12:26:14 +0100
commit301680433d60925930ae1699865ab4a7fd3eb6ab (patch)
treedf49f17be25b158bdbad3f2795e042d01355a11a
parentbdf69d333e4c6d080e8be3ad9d71fb1895e85d03 (diff)
downloadgcc-301680433d60925930ae1699865ab4a7fd3eb6ab.zip
gcc-301680433d60925930ae1699865ab4a7fd3eb6ab.tar.gz
gcc-301680433d60925930ae1699865ab4a7fd3eb6ab.tar.bz2
[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
-rw-r--r--gcc/ada/exp_ch6.adb4
-rw-r--r--gcc/ada/sem_ch12.adb20
-rw-r--r--gcc/ada/sem_elab.adb27
3 files changed, 45 insertions, 6 deletions
diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb
index b68fb8a..6673328 100644
--- a/gcc/ada/exp_ch6.adb
+++ b/gcc/ada/exp_ch6.adb
@@ -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
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index e51b802..2a431f8 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -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
diff --git a/gcc/ada/sem_elab.adb b/gcc/ada/sem_elab.adb
index 5df43af..d51dae9 100644
--- a/gcc/ada/sem_elab.adb
+++ b/gcc/ada/sem_elab.adb
@@ -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.