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,1d27f1e3f05269e X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!kanaga.switch.ch!news-zh.switch.ch!switch.ch!news.ip-plus.net!newsfeed.ip-plus.net!news.post.ch!not-for-mail From: Martin Krischik Newsgroups: comp.lang.ada Subject: Re: pragma Convention questions Date: Mon, 12 Nov 2007 09:14:55 +0100 Organization: Swisscom IP+ (post doesn't reflect views of Swisscom) Message-ID: <47380ba1$1@news.post.ch> References: <87sl3cd9cw.fsf@willow.rfc1149.net> <2451589.tWPigV6bxQ@linux1.krischik.com> <87mytkcxfu.fsf@willow.rfc1149.net> NNTP-Posting-Host: 194.41.146.1 Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: atlas.ip-plus.net 1194855333 17567 194.41.146.1 (12 Nov 2007 08:15:33 GMT) X-Complaints-To: abuse@ip-plus.net NNTP-Posting-Date: Mon, 12 Nov 2007 08:15:33 +0000 (UTC) User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) In-Reply-To: <87mytkcxfu.fsf@willow.rfc1149.net> X-Original-NNTP-Posting-Host: w03duo.pnet.ch X-Original-Trace: 12 Nov 2007 09:15:29 +0200, w03duo.pnet.ch Xref: g2news1.google.com comp.lang.ada:18298 Date: 2007-11-12T09:14:55+01:00 List-Id: Samuel Tardieu schrieb: >>>>>> "Martin" == Martin Krischik writes: > > Martin> Yes. However the type must not be used beforehand - which is > Martin> unlikely. Real language lawyers can tell you the term after > Martin> which a type can not have any further modifications. > > Thank you, I know the freezing rules and they would not be > violated. My question was related to the legality of doing that when > I could not find the RM section which allows you to change the default > convention (Ada) of language-defined types (Interfaces.C.Strings.chars_ptr). I think the RM always stops at "private" leaving the implementer to do whatever they want in the private section. I have seen private sections full of pragma Import. > Martin> F does not actually exist and therefore has no address to > Martin> access. And for "Convention Ada" that's ok. What you really > Martin> meant to do is: > > Martin> pragma Export (Ada, F); > > I don't think so, pragma Convention should be enough. Note that > renaming an existing function instead of an enumeration literal > doesn't exhibit the same behaviour. I don't think so. Unless you export a function/procedure I would think the function/procedure is fair game to be optimized away by a smart linker. > Martin> But somehow I think that will fail because F does exists > Martin> physically. > > It doesn't exist physically because it inherits the convention of the > renamed entity (the enumeration literal, which has an Intrinsic > convention). That's precisely why I don't understand why GNAT lets me > specify its convention if it isn't able to honour it. Question is: > Note that the fact that an enumeration literal doesn't exist > physically as a function doesn't prevent you from using it as a > generic actual subprogram: > > package W is > generic > with function F return Boolean; > package Gen is end Gen; > package Inst is new Gen (False); > end W; But here F can be inline expanded - so intrinsic is ok. > (however, legality rules prevent you from ever taking a 'Access from > inside the generic as formal subprograms are not subtype conformant > with anything else, so my question would be void in this case) > > The more I think about it the more I think GNAT should refuse the > pragma Convention, just as it refuses it if you try to apply it > directly to an enumeration literal. That's why I'd like some advice > here. I'll ask ada-comment, I hadn't thought about it, thanks. I think you are right and it probably is a compiler bug. Martin -- mailto://krischik@users.sourceforge.net Ada programming at: http://ada.krischik.com