[multiple changes]
2011-08-02 Gary Dismukes <dismukes@adacore.com> * sem_ch6.adb (Check_Conformance): Revise the check for nonconforming null exclusions to test Can_Never_Be_Null on the anonymous access types of the formals rather than testing the formals themselves. Exclude this check in cases where the Old_Formal is marked as a controlling formal, to avoid issuing spurious errors for bodies completing dispatching operations (due to the flag not getting set on controlling access formals in body specs). (Find_Corresponding_Spec): When checking full and subtype conformance of subprogram bodies in instances, pass Designated and E in that order, for consistency with the expected order of the formals (New_Id followed by Old_Id). 2011-08-02 Robert Dewar <dewar@adacore.com> * sem_ch8.adb: Minor reformatting. From-SVN: r177172
This commit is contained in:
parent
1138cf593b
commit
c7b9d548d3
|
@ -1,3 +1,21 @@
|
||||||
|
2011-08-02 Gary Dismukes <dismukes@adacore.com>
|
||||||
|
|
||||||
|
* sem_ch6.adb (Check_Conformance): Revise the check for nonconforming
|
||||||
|
null exclusions to test Can_Never_Be_Null on the anonymous access types
|
||||||
|
of the formals rather than testing the formals themselves. Exclude this
|
||||||
|
check in cases where the Old_Formal is marked as a controlling formal,
|
||||||
|
to avoid issuing spurious errors for bodies completing dispatching
|
||||||
|
operations (due to the flag not getting set on controlling access
|
||||||
|
formals in body specs).
|
||||||
|
(Find_Corresponding_Spec): When checking full and subtype conformance of
|
||||||
|
subprogram bodies in instances, pass Designated and E in that order, for
|
||||||
|
consistency with the expected order of the formals (New_Id followed by
|
||||||
|
Old_Id).
|
||||||
|
|
||||||
|
2011-08-02 Robert Dewar <dewar@adacore.com>
|
||||||
|
|
||||||
|
* sem_ch8.adb: Minor reformatting.
|
||||||
|
|
||||||
2011-08-02 Ed Schonberg <schonberg@adacore.com>
|
2011-08-02 Ed Schonberg <schonberg@adacore.com>
|
||||||
|
|
||||||
* sem_ch8.adb (Analyze_Subprogram_Renaming): new procedure
|
* sem_ch8.adb (Analyze_Subprogram_Renaming): new procedure
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
-- --
|
-- --
|
||||||
-- B o d y --
|
-- B o d y --
|
||||||
-- --
|
-- --
|
||||||
-- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
|
-- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
|
||||||
-- --
|
-- --
|
||||||
-- GNAT is free software; you can redistribute it and/or modify it under --
|
-- 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- --
|
-- terms of the GNU General Public License as published by the Free Soft- --
|
||||||
|
@ -4144,14 +4144,21 @@ package body Sem_Ch6 is
|
||||||
|
|
||||||
-- Ada 2005 (AI-231): In case of anonymous access types check
|
-- Ada 2005 (AI-231): In case of anonymous access types check
|
||||||
-- the null-exclusion and access-to-constant attributes must
|
-- the null-exclusion and access-to-constant attributes must
|
||||||
-- match.
|
-- match. For null exclusion, we test the types rather than the
|
||||||
|
-- formals themselves, since the attribute is only set reliably
|
||||||
|
-- on the formals in the Ada 95 case, and we exclude the case
|
||||||
|
-- where Old_Formal is marked as controlling, to avoid errors
|
||||||
|
-- when matching completing bodies with dispatching declarations
|
||||||
|
-- (access formals in the bodies aren't marked Can_Never_Be_Null).
|
||||||
|
|
||||||
if Ada_Version >= Ada_2005
|
if Ada_Version >= Ada_2005
|
||||||
and then Ekind (Etype (Old_Formal)) = E_Anonymous_Access_Type
|
and then Ekind (Etype (Old_Formal)) = E_Anonymous_Access_Type
|
||||||
and then Ekind (Etype (New_Formal)) = E_Anonymous_Access_Type
|
and then Ekind (Etype (New_Formal)) = E_Anonymous_Access_Type
|
||||||
and then
|
and then
|
||||||
(Can_Never_Be_Null (Old_Formal) /=
|
((Can_Never_Be_Null (Etype (Old_Formal)) /=
|
||||||
Can_Never_Be_Null (New_Formal)
|
Can_Never_Be_Null (Etype (New_Formal))
|
||||||
|
and then
|
||||||
|
not Is_Controlling_Formal (Old_Formal))
|
||||||
or else
|
or else
|
||||||
Is_Access_Constant (Etype (Old_Formal)) /=
|
Is_Access_Constant (Etype (Old_Formal)) /=
|
||||||
Is_Access_Constant (Etype (New_Formal)))
|
Is_Access_Constant (Etype (New_Formal)))
|
||||||
|
@ -6250,11 +6257,11 @@ package body Sem_Ch6 is
|
||||||
|
|
||||||
if Nkind (N) = N_Subprogram_Body
|
if Nkind (N) = N_Subprogram_Body
|
||||||
and then Present (Homonym (E))
|
and then Present (Homonym (E))
|
||||||
and then not Fully_Conformant (E, Designator)
|
and then not Fully_Conformant (Designator, E)
|
||||||
then
|
then
|
||||||
goto Next_Entity;
|
goto Next_Entity;
|
||||||
|
|
||||||
elsif not Subtype_Conformant (E, Designator) then
|
elsif not Subtype_Conformant (Designator, E) then
|
||||||
goto Next_Entity;
|
goto Next_Entity;
|
||||||
end if;
|
end if;
|
||||||
end if;
|
end if;
|
||||||
|
|
|
@ -1622,15 +1622,15 @@ package body Sem_Ch8 is
|
||||||
-- class-wide operation whose body is a dispatching call. We replace the
|
-- class-wide operation whose body is a dispatching call. We replace the
|
||||||
-- generated renaming declaration:
|
-- generated renaming declaration:
|
||||||
--
|
--
|
||||||
-- procedure P (X : CT) renames P;
|
-- procedure P (X : CT) renames P;
|
||||||
--
|
--
|
||||||
-- by a different renaming and a class-wide operation:
|
-- by a different renaming and a class-wide operation:
|
||||||
--
|
--
|
||||||
-- procedure Pr (X : T) renames P; -- renames primitive operation
|
-- procedure Pr (X : T) renames P; -- renames primitive operation
|
||||||
-- procedure P (X : CT); -- class-wide operation
|
-- procedure P (X : CT); -- class-wide operation
|
||||||
-- ...
|
-- ...
|
||||||
-- procedure P (X : CT) is begin Pr (X); end; -- dispatching call
|
-- procedure P (X : CT) is begin Pr (X); end; -- dispatching call
|
||||||
|
--
|
||||||
-- This rule only applies if there is no explicit visible class-wide
|
-- This rule only applies if there is no explicit visible class-wide
|
||||||
-- operation at the point of the instantiation.
|
-- operation at the point of the instantiation.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue