diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2016-03-24 18:13:40 +0000 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2016-03-24 18:13:40 +0000 |
commit | 00e6c25ac8e7129a76deb68df0766d8736fc8442 (patch) | |
tree | d91ee6d8550551a5b75ada8c1eeaec54d0d0d7a5 /libstdc++-v3 | |
parent | 52228180f1e50cbb082c843b933dc87d573dbfe6 (diff) | |
download | gcc-00e6c25ac8e7129a76deb68df0766d8736fc8442.zip gcc-00e6c25ac8e7129a76deb68df0766d8736fc8442.tar.gz gcc-00e6c25ac8e7129a76deb68df0766d8736fc8442.tar.bz2 |
libstdc++/69945 Add __gnu_cxx::__freeres hook
PR libstdc++/69945
* config/abi/pre/gnu.ver: Add new symbol.
* libsupc++/eh_alloc.cc (__gnu_cxx::__freeres): Define.
* testsuite/18_support/free_eh_pool.cc: New test.
From-SVN: r234465
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/ChangeLog | 7 | ||||
-rw-r--r-- | libstdc++-v3/config/abi/pre/gnu.ver | 2 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/eh_alloc.cc | 19 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/18_support/free_eh_pool.cc | 35 |
4 files changed, 63 insertions, 0 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index a2cb3d7..4e6db2a 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2016-03-24 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/69945 + * config/abi/pre/gnu.ver: Add new symbol. + * libsupc++/eh_alloc.cc (__gnu_cxx::__freeres): Define. + * testsuite/18_support/free_eh_pool.cc: New test. + 2016-03-23 Bernd Edlinger <bernd.edlinger@hotmail.de> * include/Makefile.am (install-freestanding-headers): Add diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver index 41069d1..5c6b0fe 100644 --- a/libstdc++-v3/config/abi/pre/gnu.ver +++ b/libstdc++-v3/config/abi/pre/gnu.ver @@ -2148,6 +2148,8 @@ CXXABI_1.3.10 { _ZGTtNKSt13bad_exceptionD1Ev; _ZGTtNKSt13bad_exception4whatEv; + _ZN9__gnu_cxx9__freeresEv; + } CXXABI_1.3.9; # Symbols in the support library (libsupc++) supporting transactional memory. diff --git a/libstdc++-v3/libsupc++/eh_alloc.cc b/libstdc++-v3/libsupc++/eh_alloc.cc index 6973af3..d362e40 100644 --- a/libstdc++-v3/libsupc++/eh_alloc.cc +++ b/libstdc++-v3/libsupc++/eh_alloc.cc @@ -73,6 +73,10 @@ using namespace __cxxabiv1; # define EMERGENCY_OBJ_COUNT 4 #endif +namespace __gnu_cxx +{ + void __freeres(); +} namespace { @@ -106,6 +110,8 @@ namespace // to implement in_pool. char *arena; std::size_t arena_size; + + friend void __gnu_cxx::__freeres(); }; pool::pool() @@ -244,6 +250,19 @@ namespace pool emergency_pool; } +namespace __gnu_cxx +{ + void + __freeres() + { + if (emergency_pool.arena) + { + ::free(emergency_pool.arena); + emergency_pool.arena = 0; + } + } +} + extern "C" void * __cxxabiv1::__cxa_allocate_exception(std::size_t thrown_size) _GLIBCXX_NOTHROW { diff --git a/libstdc++-v3/testsuite/18_support/free_eh_pool.cc b/libstdc++-v3/testsuite/18_support/free_eh_pool.cc new file mode 100644 index 0000000..9712d3d --- /dev/null +++ b/libstdc++-v3/testsuite/18_support/free_eh_pool.cc @@ -0,0 +1,35 @@ +// Copyright (C) 2016 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 WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-do run } + +namespace __gnu_cxx { + void __freeres(); +} + +struct X { + ~X() { + __gnu_cxx::__freeres(); + } +}; + +X x; + +int +main() +{ +} |