[Ada] Remote types packages can depend on preelaborated packages

Message ID 20101008125719.GA12965@adacore.com
State New
Headers show

Commit Message

Arnaud Charlet Oct. 8, 2010, 12:57 p.m.
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;
   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.


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)
+         --  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
             Err := True;
          end if;