This is the mail archive of the 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] Handling of library unit renamings in with_clauses

A library unit name that is a renaming can appear in the name of a with_clause.
When it is the prefix of a name, an implicit with_clause must be created for it,
as well as for the unit it renames. So if R renames A, and we have a with_clause
on R.B (where B is a child unit of A) we need with_clauses on both R an A (both
of which can themselves be child units). This is because R may be used as a
prefix within the current unit, and because A is needed to retrieve A.B.
This patch fixes a bug in the handling of such with_clauses, and simplifies the
processing by creating the with_clause for R when processing the with_clause
for R.B at load time, before any analysis has taken place.

The following must compile quietly:

      gcc -c

package Orig_Parent is
end Orig_Parent;
package Orig_Parent.Child is
end Orig_Parent.Child;
function Orig_Parent.Child.Grandchild return Integer;
package Renam_Parent is
end Renam_Parent;
with Orig_Parent.Child;
package Renam_Parent.Child renames Orig_Parent.Child;
with Renam_Parent.Child.Grandchild;
package With_Child is
   X : Integer := Renam_Parent.Child.Grandchild;
end With_Child;

Tested on x86_64-pc-linux-gnu, committed on trunk

2012-02-22  Ed Schonberg  <>

	* lib-load.adb (Load_Unit): If the prefix of the name in a
	with-clause is a renaming, add a with-clause on the original unit.
	* sem_ch10.adb (Build_Unit_Name): Remove code made obsolete by
	new handling of renamings in with-clauses.

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]