This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] improve handling of restriction pragma


Tested on i686-linux, committed on mainline.

When a predefined unit is not available, we check also if there
is a pragma Restriction forbidding its usage, so that the corresponding
restriction violation message is generated, if needed.
This patch allows to properly compile the following Ada 2005 test:
--
limited with B;
package A is
   type Ptr is access B.T;
end A;
with A;
package B is
   type T is record
      X : A.Ptr;
   end record;
end B;

--
When building a configurable run time, it is typically the case that a set
of predefined run-time units are excluded from it. It is usually achieved
by means of both not including the run-time unit, and by setting the
appropriate pragma Restriction (if it exists).
For predefined run-time units which are not present in the run time, it has
been added the machinery for checking whether the unit is also forbidden by
a pragma Restriction, so that the corresponding restriction violation message
is generated, if needed.

--
Add missing check on visibility
Compilation of b-y.ads must yield the error:
b-y.ads:4:25: private child unit "X" is not visible here
--
package B is end;
private package B.X is
   type A_Type is new Integer;
end;
private with B.X;
package B.Y is
   type B_Type is new B.X.A_Type;   --  ERROR
end;

2005-06-14  Javier Miranda  <miranda@adacore.com>
	    Jose Ruiz  <ruiz@adacore.com>
	    Robert Dewar  <dewar@adacore.com>
	    Ed Schonberg  <schonberg@adacore.com>

	* lib-load.ads, lib-load.adb (Load_Unit): Addition of a new parameter
	that indicates if we are parsing a compilation unit found in a
	limited-with clause.
	It is use to avoid the circularity check.

	* par.ads, par.adb (Par): Addition of a new parameter to indicate if
	we are parsing a compilation unit found in a limited-with clause. This
	is use to avoid the circularity check.

	* par-load.adb (Load): Indicate Lib.Load_Unit if we are loading the
	unit as a consequence of parsing a limited-with clause. This is used
	to avoid the circularity check.

	* sem_ch10.adb: Suppress Ada 2005 unit warning if -gnatwY used
	(Analyze_Context): Limited-with clauses are now allowed
	in more compilation units.
	(Analyze_Subunit_Context, Check_Parent): Protect the frontend
	againts previously reported critical errors in context clauses
	(Install_Limited_Withed_Unit): Code cleanup plus static detection
	of two further errors: renamed subprograms and renamed packages
	are not allowed in limited with clauses.
	(Install_Siblings): Do not install private_with_clauses on the package
	declaration for a non-private child unit.
	(Re_Install_Parents): When a parent of the subunit is reinstalled,
	reset visibility of child units properly.
	(Install_Withed_Unit): When a child unit appears in a with_clause of its
	parent, it is immediately visible.

Attachment: difs.34
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]