r260660 - in /trunk/gcc/ada: ChangeLog sem_ch10...

pmderodat@gcc.gnu.org pmderodat@gcc.gnu.org
Thu May 24 13:06:00 GMT 2018


Author: pmderodat
Date: Thu May 24 13:06:05 2018
New Revision: 260660

URL: https://gcc.gnu.org/viewcvs?rev=260660&root=gcc&view=rev
Log:
[Ada] Spurious error due to lingering limited view

This patch modifies the mechanism which manages [private] with clauses to
uninstall a limited with clause if a non-limited with clause is given for
the same package.

The management of with clauses already prevents the installation of a limited
with clause if the related package is already withed though a non-limited with
clause. The timing of parent unit with clause processing is such that the non-
limited clauses of the child unit are first installed, followed by the clauses
of the parent. This order prevents a limited with clause from "overriding" a
non-limited with clause.

Private with clauses however break this model because they are processed when
the private part of a package is entered. Since private with clauses are non-
limited with clauses, they must "override" the effects of any limited clauses
which import the same packages. This effect is now correctly achieved by
uninstalling the limited with clauses when private with clauses are activated.

------------
-- Source --
------------

--  server.ads

package Server is
   type Root is tagged private;
private
   type Root is tagged null record;
end Server;

--  parent.ads

limited with Server;

package Parent is end Parent;

--  parent-client.ads

private with Server;

package Parent.Client is
   type Deriv is tagged private;
private
   type Deriv is new Server.Root with null record;
end Parent.Client;

-----------------
-- Compilation --
-----------------

$ gcc -c parent-client.ads

2018-05-24  Hristian Kirtchev  <kirtchev@adacore.com>

gcc/ada/

	* sem_ch10.adb (Expand_Limited_With_Clause): Update the call to
	Install_Limited_Withed_Unit.
	(Expand_With_Clause): Update the call to Install_Withed_Unit.
	(Implicit_With_On_Parent): Update the call to Install_Withed_Unit.
	(Install_Context_Clauses): Update the call to Install_Withed_Unit.
	(Install_Limited_Context_Clauses): Update the calls to
	 Install_Limited_Withed_Unit.
	(Install_Limited_Withed_Unit): Renamed to better illustrate its
	purpose.
	(Install_Private_With_Clauses): Update the calls to Install_Withed_Unit
	and Install_Limited_Withed_Unit.
	(Install_With_Clause): Uninstall a limited with clause if a [private]
	with clause is given for the same package.
	(Install_Withed_Unit): Renamed to better illustrate its purpose.
	(Remove_Limited_With_Unit): New routine.

Modified:
    trunk/gcc/ada/ChangeLog
    trunk/gcc/ada/sem_ch10.adb



More information about the Gcc-cvs mailing list