comp.lang.ada
 help / color / mirror / Atom feed
From: sjw <simon.j.wright@mac.com>
Subject: Re: Code Statement
Date: Tue, 18 May 2010 08:05:41 -0700 (PDT)
Date: 2010-05-18T08:05:41-07:00	[thread overview]
Message-ID: <8242a424-5b09-4444-a3ed-7b45e159c46a@z17g2000vbd.googlegroups.com> (raw)
In-Reply-To: hsu3ok$gag$1@speranza.aioe.org

On May 18, 2:12 pm, johnj...@cox.net wrote:
> Trying to use the "Code Statement" for a special project, by passing the
> ASM proc/func. So, can Gnat process a true "Code Statement" statement?
>
> When I compile the following example using>gnat make temp.adb -gnatpg
>
> gcc -c -gnatpg temp.adb
> temp.adb:10:07: incorrect type for code statement
> gnatmake: "temp.adb" compilation error
>
> Source code:
>
>    package Machine_Code is
>
>        type Asm_Insn is new Integer;  --  type required by gant
>
>        x86_NOP    : constant Asm_Insn := 16#90#;
>
>        type M_Code_0  is record
>                          Opcode : Asm_Insn;
>        end record;
>        pragma Pack (M_Code_0);
>    end Machine_Code;
>
> Source code:
>
>    with Machine_Code;
>
>    procedure temp is
>
>        procedure Test;
>
>        procedure Test is
>           use Machine_Code;
>        begin
>           M_Code_0'(Opcode => x86_NOP);  -- line 10
>        end Test;
>
>    begin
>       null;
>    end temp;

See
http://booch95.svn.sourceforge.net/viewvc/booch95/trunk/src/bc-support-high_resolution_time-clock.adb-pentium?revision=1415&view=markup
for a working i586/x86_64 example.

Best not to use -gnatpg: -gnatp says 'suppress all checks', -gnatg
says 'GNAT implementation mode (used for compiling GNAT units)' -- I'm
pretty sure that that mode is like -Werror.



  parent reply	other threads:[~2010-05-18 15:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-18 13:12 Code Statement johnjohn
2010-05-18 13:22 ` Ludovic Brenta
2010-05-18 13:29 ` AdaMagica
2010-05-18 15:05 ` sjw [this message]
2010-05-19  4:37   ` anon
2010-05-19  6:07     ` Simon Wright
2010-05-19  9:56       ` sjw
2010-05-19 10:20         ` AdaMagica
replies disabled

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