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 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: "G.B." Newsgroups: comp.lang.ada Subject: Re: Can .ads be compiled alone? Date: Fri, 07 Nov 2014 17:29:03 +0100 Organization: A noiseless patient Spider Message-ID: References: <520f8f3d-b345-4ef8-ac41-ead78edde92a@googlegroups.com> Reply-To: nonlegitur@futureapps.de Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Fri, 7 Nov 2014 16:28:54 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="b96887e80893c84a90c3007226ca0d1c"; logging-data="19213"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Mlw6Xqxq1Vwp/C+Xs/UU3lGipbWr+AJU=" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: Cancel-Lock: sha1:vH68uFniL39WXoHE7z87aVcRBls= Xref: news.eternal-september.org comp.lang.ada:23062 Date: 2014-11-07T17:29:03+01:00 List-Id: On 07.11.14 16:49, Björn Lundin wrote: > On 2014-11-07 15:54, Tero Koskinen wrote: >> 7.11.2014 9:48, Chris Moore wrote: >>> You cannot generate code from a spec. >> >> I think this isn't true anymore for Ada 2012? >> > > It was never true, if the body was not needed As always, the ~*~ GNAT User's Guide ~*~ is a helpful source of information about using GNAT. It's free and it is included with every installation of GNAT. (I should offer an initial donation of $10 to a team tasked with creating a nice video of someone presenting just its first sections in a skilful way, on camera. People don't want to read, even when the Guide is very well written. But they do want to watch.) Here is the relevant section(*): 3.1 Compiling Programs ====================== (...) You need _not_ compile the following files * the spec of a library unit which has a body * subunits because they are compiled as part of compiling related units. GNAT package specs when the corresponding body is compiled, and subunits when the parent is compiled. If you attempt to compile any of these files, you will get one of the following error messages (where FFF is the name of the file you compiled): cannot generate code for file FFF (package spec) to check package spec, use -gnatc cannot generate code for file FFF (missing subunits) to check parent unit, use -gnatc cannot generate code for file FFF (subprogram spec) to check subprogram spec, use -gnatc cannot generate code for file FFF (subunit) to check subunit, use -gnatc As indicated by the above error messages, if you want to submit one of these files to the compiler to check for correct semantics without generating code, then use the `-gnatc' switch. __ (*) It would be nice to see GNAT's documentation linked at stackexchange.