comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: [No_Elaboration_Code] GNAT still generating rep_to_pos, why?
Date: 03 Jan 2004 11:53:03 +0000
Date: 2004-01-03T11:53:03+00:00	[thread overview]
Message-ID: <x7visjtnt9c.fsf@smaug.pushface.org> (raw)
In-Reply-To: pan.2004.01.03.08.41.47.563693@n_o_p_o_r_k_a_n_d_h_a_m.abyss2.demon.co.uk

"Luke A. Guest" <laguest@n_o_p_o_r_k_a_n_d_h_a_m.abyss2.demon.co.uk> writes:

> This is my code:
> 
>   type T_SPB is
>     record
>       ...
>     end record;
> 
>   type T_SPB_PTR is access T_SPB;
> 
>   SP_Block : T_SPB;
>   for SP_Block'Address use System'To_Address(16#80001000#);
>   -- Tell the compiler that this record is defined elsewhere.
>   -- Stops the compiler from producing a warning.
>   pragma Import(Ada, SP_Block);

Not sure whether this will help ..

   with System.Storage_Elements;

   package Luke is

      type P is access Integer;
      pragma Suppress_Initialization (P);

      type R is record
         The_P : P;
      end record;
      pragma Suppress_Initialization (R);

      V : R;
      for V'Address use System.Storage_Elements.To_Address (16#80001000#);
   --     pragma Import (Ada, V);

   end Luke;

I found Suppress_Initialization at
http://gcc.gnu.org/onlinedocs/gnat_rm/Implementation-Defined-Pragmas.html#Implementation%20Defined%20Pragmas
but I don't know whether it is officially supported by ACT for the
future (I tried it with 3.15p and 5.01a, the latter is closer to the
GCC version).

The key was to apply the pragma to type P.

I've managed to get myself confused about which combination of
options/compiler produced which effect, but I get the impression that
there is a difference between 3.15p and 5.01a here ..

I'm not familiar with System'To_Address .. neater than the
Storage_Elements version, but more difficult to grep for in the
source!

-- 
Simon Wright                               100% Ada, no bugs.



  reply	other threads:[~2004-01-03 11:53 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-02 11:59 [No_Elaboration_Code] GNAT still generating rep_to_pos, why? Luke A. Guest
2004-01-02 17:51 ` Stephen Leake
2004-01-02 18:14   ` Luke A. Guest
2004-01-02 19:31     ` Per Sandberg
2004-01-02 19:46       ` Luke A. Guest
2004-01-02 21:17     ` Stephen Leake
2004-01-02 22:16       ` Luke A. Guest
2004-01-03  1:43         ` Stephen Leake
     [not found]         ` <87ekuhe5wq.fsf@news.sdbk.de>
2004-01-03  9:58           ` Luke A. Guest
2004-01-03  8:44       ` Luke A. Guest
2004-01-03  1:12     ` Robert I. Eachus
2004-01-03  8:41       ` Luke A. Guest
2004-01-03 11:53         ` Simon Wright [this message]
2004-01-03 12:20           ` Luke A. Guest
2004-01-04 12:26             ` Simon Wright
2004-01-03  1:41 ` sk
2004-01-03  2:29   ` Luke A. Guest
2004-01-03 10:48 ` Florian Weimer
2004-01-03 11:32   ` Luke A. Guest
2004-01-03 13:11     ` Florian Weimer
replies disabled

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