comp.lang.ada
 help / color / mirror / Atom feed
From: Shark8 <onewingedshark@gmail.com>
Subject: Interesting and possible buggy behavior in GNAT regarding Annex E pragmas.
Date: Wed, 25 May 2011 07:54:00 -0700 (PDT)
Date: 2011-05-25T07:54:00-07:00	[thread overview]
Message-ID: <c188806d-3a53-4b6b-a364-0e23ef083981@14g2000yqo.googlegroups.com> (raw)

Hi everyone.
I was experimenting with partitioning-pragmas trying to decide on a
good way to set up my PostScript interpreter so that the parser could
be a remote object possibly servicing multiple clients and I came
across a possible bug that is bothering me. In certain instances using
one of the pragmas will cause the compiler to error-out, as is
expected, but in other cases the compiler does not error out.

The only way I can see this happening is if, by WITH-ing these
children units, the parent units are LIMITED WITH-ed; but that is
counter-intuitive and does not allow for USES (which still compile) of
the parent unit.

I have reduced things to the minimal compilable example and the source
is as follows:

---------------------- Example_1
With Ada.Tags;
Package Example_1 is
   -- Simple package spec which has a Stub function using the
Ada.Tags.Tag-type
   -- in a parameter; compiles.

   Procedure Stub( This_Tag : In Ada.Tags.Tag );

End Example_1;

---------------------- Example_2
With Ada.Tags;
Package Example_2 is
   -- Simple package spec which has a Stub function using the
Ada.Tags.Tag-type
   -- in a parameter and the Pragma Remote_Types has been added;
   --	THIS DOES NOT COMPILE
   --	example_2.ads:1:06: cannot depend on "Tags" (wrong
categorization)


   Pragma Remote_Types;

   Procedure Stub( This_Tag : In Ada.Tags.Tag );

End Example_2;

---------------------- Example_3
With Ada.Tags.Generic_Dispatching_Constructor;
--Use Ada.Tags; -- Uncomment this line and it STILL compiles...
Package Example_3 is
   -- Simple package spec which has a Stub function using the
Ada.Tags.Tag-type
   -- in a parameter and the Pragma Remote_Types has been added; but
the WITH
   -- for that tipe is implicit in the WITH-ing of the Dispatching
Constructor.
   --	THIS DOES NOT COMPILE
   --	example_2.ads:1:06: cannot depend on "Tags" (wrong
categorization)


   Pragma Remote_Types;

   Procedure Stub( This_Tag : In Ada.Tags.Tag );

End Example_3;

---------------------- Example Bodies
With Ada.Text_IO;

Package Body Example_# is
   -- Simple package body which has a Stub function using the
Ada.Tags.Tag-type
   -- in a parameter; this is the same (excepting the name) for all
examples.

   Procedure Stub( This_Tag : In Ada.Tags.Tag ) is
      S : String:= Ada.Tags.External_Tag( This_Tag );
   begin
      Ada.Text_IO.Put_Line( S );
   end Stub;

End Example_#;

---------------------- Experiment.adb

With
Ada.Text_IO,
     Example_1,      -- This compiles, there is nothing special about
it
--     Example_2,    -- This does not compile, as expected, the
Categorization is wrong
     Example_3       -- This *DOES* compile though...
;

with ada.Integer_Text_IO;
Procedure Experiment is

   Use Ada.Text_IO;
Begin

   Put_Line( "Terminating." );

End Experiment;



             reply	other threads:[~2011-05-25 14:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-25 14:54 Shark8 [this message]
2011-05-25 20:21 ` Interesting and possible buggy behavior in GNAT regarding Annex E pragmas Ludovic Brenta
2011-05-26  6:40   ` Michael R
2011-05-27 11:40     ` Stephen Leake
2011-06-06 23:43   ` Shark8
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox