comp.lang.ada
 help / color / mirror / Atom feed
From: "Sebastian" <sebastian.madunic@avionics.saab.se>
Subject: Pragma Import on arrays in record types
Date: Tue, 5 Nov 2002 08:13:39 +0100
Date: 2002-11-05T08:13:39+01:00	[thread overview]
Message-ID: <aq7qk6$sg8$1@newstoo.ericsson.se> (raw)

Hi,

Why do I get a compiler warning when I do an overlaid storage of a record
type consisting
of an array? See below.

When I use pragma Import on the object it works fine but what is the
compiler doing?

/S
with Interfaces; use Interfaces;

with Ada.Text_Io; use Ada.Text_Io;



procedure Array_Test is

type Flag_Type is (Reset, Set);

for Flag_Type'Size use 1;


------------------------------------------------------------------------

package Enum is new ada.text_io.enumeration_Io(Flag_Type);

use Enum;


------------------------------------------------------------------------

type Index_Type is (

Index_0, Index_1,  Index_2, Index_3,

Index_4, Index_5, Index_6, Index_7,

Index_8, Index_9, Index_10, Index_11,

Index_12, Index_13, Index_14, Index_15);

for Index_Type'Size use 16;


type Array_Of_Index_Type is array (Index_Type) of Flag_Type;


pragma pack(Array_Of_Index_Type);


------------------------------------------------------------------------

type Record_Type is

record

Gp_Flag_Command : Array_Of_Index_Type;

end record;


for Record_Type use

record

Gp_Flag_Command at 0 range 0 ..15;

end record;

pragma Volatile(Record_Type);


------------------------------------------------------------------------

Record_1 : Record_Type;

Record_2 : Record_Type;

-- pragma import(Ada, Device_2);


for Record_2'Address use Record_1'Address;


begin


null;

end Array_Test;






             reply	other threads:[~2002-11-05  7:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-05  7:13 Sebastian [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-11-05  7:35 Pragma Import on arrays in record types Grein, Christoph
replies disabled

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