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=unavailable 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: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: How to compile Barnes' examples from his book using GNAT Date: Sun, 6 Dec 2015 11:17:29 -0700 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <2c68ffdd-f55e-4c68-84f1-fbe0f83a0b57@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Date: Sun, 6 Dec 2015 18:15:04 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="caa759af2a9c666aec02942f6fe5abd6"; logging-data="28729"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19hJ1uiZ4TDvK0TdEyaOJdO6sSrFjk3+6Q=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 In-Reply-To: Cancel-Lock: sha1:xEGGLBDMTsI8f+fExgteVV4LJQk= X-Enigmail-Draft-Status: N1110 Xref: news.eternal-september.org comp.lang.ada:28671 Date: 2015-12-06T11:17:29-07:00 List-Id: On 12/06/2015 04:24 AM, Brian Drummond wrote: > > So, > gnatchop XPROG6.txt > gnatmake tower_of_hanoi.adb > > Job done. Almost. However, with no options, GNAT is not an Ada compiler. It doesn't insert integer-overflow checks, stack-overflow checks, assertion checks, pre- and post-condition checks, predicate checks, or invariant checks. The programs may behave differently without these checks than described in the book. In addition, it uses GNAT's static elaboration order rather than doing elaboration as described in the ARM. This shouldn't affect the behavior of the programs, though, so it's not really important. The options to include all the checks in the ARM are -gnatao -fstack-check The option to use ARM elaboration is -gnatE. Since we have to type options to get an Ada compiler, one might also want to use -gnatn -gnatwa -O2 to turn on cross-unit inlining, turn on all warnings, and perform some optimization. The available options are described in detail in the top-secret GNAT User's Guide: http://docs.adacore.com/gnat_ugn-docs/html/gnat_ugn/gnat_ugn.html -- Jeff Carter "I wave my private parts at your aunties." Monty Python & the Holy Grail 13