This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [libstdc++ PATCH] Add support for std::uncaught_exceptions
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: Ville Voutilainen <ville dot voutilainen at gmail dot com>
- Cc: libstdc++ at gcc dot gnu dot org, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 28 Apr 2015 13:09:00 +0100
- Subject: Re: [libstdc++ PATCH] Add support for std::uncaught_exceptions
- Authentication-results: sourceware.org; auth=none
- References: <CAFk2RUZVEL2fk4AGeTzzXX=09UtAiyUScxXomo8xz6rFo2=oag at mail dot gmail dot com> <20150427204029 dot GQ3618 at redhat dot com> <20150427205322 dot GR3618 at redhat dot com>
On 27/04/15 21:53 +0100, Jonathan Wakely wrote:
On 27/04/15 21:40 +0100, Jonathan Wakely wrote:
Tested x86_64-linux and powerpc64le-linux. Committed to trunk.
The baseline_symbols changes aren't needed now and I tweaked the
gnu.ver file slightly.
Ville noticed a typo in a comment I added, fixed like so.
One further tweak to add a doxygen comment and test the feature-test
macro is correct.
Tested x86_64-linux, committed to trunk.
commit 735307c6ba52a958da314aca09a1bf8ca8210a63
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Mon Apr 27 22:33:26 2015 +0100
* libsupc++/exception (uncaught_exceptions): Add comment. Reorder #if.
* testsuite/18_support/uncaught_exceptions/uncaught_exceptions.cc:
Use -std=gnu++1z. Check feature-test macro.
diff --git a/libstdc++-v3/libsupc++/exception b/libstdc++-v3/libsupc++/exception
index 069b33c..5571fd9 100644
--- a/libstdc++-v3/libsupc++/exception
+++ b/libstdc++-v3/libsupc++/exception
@@ -126,8 +126,9 @@ namespace std
*/
bool uncaught_exception() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__));
-#if !defined(__STRICT_ANSI__) || __cplusplus > 201402L
+#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++98
#define __cpp_lib_uncaught_exceptions 201411
+ /// The number of uncaught exceptions.
int uncaught_exceptions() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__));
#endif
diff --git a/libstdc++-v3/testsuite/18_support/uncaught_exceptions/uncaught_exceptions.cc b/libstdc++-v3/testsuite/18_support/uncaught_exceptions/uncaught_exceptions.cc
index 001903e..c65da5f 100644
--- a/libstdc++-v3/testsuite/18_support/uncaught_exceptions/uncaught_exceptions.cc
+++ b/libstdc++-v3/testsuite/18_support/uncaught_exceptions/uncaught_exceptions.cc
@@ -15,12 +15,18 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// { dg-options "-std=gnu++11" }
+// { dg-options "-std=gnu++1z" }
#include <cassert>
#include <exception>
#include <testsuite_hooks.h>
+#ifndef __cpp_lib_uncaught_exceptions
+# error "Feature-test macro for uncaught_exceptions missing"
+#elif __cpp_lib_uncaught_exceptions != 201411
+# error "Feature-test macro for uncaught_exceptions has wrong value"
+#endif
+
struct UncaughtVerifier
{
int expected_count_ = 0;