diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2022-05-12 14:18:53 +0100 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2022-05-13 20:40:04 +0100 |
commit | c829b04bc3e1dcd4b06fa3bc2e62dd2d1eb0b036 (patch) | |
tree | 8725c00e5962e393828ad784cba95a07874ad977 | |
parent | c470f3ea86a28caacb9e9124307c4a03b2396288 (diff) | |
download | gcc-c829b04bc3e1dcd4b06fa3bc2e62dd2d1eb0b036.zip gcc-c829b04bc3e1dcd4b06fa3bc2e62dd2d1eb0b036.tar.gz gcc-c829b04bc3e1dcd4b06fa3bc2e62dd2d1eb0b036.tar.bz2 |
libstdc++: Allow std::swap to find overload for std::exception_ptr
The non-member swap for std::exception_ptr is in a nested namespace and
so can only be found by ADL currently. Add a using-declaration so that
qualified std::swap calls will use the std::exception_ptr::swap member,
instead of the generic std::swap.
There's no new test for this, because the generic std::swap works, it
just does more work than is necessary.
Also tell Doxygen to replace the __exception_ptr namespace with
"__unspecified__" in the generate docs, so the real name is not
documented.
libstdc++-v3/ChangeLog:
* doc/doxygen/user.cfg.in (PREDEFINED): Replace __exception_ptr
with "__unspecified__".
* libsupc++/exception_ptr.h: Improve doxygen docs.
(__exception_ptr::swap): Also declare in namespace std.
-rw-r--r-- | libstdc++-v3/doc/doxygen/user.cfg.in | 1 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/exception_ptr.h | 19 |
2 files changed, 16 insertions, 4 deletions
diff --git a/libstdc++-v3/doc/doxygen/user.cfg.in b/libstdc++-v3/doc/doxygen/user.cfg.in index c034b86..57270bd 100644 --- a/libstdc++-v3/doc/doxygen/user.cfg.in +++ b/libstdc++-v3/doc/doxygen/user.cfg.in @@ -2408,6 +2408,7 @@ PREDEFINED = __cplusplus=202002L \ _GLIBCXX_HAVE_BUILTIN_LAUNDER \ "_GLIBCXX_DOXYGEN_ONLY(X)=X " \ __allocator_base=std::__new_allocator \ + __exception_ptr=__unspecified__ \ # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The diff --git a/libstdc++-v3/libsupc++/exception_ptr.h b/libstdc++-v3/libsupc++/exception_ptr.h index 21c53f6..fd9ceec 100644 --- a/libstdc++-v3/libsupc++/exception_ptr.h +++ b/libstdc++-v3/libsupc++/exception_ptr.h @@ -65,9 +65,12 @@ namespace std _GLIBCXX_VISIBILITY(default) using __exception_ptr::exception_ptr; - /** Obtain an exception_ptr to the currently handled exception. If there - * is none, or the currently handled exception is foreign, return the null - * value. + /** Obtain an exception_ptr to the currently handled exception. + * + * If there is none, or the currently handled exception is foreign, + * return the null value. + * + * @since C++11 */ exception_ptr current_exception() _GLIBCXX_USE_NOEXCEPT; @@ -79,10 +82,16 @@ namespace std _GLIBCXX_VISIBILITY(default) namespace __exception_ptr { - using std::rethrow_exception; + using std::rethrow_exception; // So that ADL finds it. /** * @brief An opaque pointer to an arbitrary exception. + * + * The actual name of this type is unspecified, so the alias + * `std::exception_ptr` should be used to refer to it. + * + * @headerfile exception + * @since C++11 (but usable in C++98 as a GCC extension) * @ingroup exceptions */ class exception_ptr @@ -231,6 +240,8 @@ namespace std _GLIBCXX_VISIBILITY(default) } // namespace __exception_ptr + using __exception_ptr::swap; // So that std::swap(exp1, exp2) finds it. + /// Obtain an exception_ptr pointing to a copy of the supplied object. #if (__cplusplus >= 201103L && __cpp_rtti) || __cpp_exceptions template<typename _Ex> |