SPAM: Re: -fno-exceptions documentation

Paolo Carlini pcarlini@suse.de
Thu Dec 8 14:01:00 GMT 2005


Peter Dimov wrote:

> I'm not familiar with the internal structure of libstdc++, so please
> forgive me if I'm not making any sense.
>
> Howard's request was to come up with a way that would allow libstdc++
> to work with
>
> 1. Programs compiled without -fno-exceptions
>
> and
>
> 2. Programs compiled with -fno-exceptions
>
> without a recompile of libstdc++.
>
> The approach I present achieves this by making libstdc++ (and
> libsupc++) issue calls to X<void>::throw_...; since these functions
> are declared but not defined when _EXCEPTION_NEUTRAL is in effect,
> this will result in libstdc++ containing unresolved references to
> these functions.
>
> When a program includes a libstdc++ header, these functions will be
> defined as either throwing or aborting depending on the current state
> of __EXCEPTIONS, then an explicit template instantiation will inject
> these definitions into the .o file that is produced.
>
> These definitions will satisfy the unresolved references in libstdc++
> and libsupc++ when the program is linked.

Ah, now I see! You mean, when the library itself is built (libsupc++, in
particular), _EXCEPTION_NEUTRAL is defined. Then, when the headers are
included, _EXCEPTION_NEUTRAL is *not* defined, and, depending on
__EXCEPTIONS the appropriate definition is used.

I like the idea.

Maybe I have a concern, however: I think people are also using libsupc++
*alone*, without the rest of the libstdc++ library, I'm not sure what we
should do in that case...

Paolo.



More information about the Libstdc++ mailing list