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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,11414a19b0e4a97a X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news1.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.bt.com!news.bt.com.POSTED!not-for-mail NNTP-Posting-Date: Sat, 21 Aug 2010 19:09:15 -0500 From: Brian Drummond Newsgroups: comp.lang.ada Subject: Re: Advice on selling Ada to a C shop Date: Sun, 22 Aug 2010 01:16:52 +0100 Reply-To: brian@shapes.demon.co.uk Message-ID: References: <101bf8f3-b823-45ee-9afd-40cbafb4b7a9@t26g2000prt.googlegroups.com> <4c1e0d26$0$2393$4d3efbfe@news.sover.net> <82d3va2psl.fsf@stephe-leake.org> <871v9ss4kg.fsf@ludovic-brenta.org> X-Newsreader: Forte Agent 1.7/32.534 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Usenet-Provider: http://www.giganews.com X-AuthenticatedUsername: NoAuthUser X-Trace: sv3-BK9g21pDVeSTYmXwI6k27xT/rxE+O+jkj+kqBNQcmJnCD5RRmgYNTxboUKdmA1YHxAE7YLfkn3vCCGG!qOoTS4bjbCdYANltbDFEgQo6/3yfOiFM8rL9T4IRO82ImXTXfXota50EhNZt2bzjEVxoxiTpINAn!htwY X-Complaints-To: abuse@btinternet.com X-DMCA-Complaints-To: abuse@btinternet.com X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 Xref: g2news1.google.com comp.lang.ada:13589 Date: 2010-08-22T01:16:52+01:00 List-Id: On Sat, 21 Aug 2010 11:22:39 +0200, Ludovic Brenta wrote: >"Yannick Duch�ne (Hibou57)" writes: >> Le Tue, 29 Jun 2010 10:42:18 +0200, Stephen Leake >> a �crit: >>> Yes, that's a non-starter. >>> >>> Be sure to mention GNAT's -fdump-ada-spec, which generates Ada package >>> specs from C code. That makes it _much_ easier to import C correctly. >> >> Is it a standard GCC option or does it requires a patched GCC ? I have >> built GCC and GNAT for a cross compiler some time ago, and do not >> remember there was such an option in the configuration choices. This >> may suggest �standard option�, but on the other hand, I cannot >> suppose this is a standard GCC option as it is Ada related and GNAT >> specific. >> >> Thanks to have mentioned this. > >It is a non-standard option insofar as it is not defined in the standard >(ARM). I suppose, because it's a C/C++ compiler feature, not really an Ada feature. >AFAICT, this feature is present in GCC >= 4.5 and in GNAT GPL Edition >= >2010. Doesn't seem to be present in 4.5.0-20100604 (on OpenSuse 11.3) but I'll welcome it in a near future version. It was in Gnat GPL 2009 where it had some problems but in Gnat 2010 it is significantly improved. It still doesn't make a very good job of translating templated classes and their instantiations; some hand editing of the prototypes is required. (a) If the base type was templated, look for missing base types in the derived type definition... occasional error I can't pin down concisely. (b) You may have to qualify references to a templated class with the name of the Ada package created to respect a templated type's instantiation. If you forgive the unchecked syntax fragments: template class Array2d public: ... instantiated with T=Mytype, gives package Array2d_Mytype type Array2d is ... but any generated references to this class will not be qualified by the package name. (c) if the C++ code doesn't call a templated function (including constructors), the C++ compiler won't instantiate it, so the linker will fail to find it for the Ada code to use. I worked around that with some C++ code that just made dummy calls to the functions I needed (or created dummy objects), but I expect there's a G++ compiler flag I overlooked to do that for me. Anyone know such a thing? All that being said, it never claimed to do the job completely. It's a very good start on automatic package spec definition, and beats the hell out of creating the specs by hand - Brian