Re: [libstdc++ PATCH] Add support for std::uncaught_exceptions

2015-04-28 Thread Jonathan Wakely

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 jwak...@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;


Re: [libstdc++ PATCH] Add support for std::uncaught_exceptions

2015-04-27 Thread Jonathan Wakely

On 13/04/15 02:24 +0300, Ville Voutilainen wrote:

The patch is a bit large since it does the baseline_symbols regeneration
and other new-version api-dance.
Hence attached gzipped.

Tested on Linux x86-64.

2015-04-13  Ville Voutilainen  ville.voutilai...@gmail.com
   Add support for std::uncaught_exceptions.
   * acinclude.m4: Bump libtool_VERSION.
   * config/abi/post/x86_64-linux-gnu/baseline_symbols.txt: Regenerate.
   * config/abi/pre/gnu.ver: Export the new symbol.
   * configure: Bump libtool_VERSION.
   * libsupc++/eh_catch.cc(uncaught_exceptions): New.
   * libsupc++/exception(uncaught_exceptions): Ditto.
   * testsuite/18_support/uncaught_exceptions/uncaught_exceptions.cc: New.
   * testsuite/util/testsuite_abi.cc: Add 3.4.22 as the latest version.


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.

I also added the feature-test macro recommended by N4440 and changed
the new function to only be declared for -std=gnu++?? and -std=c++1z.
It's useful and easy to provide it for pre-C++17 as an extension.
commit c37d380f6eea816886147001e0e85932f02b756f
Author: Jonathan Wakely jwak...@redhat.com
Date:   Mon Apr 27 20:46:03 2015 +0100

2015-04-27  Ville Voutilainen  ville.voutilai...@gmail.com

	Add support for std::uncaught_exceptions.
	* acinclude.m4: Bump libtool_VERSION.
	* config/abi/pre/gnu.ver: Export the new symbol.
	* configure: Regenerate.
	* libsupc++/eh_catch.cc (uncaught_exceptions): New.
	* libsupc++/exception (uncaught_exceptions): New.
	* testsuite/18_support/uncaught_exceptions/uncaught_exceptions.cc: New.
	* testsuite/util/testsuite_abi.cc: Add 3.4.22 as the latest version.

diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index a1e301f..196b4ff 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -3383,7 +3383,7 @@ changequote([,])dnl
 fi
 
 # For libtool versioning info, format is CURRENT:REVISION:AGE
-libtool_VERSION=6:21:0
+libtool_VERSION=6:22:0
 
 # Everything parsed; figure out what files and settings to use.
 case $enable_symvers in
diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver
index 7b82ce8..4ed683c 100644
--- a/libstdc++-v3/config/abi/pre/gnu.ver
+++ b/libstdc++-v3/config/abi/pre/gnu.ver
@@ -178,7 +178,6 @@ GLIBCXX_3.4 {
 # std::[A-Zu-z]*;
 # std::underflow_error::u*;
 # std::underflow_error::~u*;
-  std::uncaught_exception*;
   std::unexpected*;
   std::[A-Zv-z]*;
   std::_List_node_base::hook*;
@@ -1024,6 +1023,9 @@ GLIBCXX_3.4 {
 _ZNSt6locale5_Impl19_M_replace_categoryEPKS0_PKPKNS_2idE;
 _ZNSt6locale5_Impl21_M_replace_categoriesEPKS0_i;
 
+# std::uncaught_exception()
+_ZSt18uncaught_exceptionv;
+
   # DO NOT DELETE THIS LINE.  Port-specific symbols, if any, will be here.
 
   local:
@@ -1860,6 +1862,12 @@ GLIBCXX_3.4.21 {
 
 } GLIBCXX_3.4.20;
 
+GLIBCXX_3.4.22 {
+
+# std::uncaught_exception()
+_ZSt19uncaught_exceptionsv;
+
+} GLIBCXX_3.4.21;
 
 # Symbols in the support library (libsupc++) have their own tag.
 CXXABI_1.3 {
diff --git a/libstdc++-v3/libsupc++/eh_catch.cc b/libstdc++-v3/libsupc++/eh_catch.cc
index 6302465..723ae56 100644
--- a/libstdc++-v3/libsupc++/eh_catch.cc
+++ b/libstdc++-v3/libsupc++/eh_catch.cc
@@ -139,3 +139,10 @@ std::uncaught_exception() throw()
   __cxa_eh_globals *globals = __cxa_get_globals ();
   return globals-uncaughtExceptions != 0;
 }
+
+int
+std::uncaught_exceptions() throw()
+{
+  __cxa_eh_globals *globals = __cxa_get_globals ();
+  return globals-uncaughtExceptions;
+}
diff --git a/libstdc++-v3/libsupc++/exception b/libstdc++-v3/libsupc++/exception
index d6c1855..069b33c 100644
--- a/libstdc++-v3/libsupc++/exception
+++ b/libstdc++-v3/libsupc++/exception
@@ -126,6 +126,11 @@ namespace std
*/
   bool uncaught_exception() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__));
 
+#if !defined(__STRICT_ANSI__) || __cplusplus  201402L
+#define __cpp_lib_uncaught_exceptions 201411
+  int uncaught_exceptions() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__));
+#endif
+
   // @} group exceptions
 } // namespace std
 
diff --git a/libstdc++-v3/testsuite/18_support/uncaught_exceptions/uncaught_exceptions.cc b/libstdc++-v3/testsuite/18_support/uncaught_exceptions/uncaught_exceptions.cc
new file mode 100644
index 000..001903e
--- /dev/null
+++ b/libstdc++-v3/testsuite/18_support/uncaught_exceptions/uncaught_exceptions.cc
@@ -0,0 +1,162 @@
+// Copyright (C) 2015 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY 

Re: [libstdc++ PATCH] Add support for std::uncaught_exceptions

2015-04-27 Thread Jonathan Wakely

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.
commit c595cfa88c9d38f333b262635a1c32744e3ce054
Author: Jonathan Wakely jwak...@redhat.com
Date:   Mon Apr 27 21:51:53 2015 +0100

2015-04-27  Ville Voutilainen  ville.voutilai...@gmail.com

	* config/abi/pre/gnu.ver: Fix comment.

diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver
index 4ed683c..2da04e4 100644
--- a/libstdc++-v3/config/abi/pre/gnu.ver
+++ b/libstdc++-v3/config/abi/pre/gnu.ver
@@ -1864,7 +1864,7 @@ GLIBCXX_3.4.21 {
 
 GLIBCXX_3.4.22 {
 
-# std::uncaught_exception()
+# std::uncaught_exceptions()
 _ZSt19uncaught_exceptionsv;
 
 } GLIBCXX_3.4.21;


Re: [libstdc++ PATCH] Add support for std::uncaught_exceptions

2015-04-16 Thread Jonathan Wakely

On 15/04/15 14:10 -0300, Daniel Gutson wrote:

You might want to check this thread
https://gcc.gnu.org/ml/libstdc++/2015-04/msg00104.html
which is specially useful when creating multilibs with and without exceptions
and enabling linker's sections garbage collection.
Maybe you could commit the change for both uncaught_exception and
uncaught_exceptions?


I'll be doing both commits.


Re: [libstdc++ PATCH] Add support for std::uncaught_exceptions

2015-04-15 Thread Daniel Gutson
Hi Ville,

On Sun, Apr 12, 2015 at 8:24 PM, Ville Voutilainen
ville.voutilai...@gmail.com wrote:
 The patch is a bit large since it does the baseline_symbols regeneration
 and other new-version api-dance.
 Hence attached gzipped.

 Tested on Linux x86-64.

 2015-04-13  Ville Voutilainen  ville.voutilai...@gmail.com
 Add support for std::uncaught_exceptions.
 * acinclude.m4: Bump libtool_VERSION.
 * config/abi/post/x86_64-linux-gnu/baseline_symbols.txt: Regenerate.
 * config/abi/pre/gnu.ver: Export the new symbol.
 * configure: Bump libtool_VERSION.
 * libsupc++/eh_catch.cc(uncaught_exceptions): New.

You might want to check this thread
https://gcc.gnu.org/ml/libstdc++/2015-04/msg00104.html
which is specially useful when creating multilibs with and without exceptions
and enabling linker's sections garbage collection.
Maybe you could commit the change for both uncaught_exception and
uncaught_exceptions?

  Daniel.

 * libsupc++/exception(uncaught_exceptions): Ditto.
 * testsuite/18_support/uncaught_exceptions/uncaught_exceptions.cc: New.
 * testsuite/util/testsuite_abi.cc: Add 3.4.22 as the latest version.



-- 

Daniel F. Gutson
Chief Engineering Officer, SPD

San Lorenzo 47, 3rd Floor, Office 5
Córdoba, Argentina

Phone:   +54 351 4217888 / +54 351 4218211
Skype:dgutson
LinkedIn: http://ar.linkedin.com/in/danielgutson


Re: [libstdc++ PATCH] Add support for std::uncaught_exceptions

2015-04-13 Thread Jonathan Wakely
On 13 April 2015 at 00:24, Ville Voutilainen wrote:
 The patch is a bit large since it does the baseline_symbols regeneration

That has been done on the trunk now.

 and other new-version api-dance.

Thanks, it'll have to wait until after 5.1 is released, as testing any
last minute fixes will be harder if we've already bumped the symbols
versions on trunk.


[libstdc++ PATCH] Add support for std::uncaught_exceptions

2015-04-12 Thread Ville Voutilainen
The patch is a bit large since it does the baseline_symbols regeneration
and other new-version api-dance.
Hence attached gzipped.

Tested on Linux x86-64.

2015-04-13  Ville Voutilainen  ville.voutilai...@gmail.com
Add support for std::uncaught_exceptions.
* acinclude.m4: Bump libtool_VERSION.
* config/abi/post/x86_64-linux-gnu/baseline_symbols.txt: Regenerate.
* config/abi/pre/gnu.ver: Export the new symbol.
* configure: Bump libtool_VERSION.
* libsupc++/eh_catch.cc(uncaught_exceptions): New.
* libsupc++/exception(uncaught_exceptions): Ditto.
* testsuite/18_support/uncaught_exceptions/uncaught_exceptions.cc: New.
* testsuite/util/testsuite_abi.cc: Add 3.4.22 as the latest version.


uncaught_exceptions.diff.gz
Description: GNU Zip compressed data