comp.lang.ada
 help / color / mirror / Atom feed
* Interesting and possible buggy behavior in GNAT regarding Annex E pragmas.
@ 2011-05-25 14:54 Shark8
  2011-05-25 20:21 ` Ludovic Brenta
  0 siblings, 1 reply; 5+ messages in thread
From: Shark8 @ 2011-05-25 14:54 UTC (permalink / 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;



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-06-06 23:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-25 14:54 Interesting and possible buggy behavior in GNAT regarding Annex E pragmas Shark8
2011-05-25 20:21 ` Ludovic Brenta
2011-05-26  6:40   ` Michael R
2011-05-27 11:40     ` Stephen Leake
2011-06-06 23:43   ` Shark8

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