+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
## 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
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;
_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]*;
_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 {
### 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.
### 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.
// -*- 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.
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";
}
// 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.
// 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.
// 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.
// 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 { };
// 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.
}
std::bad_alloc::~bad_alloc() throw() { }
+
+const char*
+std::bad_alloc::what() const throw()
+{
+ return "std::bad_alloc";
+}
// 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.
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.
// 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.
// 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. */
// 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
--- /dev/null
+// 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;
+}
// -*- 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
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");