[Ada] Remote types packages can depend on preelaborated packages
Arnaud Charlet
charlet@adacore.com
Fri Oct 8 12:57:00 GMT 2010
This patch implements AI-0206, which is a binding interpretation that
permits remote types packages to depend on preelaborated packages.
The following should compile quietly with -gnatc -gnat05:
package RTP_X is
pragma preelaborate;
type T is null record;
type T_Access is access all T;
end RTP_X;
with Ada.Streams; use Ada.Streams;
private with Ada.Finalization;
private with RTP_X;
package RTP_RT is
pragma Remote_Types;
type W is private;
procedure Reader
(S : not null access Root_Stream_Type'Class; B : out W);
procedure Writer
(S : not null access Root_Stream_Type'Class; B : in W);
for W'Read use Reader;
for W'Write use Writer;
private
type W is new Ada.Finalization.Controlled with record
D : RTP_X.T_Access;
end record;
end RTP_RT;
Tested on x86_64-pc-linux-gnu, committed on trunk
2010-10-08 Robert Dewar <dewar@adacore.com>
* sem_cat.adb (Check_Categorization_Dependencies): Remote types
packages can depend on preleborated packages.
-------------- next part --------------
Index: sem_cat.adb
===================================================================
--- sem_cat.adb (revision 165080)
+++ sem_cat.adb (working copy)
@@ -206,6 +206,17 @@ package body Sem_Cat is
and then In_Package_Body (Unit_Entity)
then
null;
+
+ -- Special case: Remote_Types can depend on Preelaborated per
+ -- Ada 2005 AI 0206.
+
+ elsif Unit_Category = Remote_Types
+ and then Is_Preelaborated (Depended_Entity)
+ then
+ null;
+
+ -- All other cases, we do have an error
+
else
Err := True;
end if;
More information about the Gcc-patches
mailing list