comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Suggestion for gnatstub
Date: Sat, 9 Nov 2002 15:44:14 GMT
Date: 2002-11-09T15:44:14+00:00	[thread overview]
Message-ID: <wcck7jmg33l.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: x7vn0oizv5j.fsf@smaug.pushface.org

Simon Wright <simon@pushface.org> writes:

> My ColdFrame framework generator goes to a lot of trouble to generate
> compilable subprograms that raise Program_Error if executed. I think
> there is one case where this doesn't work (functions returning a value
> of an imported type, eg GNAT.Socket_Type, that turns out to be
> private).

Presuming the goal is to get the code to compile, but not run,
you could generate:

    function F(X, Y: Integer) return GNAT.Socket_Type is
    begin
        raise Program_Error;
        return F(X, Y); -- bogus return to keep compiler from griping
    end F;

Actually, I suspect the compiler might gripe about infinite recursion,
so maybe you need this:

    function F(X, Y: Integer) return GNAT.Socket_Type is
    begin
        raise Program_Error;
        pragma Warnings(Off);
        return F(X, Y); -- bogus return to keep compiler from griping
        pragma Warnings(On);
    end F;

Bleah.  It's pretty annoying that Ada requires a return statement on
paths that *obviously* raise exceptions.

- Bob



  parent reply	other threads:[~2002-11-09 15:44 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-08 11:14 Suggestion for gnatstub Victor Porton
2002-11-08 12:56 ` Marc A. Criley
2002-11-08 13:23   ` Marin David Condic
2002-11-08 21:09     ` chris.danx
2002-11-15 17:08       ` Wes Groleau
2002-11-15 17:35         ` Stephen Leake
2002-11-16 14:36         ` Marin David Condic
2002-11-09 14:15     ` Simon Wright
2002-11-09 14:50       ` Marin David Condic
2002-11-09 20:05         ` Simon Wright
2002-11-10 15:58           ` Marin David Condic
2002-11-10 20:31             ` Robert A Duff
2002-11-11 13:46               ` Marin David Condic
2002-11-11 15:31                 ` Robert A Duff
2002-11-11 20:32                   ` Randy Brukardt
2002-11-11  6:31             ` Simon Wright
2002-11-09 15:44       ` Robert A Duff [this message]
2002-11-09 20:08         ` Simon Wright
2002-11-09 21:56           ` Robert A Duff
2002-11-10  8:42             ` Pascal Obry
2002-11-10 12:20               ` Simon Wright
2002-11-10 16:04               ` Marin David Condic
2002-11-14 20:10               ` Robert I. 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