mirror of git://gcc.gnu.org/git/gcc.git
Add support for std::uncaught_exceptions.
2015-04-27 Ville Voutilainen <ville.voutilainen@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. From-SVN: r222482
This commit is contained in:
parent
f5eedc3915
commit
03a16cc404
|
|
@ -1,3 +1,14 @@
|
||||||
|
2015-04-27 Ville Voutilainen <ville.voutilainen@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.
|
||||||
|
|
||||||
2015-04-27 Dmitry Prokoptsev <dprokoptsev@gmail.com>
|
2015-04-27 Dmitry Prokoptsev <dprokoptsev@gmail.com>
|
||||||
Michael Hanselmann <public@hansmi.ch>
|
Michael Hanselmann <public@hansmi.ch>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3383,7 +3383,7 @@ changequote([,])dnl
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# For libtool versioning info, format is CURRENT:REVISION:AGE
|
# 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.
|
# Everything parsed; figure out what files and settings to use.
|
||||||
case $enable_symvers in
|
case $enable_symvers in
|
||||||
|
|
|
||||||
|
|
@ -178,7 +178,6 @@ GLIBCXX_3.4 {
|
||||||
# std::[A-Zu-z]*;
|
# std::[A-Zu-z]*;
|
||||||
# std::underflow_error::u*;
|
# std::underflow_error::u*;
|
||||||
# std::underflow_error::~u*;
|
# std::underflow_error::~u*;
|
||||||
std::uncaught_exception*;
|
|
||||||
std::unexpected*;
|
std::unexpected*;
|
||||||
std::[A-Zv-z]*;
|
std::[A-Zv-z]*;
|
||||||
std::_List_node_base::hook*;
|
std::_List_node_base::hook*;
|
||||||
|
|
@ -1024,6 +1023,9 @@ GLIBCXX_3.4 {
|
||||||
_ZNSt6locale5_Impl19_M_replace_categoryEPKS0_PKPKNS_2idE;
|
_ZNSt6locale5_Impl19_M_replace_categoryEPKS0_PKPKNS_2idE;
|
||||||
_ZNSt6locale5_Impl21_M_replace_categoriesEPKS0_i;
|
_ZNSt6locale5_Impl21_M_replace_categoriesEPKS0_i;
|
||||||
|
|
||||||
|
# std::uncaught_exception()
|
||||||
|
_ZSt18uncaught_exceptionv;
|
||||||
|
|
||||||
# DO NOT DELETE THIS LINE. Port-specific symbols, if any, will be here.
|
# DO NOT DELETE THIS LINE. Port-specific symbols, if any, will be here.
|
||||||
|
|
||||||
local:
|
local:
|
||||||
|
|
@ -1860,6 +1862,12 @@ GLIBCXX_3.4.21 {
|
||||||
|
|
||||||
} GLIBCXX_3.4.20;
|
} 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.
|
# Symbols in the support library (libsupc++) have their own tag.
|
||||||
CXXABI_1.3 {
|
CXXABI_1.3 {
|
||||||
|
|
|
||||||
|
|
@ -139,3 +139,10 @@ std::uncaught_exception() throw()
|
||||||
__cxa_eh_globals *globals = __cxa_get_globals ();
|
__cxa_eh_globals *globals = __cxa_get_globals ();
|
||||||
return globals->uncaughtExceptions != 0;
|
return globals->uncaughtExceptions != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
std::uncaught_exceptions() throw()
|
||||||
|
{
|
||||||
|
__cxa_eh_globals *globals = __cxa_get_globals ();
|
||||||
|
return globals->uncaughtExceptions;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -126,6 +126,11 @@ namespace std
|
||||||
*/
|
*/
|
||||||
bool uncaught_exception() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__));
|
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
|
// @} group exceptions
|
||||||
} // namespace std
|
} // namespace std
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 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-options "-std=gnu++11" }
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
#include <exception>
|
||||||
|
#include <testsuite_hooks.h>
|
||||||
|
|
||||||
|
struct UncaughtVerifier
|
||||||
|
{
|
||||||
|
int expected_count_ = 0;
|
||||||
|
UncaughtVerifier(int expected_count) : expected_count_(expected_count) {}
|
||||||
|
~UncaughtVerifier()
|
||||||
|
{
|
||||||
|
VERIFY(std::uncaught_exceptions() == expected_count_);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Transaction
|
||||||
|
{
|
||||||
|
int initial_count_;
|
||||||
|
bool& result_;
|
||||||
|
Transaction(bool& result)
|
||||||
|
: initial_count_(std::uncaught_exceptions()),
|
||||||
|
result_(result) {}
|
||||||
|
~Transaction()
|
||||||
|
{
|
||||||
|
if (std::uncaught_exceptions() != initial_count_) {
|
||||||
|
result_ = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
void test01()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
UncaughtVerifier uv{0};
|
||||||
|
} catch (...) {
|
||||||
|
UncaughtVerifier uv{0};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void test02()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
UncaughtVerifier uv{1};
|
||||||
|
throw 0;
|
||||||
|
} catch (...) {
|
||||||
|
UncaughtVerifier uv{0};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void test03()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
struct Wrap
|
||||||
|
{
|
||||||
|
UncaughtVerifier uv_{1};
|
||||||
|
~Wrap() {try {UncaughtVerifier uv2{2}; throw 0;} catch(...) {}}
|
||||||
|
};
|
||||||
|
Wrap w;
|
||||||
|
throw 0;
|
||||||
|
} catch (...) {
|
||||||
|
UncaughtVerifier uv{0};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void test04()
|
||||||
|
{
|
||||||
|
bool result = true;
|
||||||
|
try {
|
||||||
|
Transaction t{result};
|
||||||
|
} catch(...) {
|
||||||
|
}
|
||||||
|
VERIFY(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
void test05()
|
||||||
|
{
|
||||||
|
bool result = true;
|
||||||
|
try {
|
||||||
|
Transaction t{result};
|
||||||
|
throw 0;
|
||||||
|
} catch(...) {
|
||||||
|
}
|
||||||
|
VERIFY(!result);
|
||||||
|
}
|
||||||
|
|
||||||
|
void test06()
|
||||||
|
{
|
||||||
|
bool result = true;
|
||||||
|
bool result2 = true;
|
||||||
|
try {
|
||||||
|
struct Wrap
|
||||||
|
{
|
||||||
|
bool& result_;
|
||||||
|
Wrap(bool& result) : result_(result) {}
|
||||||
|
~Wrap()
|
||||||
|
{
|
||||||
|
Transaction t{result_};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Transaction t{result};
|
||||||
|
Wrap w{result2};
|
||||||
|
throw 0;
|
||||||
|
} catch(...) {
|
||||||
|
}
|
||||||
|
VERIFY(!result);
|
||||||
|
VERIFY(result2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void test07()
|
||||||
|
{
|
||||||
|
bool result = true;
|
||||||
|
bool result2 = true;
|
||||||
|
try {
|
||||||
|
struct Wrap
|
||||||
|
{
|
||||||
|
bool& result_;
|
||||||
|
Wrap(bool& result) : result_(result) {}
|
||||||
|
~Wrap()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
Transaction t{result_};
|
||||||
|
throw 0;
|
||||||
|
} catch(...) {}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Transaction t{result};
|
||||||
|
Wrap w{result2};
|
||||||
|
throw 0;
|
||||||
|
} catch(...) {
|
||||||
|
}
|
||||||
|
VERIFY(!result);
|
||||||
|
VERIFY(!result2);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
test01();
|
||||||
|
test02();
|
||||||
|
test03();
|
||||||
|
test04();
|
||||||
|
test05();
|
||||||
|
test06();
|
||||||
|
test07();
|
||||||
|
}
|
||||||
|
|
@ -201,6 +201,7 @@ check_version(symbol& test, bool added)
|
||||||
known_versions.push_back("GLIBCXX_3.4.19");
|
known_versions.push_back("GLIBCXX_3.4.19");
|
||||||
known_versions.push_back("GLIBCXX_3.4.20");
|
known_versions.push_back("GLIBCXX_3.4.20");
|
||||||
known_versions.push_back("GLIBCXX_3.4.21");
|
known_versions.push_back("GLIBCXX_3.4.21");
|
||||||
|
known_versions.push_back("GLIBCXX_3.4.22");
|
||||||
known_versions.push_back("GLIBCXX_LDBL_3.4.21");
|
known_versions.push_back("GLIBCXX_LDBL_3.4.21");
|
||||||
known_versions.push_back("CXXABI_1.3");
|
known_versions.push_back("CXXABI_1.3");
|
||||||
known_versions.push_back("CXXABI_LDBL_1.3");
|
known_versions.push_back("CXXABI_LDBL_1.3");
|
||||||
|
|
@ -230,7 +231,7 @@ check_version(symbol& test, bool added)
|
||||||
test.version_status = symbol::incompatible;
|
test.version_status = symbol::incompatible;
|
||||||
|
|
||||||
// Check that added symbols are added in the latest pre-release version.
|
// Check that added symbols are added in the latest pre-release version.
|
||||||
bool latestp = (test.version_name == "GLIBCXX_3.4.21"
|
bool latestp = (test.version_name == "GLIBCXX_3.4.22"
|
||||||
|| test.version_name == "CXXABI_1.3.9"
|
|| test.version_name == "CXXABI_1.3.9"
|
||||||
|| test.version_name == "CXXABI_FLOAT128"
|
|| test.version_name == "CXXABI_FLOAT128"
|
||||||
|| test.version_name == "CXXABI_TM_1");
|
|| test.version_name == "CXXABI_TM_1");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue