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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.107.162.142 with SMTP id l136mr21377786ioe.16.1511724700787; Sun, 26 Nov 2017 11:31:40 -0800 (PST) X-Received: by 10.157.95.5 with SMTP id f5mr1549814oti.9.1511724700714; Sun, 26 Nov 2017 11:31:40 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.kjsl.com!usenet.stanford.edu!193no472739itr.0!news-out.google.com!x87ni4725ita.0!nntp.google.com!i6no6885789itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 26 Nov 2017 11:31:40 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2601:191:8303:2100:5985:2c17:9409:aa9c; posting-account=fdRd8woAAADTIlxCu9FgvDrUK4wPzvy3 NNTP-Posting-Host: 2601:191:8303:2100:5985:2c17:9409:aa9c References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <5e77d738-29d1-46db-aad1-24560acda13f@googlegroups.com> Subject: Re: Wrong GNAT warning. How to suppress it? From: Robert Eachus Injection-Date: Sun, 26 Nov 2017 19:31:40 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: feeder.eternal-september.org comp.lang.ada:49168 Date: 2017-11-26T11:31:40-08:00 List-Id: On Saturday, November 25, 2017 at 1:03:24 PM UTC-5, Victor Porton wrote: > How to eliminate the GNAT warning in the below program? For the record, pragma No_Return is deprecated (J.15.2) in favor of aspect = No_Return: procedure Fatal_Error(M: Message); with No_Return; That allows the compiler to optimize the calling side, for example by not s= aving register values. But keep in mind that when GNAT warns you about a function with a path that= does not lead to a return statement or raise statement, it is warning abou= t an error that can occur at run-time. Yes, you will get Program_Error rai= sed, but sometimes that will unexpectedly be handled by a when others handl= er. What I do is have a package: package To_Be_Done is procedure TBD(Which: Integer :=3D 0); with No_Return; function TBD(Which: Integer :=3D 0) return Integer; -- and a few other cases end To_Be_Done; One advantage of this is that you never check in To_Be_Done for the release= (not debug) version. Can you 'ship' with TBDs? Of course, but if you int= end to do that, you want a version of the To_Be_Done package which is custo= mer friendly, and doesn't splat debug info all over the screen. The value Which if passed is expected to be the number in the bug list for = this particular case. I'd like to use aspect No_Return for the functions, = but, for whatever reason it is limited to procedures and generic procedures= .