[PATCH] PR libstdc++/85222 allow catching iostream errors as gcc4-compatible ios::failure
Jonathan Wakely
jwakely.gcc@gmail.com
Thu Apr 12 16:04:00 GMT 2018
On 10 April 2018 at 00:36, Jonathan Wakely wrote:
> Define a new exception type derived from std::ios::failure[abi:cxx11]
> which also aggregates an object of the gcc4-compatible ios::failure
> type. Make __throw_ios_failure throw this new type for iostream errors
> that raise exceptions. Provide custom type info for the new type so that
> it can be caught by handlers for the gcc4-compatible ios::failure type
> as well as handlers for ios::failure[abi:cxx11] and its bases.
>
> PR libstdc++/85222
> * src/c++11/Makefile.am [ENABLE_DUAL_ABI]: Add special rules for
> cxx11-ios_failure.cc to rewrite type info for __ios_failure.
> * src/c++11/Makefile.in: Regenerate.
> * src/c++11/cxx11-ios_failure.cc (__ios_failure, __iosfail_type_info):
> New types.
> [_GLIBCXX_USE_DUAL_ABI] (__throw_ios_failure): Define here.
> * src/c++11/ios.cc (__throw_ios_failure): Remove definition.
> * src/c++98/ios_failure.cc (__construct_ios_failure)
> (__destroy_ios_failure, is_ios_failure_handler): New functions.
> [!_GLIBCXX_USE_DUAL_ABI] (__throw_ios_failure): Define here.
> * testsuite/27_io/ios_base/failure/dual_abi.cc: New.
> * testsuite/27_io/basic_ios/copyfmt/char/1.cc: Revert changes to
> handler types, to always catch std::ios_base::failure.
> * testsuite/27_io/basic_ios/exceptions/char/1.cc: Likewise.
> * testsuite/27_io/basic_istream/extractors_arithmetic/char/
> exceptions_failbit.cc: Likewise.
> * testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/
> exceptions_failbit.cc: Likewise.
> * testsuite/27_io/basic_istream/extractors_other/char/
> exceptions_null.cc: Likewise.
> * testsuite/27_io/basic_istream/extractors_other/wchar_t/
> exceptions_null.cc: Likewise.
> * testsuite/27_io/basic_istream/sentry/char/12297.cc: Likewise.
> * testsuite/27_io/basic_istream/sentry/wchar_t/12297.cc: Likewise.
> * testsuite/27_io/basic_ostream/inserters_other/char/
> exceptions_null.cc: Likewise.
> * testsuite/27_io/basic_ostream/inserters_other/wchar_t/
> exceptions_null.cc: Likewise.
> * testsuite/27_io/ios_base/storage/2.cc: Likewise.
>
> Tested x86_64-linux and powerpc64-linux, with the default config, and
> --disable-libstdcxx-dual-abi, and
> --with-default-libstdcxx-abi=gcc4-compatible. I intend to commit this
> to trunk and gcc-7-branch soon.
This removes the #define for _GLIBCXX_USE_CXX11_ABI from the top of
src/c++11/ios.cc, because __throw_ios_failure is no longer defined
there.
Tested as before, committed to trunk.
-------------- next part --------------
commit 845d8dc521d0958b625f2bc691b284e221009929
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Wed Apr 11 13:47:31 2018 +0100
Remove #define made redundant by r259281
The definition of __throw_ios_failure is no longer in this file, so
setting the macro here is unnecessary.
* src/c++11/ios.cc: Remove redundant macro definition.
diff --git a/libstdc++-v3/src/c++11/ios.cc b/libstdc++-v3/src/c++11/ios.cc
index e928c594149..82063e4b2f5 100644
--- a/libstdc++-v3/src/c++11/ios.cc
+++ b/libstdc++-v3/src/c++11/ios.cc
@@ -26,10 +26,6 @@
// ISO C++ 14882: 27.4 Iostreams base classes
//
-// Determines the version of ios_base::failure thrown by __throw_ios_failure.
-// If !_GLIBCXX_USE_DUAL_ABI this will get undefined automatically.
-#define _GLIBCXX_USE_CXX11_ABI 1
-
#include <ios>
#include <limits>
More information about the Libstdc++
mailing list