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] | |
Tested on i686-linux, committed on trunk
A limited_with clause can be analyzed multiple times: first when the
unit that contains it is analyzed, and then when this unit appears in the
context of some other unit that is being analyzed. In the latter case, the
non-limited view of the package may be currently available: this is the
case when compiling a body B that has a regular with_clause on a unit P,
when the spec for B has a limited_with_clause on the same P. In such cases,
we need to install the non-limited view of P and all its types.
However, when compiling a child unit, we may reanalyze the limited_with
clause in the parent, without the non-limited view of the package being
available. In such a case, the non-limited view of any type is still an
incomplete type, and only the limited view remains available.
The following must compile quietly:
--
package Employees is
type Employee is tagged private;
private
type Employee is tagged record
Id : Natural := 0;
end record;
end Employees;
--
limited with Employees;
package Visibility is
subtype Employee is Employees.Employee;
end Visibility;
--
private package Visibility.Internal is
type Secret is new Integer;
end Visibility.Internal;
In addition, when the prefix P of an expanded name P.X denotes the renaming of a
package, the entity of P is set to the original package, for visiblity
purposes. When checking on whether a with_clause is needed in a given
compilation unit context, this renaming must be taken into account, This
is significant because a very common with_clause in Ada programs is for
Text_IO, which is a renaming of Ada.Text_IO.
--
gnat.dg/renaming1.adb must compile quietly.
2007-04-06 Ed Schonberg <schonberg@adacore.com>
* sem_ch10.adb (Install_Limited_Context_Clauses.
Expand_Limited_With_Clause): Use a new copy of selector name in the
call to Make_With_Clause. This fixes the tree structure for ASIS
purposes. Nothing is changed in the compiler behaviour.
(Process_Body_Clauses): Handle properly use clauses whose prefix is
a package renaming.
(Install_Limited_With_Clauses): Do not install non-limited view when it
is still incomplete.
Attachment:
difs
Description: Text document
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |