summaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@suse.de>2007-02-01 13:36:51 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2007-02-01 13:36:51 +0000
commitc3f0f556dbb69eaa968844a13a4b9d26b0314559 (patch)
tree956a65496ea40664056e495d47d7b48a8dc073b2 /libstdc++-v3
parentee7d8048d5cb690e325d79e82df75c3ddc36a081 (diff)
downloadgcc-c3f0f556dbb69eaa968844a13a4b9d26b0314559.tar.gz
re PR libstdc++/14493 (std::bad_alloc::what() does not explain what happened)
2007-02-01 Paolo Carlini <pcarlini@suse.de> PR libstdc++/14493 * libsupc++/typeinfo (bad_cast::what, bad_typeid::what): Declare. * libsupc++/tinfo.cc: Define. * libsupc++/exception (bad_exception::what): Declare. * libsupc++/eh_exception.cc: Define. (exception::what): Adjust, don't use typeid. * libsupc++/new (bad_alloc::what): Declare. * libsupc++/new_handler.cc: Define. * config/abi/pre/gnu.ver: Export the new methods @3.4.9; adjust existing 3.4.10 exports to 3.4.9. * configure.ac: Adjust to 6.0.9. * configure: Regenerate. * testsuite/util/testsuite_abi.cc: Update. * testsuite/18_support/14493.cc: New. From-SVN: r121461
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog17
-rw-r--r--libstdc++-v3/config/abi/pre/gnu.ver23
-rwxr-xr-xlibstdc++-v3/configure2
-rw-r--r--libstdc++-v3/configure.ac2
-rw-r--r--libstdc++-v3/libsupc++/eh_exception.cc14
-rw-r--r--libstdc++-v3/libsupc++/exception5
-rw-r--r--libstdc++-v3/libsupc++/new5
-rw-r--r--libstdc++-v3/libsupc++/new_handler.cc9
-rw-r--r--libstdc++-v3/libsupc++/tinfo.cc15
-rw-r--r--libstdc++-v3/libsupc++/typeinfo7
-rw-r--r--libstdc++-v3/testsuite/18_support/14493.cc53
-rw-r--r--libstdc++-v3/testsuite/util/testsuite_abi.cc3
12 files changed, 137 insertions, 18 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 1718e5db684..bf45d8ebff1 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,20 @@
+2007-02-01 Paolo Carlini <pcarlini@suse.de>
+
+ PR libstdc++/14493
+ * libsupc++/typeinfo (bad_cast::what, bad_typeid::what): Declare.
+ * libsupc++/tinfo.cc: Define.
+ * libsupc++/exception (bad_exception::what): Declare.
+ * libsupc++/eh_exception.cc: Define.
+ (exception::what): Adjust, don't use typeid.
+ * libsupc++/new (bad_alloc::what): Declare.
+ * libsupc++/new_handler.cc: Define.
+ * config/abi/pre/gnu.ver: Export the new methods @3.4.9; adjust
+ existing 3.4.10 exports to 3.4.9.
+ * configure.ac: Adjust to 6.0.9.
+ * configure: Regenerate.
+ * testsuite/util/testsuite_abi.cc: Update.
+ * testsuite/18_support/14493.cc: New.
+
2007-02-01 Ben Elliston <bje@au.ibm.com>
* libsupc++/eh_alloc.cc (__cxa_free_exception): Don't refer to the
diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver
index 043a49e46bf..a48cfb4cb3b 100644
--- a/libstdc++-v3/config/abi/pre/gnu.ver
+++ b/libstdc++-v3/config/abi/pre/gnu.ver
@@ -1,6 +1,7 @@
## Linker script for GNU versioning (GNU ld 2.13.91+ only.)
##
-## Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007
+## 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
@@ -26,7 +27,7 @@ GLIBCXX_3.4 {
extern "C++"
{
std::[A-Za]*;
- std::ba[a-r]*;
+# std::ba[a-r]*;
std::basic_[a-e]*;
std::basic_f[a-r]*;
# std::basic_fstream;
@@ -475,6 +476,13 @@ GLIBCXX_3.4 {
_ZTSN9__gnu_cxx18stdio_sync_filebufI[cw]St11char_traitsI[cw]EEE;
_ZTSN9__gnu_cxx13stdio_filebufI[cw]St11char_traitsI[cw]EEE;
+ # std::bad_alloc::~bad_alloc, std::bad_cast::~bad_cast,
+ # std::bad_typeid::~bad_typeid, std::bad_exception::~bad_exception
+ _ZNSt9bad_allocD*;
+ _ZNSt8bad_castD*;
+ _ZNSt10bad_typeidD*;
+ _ZNSt13bad_exceptionD*;
+
# function-scope static objects requires a guard variable.
_ZGVNSt[^1]*;
_ZGVNSt1[^7]*;
@@ -689,16 +697,17 @@ GLIBCXX_3.4.9 {
_ZNSo9_M_insertEPKc[il];
_ZNSt13basic_ostreamIwSt11char_traitsIwEE9_M_insertEPKw[il];
-} GLIBCXX_3.4.8;
-
-GLIBCXX_3.4.10 {
-
_ZN11__gnu_debug19_Safe_sequence_base12_M_get_mutexEv;
_ZN11__gnu_debug19_Safe_iterator_base16_M_attach_singleEPNS_19_Safe_sequence_baseEb;
_ZN11__gnu_debug19_Safe_iterator_base16_M_detach_singleEv;
_ZN11__gnu_debug19_Safe_iterator_base12_M_get_mutexEv;
-} GLIBCXX_3.4.9;
+ _ZNKSt9bad_alloc4whatEv;
+ _ZNKSt8bad_cast4whatEv;
+ _ZNKSt10bad_typeid4whatEv;
+ _ZNKSt13bad_exception4whatEv;
+
+} GLIBCXX_3.4.8;
# Symbols in the support library (libsupc++) have their own tag.
CXXABI_1.3 {
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 551bff5ad5e..6fbe55f9309 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -1381,7 +1381,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
### am handles this now? ORIGINAL_LD_FOR_MULTILIBS=$LD
# For libtool versioning info, format is CURRENT:REVISION:AGE
-libtool_VERSION=6:10:0
+libtool_VERSION=6:9:0
# Find the rest of the source tree framework.
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index 82e8b851e09..a1e4a37e909 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -12,7 +12,7 @@ AC_CONFIG_HEADER(config.h)
### am handles this now? ORIGINAL_LD_FOR_MULTILIBS=$LD
# For libtool versioning info, format is CURRENT:REVISION:AGE
-libtool_VERSION=6:10:0
+libtool_VERSION=6:9:0
AC_SUBST(libtool_VERSION)
# Find the rest of the source tree framework.
diff --git a/libstdc++-v3/libsupc++/eh_exception.cc b/libstdc++-v3/libsupc++/eh_exception.cc
index 81d7e70bcf3..40bb839bb7a 100644
--- a/libstdc++-v3/libsupc++/eh_exception.cc
+++ b/libstdc++-v3/libsupc++/eh_exception.cc
@@ -1,5 +1,6 @@
// -*- C++ -*- std::exception implementation.
-// Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+// Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+// 2003, 2004, 2005, 2006, 2007
// Free Software Foundation
//
// This file is part of GCC.
@@ -39,5 +40,14 @@ std::bad_exception::~bad_exception() throw() { }
const char*
std::exception::what() const throw()
{
- return typeid (*this).name ();
+ // NB: Another elegant option would be returning typeid(*this).name()
+ // and not overriding what() in bad_exception, bad_alloc, etc. In
+ // that case, however, mangled names would be returned, PR 14493.
+ return "std::exception";
+}
+
+const char*
+std::bad_exception::what() const throw()
+{
+ return "std::bad_exception";
}
diff --git a/libstdc++-v3/libsupc++/exception b/libstdc++-v3/libsupc++/exception
index cad6323e946..2046300581c 100644
--- a/libstdc++-v3/libsupc++/exception
+++ b/libstdc++-v3/libsupc++/exception
@@ -1,6 +1,7 @@
// Exception Handling support header for -*- C++ -*-
-// Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2005
+// Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
+// 2004, 2005, 2006, 2007
// Free Software Foundation
//
// This file is part of GCC.
@@ -71,6 +72,8 @@ namespace std
// This declaration is not useless:
// http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
virtual ~bad_exception() throw();
+ // See comment in eh_exception.cc.
+ virtual const char* what() const throw();
};
/// If you write a replacement %terminate handler, it must be of this type.
diff --git a/libstdc++-v3/libsupc++/new b/libstdc++-v3/libsupc++/new
index eeed75309a9..26898bfc6fc 100644
--- a/libstdc++-v3/libsupc++/new
+++ b/libstdc++-v3/libsupc++/new
@@ -1,6 +1,7 @@
// The -*- C++ -*- dynamic memory management header.
-// Copyright (C) 1994, 1996, 1997, 1998, 2000, 2001, 2002
+// Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+// 2003, 2004, 2005, 2006, 2007
// Free Software Foundation
// This file is part of GCC.
@@ -61,6 +62,8 @@ namespace std
// This declaration is not useless:
// http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
virtual ~bad_alloc() throw();
+ // See comment in eh_exception.cc.
+ virtual const char* what() const throw();
};
struct nothrow_t { };
diff --git a/libstdc++-v3/libsupc++/new_handler.cc b/libstdc++-v3/libsupc++/new_handler.cc
index 6ea97672533..3580acb0977 100644
--- a/libstdc++-v3/libsupc++/new_handler.cc
+++ b/libstdc++-v3/libsupc++/new_handler.cc
@@ -1,6 +1,7 @@
// Implementation file for the -*- C++ -*- dynamic memory management header.
-// Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002
+// Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+// 2005, 2006, 2007
// Free Software Foundation
//
// This file is part of GCC.
@@ -45,3 +46,9 @@ std::set_new_handler (new_handler handler) throw()
}
std::bad_alloc::~bad_alloc() throw() { }
+
+const char*
+std::bad_alloc::what() const throw()
+{
+ return "std::bad_alloc";
+}
diff --git a/libstdc++-v3/libsupc++/tinfo.cc b/libstdc++-v3/libsupc++/tinfo.cc
index 89d9e164581..8f99de2d28f 100644
--- a/libstdc++-v3/libsupc++/tinfo.cc
+++ b/libstdc++-v3/libsupc++/tinfo.cc
@@ -1,5 +1,6 @@
// Methods for type_info for -*- C++ -*- Run Time Type Identification.
-// Copyright (C) 1994, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+// Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+// 2003, 2004, 2005, 2006, 2007
// Free Software Foundation
//
// This file is part of GCC.
@@ -44,6 +45,18 @@ std::type_info::
std::bad_cast::~bad_cast() throw() { }
std::bad_typeid::~bad_typeid() throw() { }
+const char*
+std::bad_cast::what() const throw()
+{
+ return "std::bad_cast";
+}
+
+const char*
+std::bad_typeid::what() const throw()
+{
+ return "std::bad_typeid";
+}
+
#if !__GXX_TYPEINFO_EQUALITY_INLINE
// We can't rely on common symbols being shared between shared objects.
diff --git a/libstdc++-v3/libsupc++/typeinfo b/libstdc++-v3/libsupc++/typeinfo
index d6adf8b8f95..3abf0dfc17a 100644
--- a/libstdc++-v3/libsupc++/typeinfo
+++ b/libstdc++-v3/libsupc++/typeinfo
@@ -1,5 +1,6 @@
// RTTI support for -*- C++ -*-
-// Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002
+// Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+// 2003, 2004, 2005, 2006, 2007
// Free Software Foundation
//
// This file is part of GCC.
@@ -171,6 +172,8 @@ namespace std
// This declaration is not useless:
// http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
virtual ~bad_cast() throw();
+ // See comment in eh_exception.cc.
+ virtual const char* what() const throw();
};
/** If you use a NULL pointer in a @c typeid expression, this is thrown. */
@@ -181,6 +184,8 @@ namespace std
// This declaration is not useless:
// http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
virtual ~bad_typeid() throw();
+ // See comment in eh_exception.cc.
+ virtual const char* what() const throw();
};
} // namespace std
diff --git a/libstdc++-v3/testsuite/18_support/14493.cc b/libstdc++-v3/testsuite/18_support/14493.cc
new file mode 100644
index 00000000000..188bad7d497
--- /dev/null
+++ b/libstdc++-v3/testsuite/18_support/14493.cc
@@ -0,0 +1,53 @@
+// 2007-01-30 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <new>
+#include <typeinfo>
+#include <exception>
+#include <cstring>
+#include <testsuite_hooks.h>
+
+// libstdc++/14493
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ bad_alloc ba;
+ VERIFY( !strcmp(ba.what(), "std::bad_alloc") );
+
+ bad_cast bc;
+ VERIFY( !strcmp(bc.what(), "std::bad_cast") );
+
+ bad_typeid bt;
+ VERIFY( !strcmp(bt.what(), "std::bad_typeid") );
+
+ exception e;
+ VERIFY( !strcmp(e.what(), "std::exception") );
+
+ bad_exception be;
+ VERIFY( !strcmp(be.what(), "std::bad_exception") );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/util/testsuite_abi.cc b/libstdc++-v3/testsuite/util/testsuite_abi.cc
index e26f009519d..0949e309657 100644
--- a/libstdc++-v3/testsuite/util/testsuite_abi.cc
+++ b/libstdc++-v3/testsuite/util/testsuite_abi.cc
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
@@ -188,7 +188,6 @@ check_version(symbol& test, bool added)
known_versions.push_back("GLIBCXX_3.4.7");
known_versions.push_back("GLIBCXX_3.4.8");
known_versions.push_back("GLIBCXX_3.4.9");
- known_versions.push_back("GLIBCXX_3.4.10");
known_versions.push_back("GLIBCXX_LDBL_3.4");
known_versions.push_back("GLIBCXX_LDBL_3.4.7");
known_versions.push_back("CXXABI_1.3");