This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [PATCH] libstdc++: Fix exceptions being generated when compiling with -fno-exceptions
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Federico Lenarduzzi <federico dot lenarduzzi at tallertechnologies dot com>
- Cc: "libstdc++" <libstdc++ at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 14 Apr 2015 20:27:03 +0100
- Subject: Re: [PATCH] libstdc++: Fix exceptions being generated when compiling with -fno-exceptions
- Authentication-results: sourceware.org; auth=none
- References: <1429024679-17856-1-git-send-email-federico dot lenarduzzi at tallertechnologies dot com>
On 14 April 2015 at 16:17, Federico Lenarduzzi wrote:
> When the libstdc++ is compiled, the compiler sets the std::terminate_handler function with __verbose_terminate_handler() or std::abort() depending on _GLIBCXX_HOSTED && _GLIBCXX_VERBOSE being true or false.
>
> However, even if we compile with -fno-exceptions, the compiler will use __verbose_terminate_handler(), which uses exceptions. Therefore, the library is not fully exception-free.
I guess this makes sense, but you can just build with
--disable-libstdcxx-verbose to have the same effect.
> It also makes std::uncaught_exception() throw() return false if __EXCEPTIONS is not defined.
This part seems like a good idea, but we'll also need to do it to the
new uncaught_exceptions() function about to be added, so let's wait
until that in committed first (which will be shortly after the 5.1
release).
The checks should use __cpp_exceptions not __EXCEPTIONS, see the current trunk.