From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,69431b06fe9a3239 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder.news-service.com!news.netcologne.de!newsfeed-fusi2.netcologne.de!newsfeed.straub-nv.de!noris.net!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Sun, 10 Apr 2011 22:47:42 +0200 From: Georg Bauhaus User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: How do I disable elaboration code on this References: <58bc4fb4-5f6a-48d6-9c98-0dde7ac619df@p16g2000vbo.googlegroups.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <4da2176e$0$6977$9b4e6d93@newsspool4.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 10 Apr 2011 22:47:43 CEST NNTP-Posting-Host: b11ad98d.newsspool4.arcor-online.net X-Trace: DXC=JC^7lYZOi`l[F<50eo:0kn4IUKejVh3_Y?WO:g;laShS6?WP@A On 4/10/11 7:20 PM, Lucretia wrote: >> I think what you need here is >> >> Vector : constant Vectors; >> pragma Import (Ada, Vector); >> for Vector'Address use Addr; >> >> since you don't want Vector to be initialized. >> >> Vector will not be initialized because you have pragma Import for it. > > Nope, this didn't work. Checked the RM. Seems that if I use pragma > Import (Ada, Vector) then the compiler assumes that this is an > external (possibly in ASM) that is already initialised and therefore > cannot be initialized to my ISR subprograms. Don't know whether the following just silences the compiler or whether it solves the elaboration code issue. (The issue seems to appear with variables that have an address clause specified. There code below seems to result in two _init procedures, one for CbW and one for Vectors; the assembly listing shows a number of moves related to Vectors). The idea was to replace Cb with a limited record CbW that has a Cb component. The component is default initialized to point to Dummy. pragma Restrictions (No_Elaboration_Code); with System; package ISR is procedure Dummy; pragma Convention (C, Dummy); private type Cb is not null access procedure; pragma Convention (C, Cb); type CbW is limited record C : Cb := Dummy'Access; end record; type Vectors is array (1 .. 4) of CbW; pragma Convention (C, Vectors); Addr : constant System.Address := System'To_Address (16#0000_0000#); Vector : Vectors; pragma Import (Ada, Vector); for Vector'Address use Addr; end ISR; package body ISR is procedure Dummy is begin null; end Dummy; end ISR;