summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/bits
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2018-08-14 13:09:57 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2018-08-14 13:09:57 +0100
commit484e936e88e52d9e4e013bbc1b8264f556ff7cb4 (patch)
tree1227bb8ea48c20af0f5bac310dfeecfce9a1e3ac /libstdc++-v3/include/bits
parent3ffa55de6061011361d13d0ecb032c694556ebf7 (diff)
downloadgcc-484e936e88e52d9e4e013bbc1b8264f556ff7cb4.tar.gz
PR libstdc++/85343 overload __throw_ios_failure to take errno
[ios::failure] p2: "When throwing ios_base::failure exceptions, implementations should provide values of ec that identify the specific reason for the failure." This adds a new overload of __throw_ios_failure that can be passed errno, to store error_code(errno, system_category()) in the exception object. PR libstdc++/85343 * acinclude.m4 (libtool_VERSION): Bump version. * config/abi/pre/gnu.ver (GLIBCXX_3.4.26): Add new symbol version. Export new symbol. * configure: Regenerate. * doc/xml/manual/abi.xml: Document new versions. * include/bits/fstream.tcc (basic_filebuf<C, T>::underflow) (basic_filebuf<C, T>::xsgetn): Pass errno to __throw_ios_failure. * include/bits/functexcept.h (__throw_ios_failure(const char*, int)): Declare new overload. * src/c++11/cxx11-ios_failure.cc (__ios_failure): Add new constructor and static member function. (__throw_ios_failure(const char*, int)): Define. * src/c++98/ios_failure.cc [!_GLIBCXX_USE_DUAL_ABI] (__throw_ios_failure(const char*, int)): Define. * testsuite/util/testsuite_abi.cc: Update known and latest versions. From-SVN: r263535
Diffstat (limited to 'libstdc++-v3/include/bits')
-rw-r--r--libstdc++-v3/include/bits/fstream.tcc5
-rw-r--r--libstdc++-v3/include/bits/functexcept.h5
2 files changed, 8 insertions, 2 deletions
diff --git a/libstdc++-v3/include/bits/fstream.tcc b/libstdc++-v3/include/bits/fstream.tcc
index 6205db75340..ed98f13e0e0 100644
--- a/libstdc++-v3/include/bits/fstream.tcc
+++ b/libstdc++-v3/include/bits/fstream.tcc
@@ -38,6 +38,7 @@
#include <bits/cxxabi_forced.h>
#include <bits/move.h> // for swap
+#include <cerrno>
namespace std _GLIBCXX_VISIBILITY(default)
{
@@ -471,7 +472,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
"invalid byte sequence in file"));
else
__throw_ios_failure(__N("basic_filebuf::underflow "
- "error reading the file"));
+ "error reading the file"), errno);
}
return __ret;
}
@@ -717,7 +718,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__len = _M_file.xsgetn(reinterpret_cast<char*>(__s), __n);
if (__len == -1)
__throw_ios_failure(__N("basic_filebuf::xsgetn "
- "error reading the file"));
+ "error reading the file"), errno);
if (__len == 0)
break;
diff --git a/libstdc++-v3/include/bits/functexcept.h b/libstdc++-v3/include/bits/functexcept.h
index 6f6ffc5ee3b..9d5acdb3b55 100644
--- a/libstdc++-v3/include/bits/functexcept.h
+++ b/libstdc++-v3/include/bits/functexcept.h
@@ -95,8 +95,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__throw_ios_failure(const char*) __attribute__((__noreturn__));
void
+ __throw_ios_failure(const char*, int) __attribute__((__noreturn__));
+
+ // Helpers for exception objects in <system_error>
+ void
__throw_system_error(int) __attribute__((__noreturn__));
+ // Helpers for exception objects in <future>
void
__throw_future_error(int) __attribute__((__noreturn__));