aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_disp.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2015-10-26 12:37:17 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2015-10-26 12:37:17 +0100
commitec6cfc5dc2d118e005edd98ecfef10de1fc48ad1 (patch)
treec80668d954e74578f7c175065fedc3cbf8832737 /gcc/ada/sem_disp.adb
parentbed87f4f07d0a5d6cddb8121ad55fdd0356c6b76 (diff)
downloadgcc-ec6cfc5dc2d118e005edd98ecfef10de1fc48ad1.zip
gcc-ec6cfc5dc2d118e005edd98ecfef10de1fc48ad1.tar.gz
gcc-ec6cfc5dc2d118e005edd98ecfef10de1fc48ad1.tar.bz2
[multiple changes]
2015-10-26 Ed Schonberg <schonberg@adacore.com> * sem_disp.adb (Check_Controlling_Type): Handle properly the case of an incomplete type whose full view is tagged, when a primitive operation of the type is declared between the two views. 2015-10-26 Bob Duff <duff@adacore.com> * adaint.c (__gnat_locate_exec_on_path): If the PATH environment variable is not set, do not return NULL, because we can still find the executable if it includes a directory name. 2015-10-26 Ed Schonberg <schonberg@adacore.com> * sem_elab.adb (Elab_Warning): Under dynamic elaboration, when elaboration warnings are enabled, emit proper warning header when triggered by an access attribute. 2015-10-26 Steve Baird <baird@adacore.com> * exp_ch11.adb: If CodePeer_Mode is true, generate simplified SCIL for exception declarations. * exp_ch11.adb (Expand_N_Exception_Declaration) If CodePeer_Mode is True, initialize the Full_Name component of the exception record to null instead of to the result of an unchecked conversion. 2015-10-26 Ed Schonberg <schonberg@adacore.com> * exp_unst.adb (Note_Uplevel_Ref) : Handle properly a reference that denotes a function returning a constrained array, that has been rewritten as a procedure. * makeutl.ads: Minor edit. From-SVN: r229340
Diffstat (limited to 'gcc/ada/sem_disp.adb')
-rw-r--r--gcc/ada/sem_disp.adb30
1 files changed, 23 insertions, 7 deletions
diff --git a/gcc/ada/sem_disp.adb b/gcc/ada/sem_disp.adb
index 74a315d..d2396a3 100644
--- a/gcc/ada/sem_disp.adb
+++ b/gcc/ada/sem_disp.adb
@@ -316,6 +316,18 @@ package body Sem_Disp is
Tagged_Type := Base_Type (T);
end if;
+ -- If the type is incomplete, it may have been declared without a
+ -- Tagged indication, but the full view may be tagged, in which case
+ -- that is the controlling type of the subprogram. This is one of the
+ -- approx. 579 places in the language where a lookahead would help.
+
+ elsif Ekind (T) = E_Incomplete_Type
+ and then Present (Full_View (T))
+ and then Is_Tagged_Type (Full_View (T))
+ then
+ Set_Is_Tagged_Type (T);
+ Tagged_Type := Full_View (T);
+
elsif Ekind (T) = E_Anonymous_Access_Type
and then Is_Tagged_Type (Designated_Type (T))
then
@@ -595,14 +607,17 @@ package body Sem_Disp is
and then Is_Entity_Name (Name (Par))
then
declare
+ Enc_Subp : constant Entity_Id := Entity (Name (Par));
A : Node_Id;
F : Entity_Id;
begin
- -- Find formal for which call is the actual.
+ -- Find formal for which call is the actual, and is
+ -- a controlling argument.
- F := First_Formal (Entity (Name (Par)));
+ F := First_Formal (Enc_Subp);
A := First_Actual (Par);
+
while Present (F) loop
if Is_Controlling_Formal (F)
and then (N = A or else Parent (N) = A)
@@ -697,11 +712,11 @@ package body Sem_Disp is
-- If the call doesn't have a controlling actual but does have an
-- indeterminate actual that requires dispatching treatment, then an
-- object is needed that will serve as the controlling argument for
- -- a dispatching call on the indeterminate actual. This can only
- -- occur in the unusual situation of a default actual given by
- -- a tag-indeterminate call and where the type of the call is an
- -- ancestor of the type associated with a containing call to an
- -- inherited operation (see AI-239).
+ -- a dispatching call on the indeterminate actual. This can occur
+ -- in the unusual situation of a default actual given by a tag-
+ -- indeterminate call and where the type of the call is an ancestor
+ -- of the type associated with a containing call to an inherited
+ -- operation (see AI-239).
-- Rather than create an object of the tagged type, which would
-- be problematic for various reasons (default initialization,
@@ -849,6 +864,7 @@ package body Sem_Disp is
end if;
else
+
-- If dispatching on result, the enclosing call, if any, will
-- determine the controlling argument. Otherwise this is the
-- primitive operation of the root type.