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,6426898aedaa5880 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns13feed!worldnet.att.net!208.49.83.146!uns-out.usenetserver.com!news.usenetserver.com!pc02.usenetserver.com!news.flashnewsgroups.com-b7.4zTQh5tI3A!not-for-mail Newsgroups: comp.lang.ada Subject: Re: Pragma for conditional compilation? (Ada 2005 vs. 95) References: <1190879769.361848.188220@22g2000hsm.googlegroups.com> From: Stephen Leake Date: Thu, 27 Sep 2007 05:52:14 -0400 Message-ID: User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/22.1 (windows-nt) Cancel-Lock: sha1:nlM78HDxhMUgqOnIa2tj2JtVSLo= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@flashnewsgroups.com Organization: FlashNewsgroups.com X-Trace: 0c4b646fb7d52e05e48ed08324 Xref: g2news2.google.com comp.lang.ada:2158 Date: 2007-09-27T05:52:14-04:00 List-Id: Jerry writes: > Is there a pragma to designate some lines of Ada for conditional > compilation depending on if the compiler is Ada 2005 or not? > > I have made some bindings that use some of the declarations from Annex > G.3 which relates to vector-matrix stuff which is new to Ada 2005. If > the compiler provides those declarations (i.e., is 2005), I want to > use the compiler's version because I figure that is the cleanest way > to get things done. If the compiler is Ada 95, I instead want to > provide the declarations myself. > > Currently, I handle this by commenting out the declarations of my own > if Ada 2005 and uncomment them if Ada 95. (There are a couple of > "with" and "use" lines that also have to be (un)commented but it is a > similar situation.) > > I'm guessing this is an Ada "no-no" but would be interested to know > for sure. There is no standard pragma that does this. GNAT provides the gnatprep tool, which is a preprocessor, that could do this. A more portable way is to have to different source files, and use the build tools to select the proper one. GNAT project files can do that. -- -- Stephe