comp.lang.ada
 help / color / mirror / Atom feed
From: Victor Porton <porton@narod.ru>
Subject: Re: Wrong GNAT warning. How to suppress it?
Date: Sat, 25 Nov 2017 20:27:33 +0200
Date: 2017-11-25T20:27:33+02:00	[thread overview]
Message-ID: <ovccml$1dbb$1@gioia.aioe.org> (raw)
In-Reply-To: ovcb98$1a93$1@gioia.aioe.org

Victor Porton wrote:

> How to eliminate the GNAT warning in the below program?
> 
> $ gcc-7 -c main.adb
> main.adb:13:05: warning: "return" statement missing following this
> statement main.adb:13:05: warning: Program_Error may be raised at run time
> 
> 
> procedure Main is
> 
>   procedure My_Raise is
>   begin
>     raise Constraint_Error;
>   end;
> 
>   function F (I: Integer) return Integer is
>   begin
>     if I = 0 then
>       return 1;
>     end if;
>     My_Raise;
>   end;
> 
> begin
>   null;
> end;

The issue was solved by adding pragma No_Return to My_Raise procedure.

-- 
Victor Porton - http://portonvictor.org

  parent reply	other threads:[~2017-11-25 18:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-25 18:03 Wrong GNAT warning. How to suppress it? Victor Porton
2017-11-25 18:09 ` Pascal Obry
2017-11-25 18:27 ` Victor Porton [this message]
2017-11-25 19:03   ` Pascal Obry
2017-11-26 19:31 ` Robert Eachus
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox