aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2001-02-04 08:37:50 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2001-02-04 08:37:50 +0000
commit0f0b2faf47c360bc60e429fb7b558c25aabc99eb (patch)
tree7af25095acaf0a18ebaa6c173b4065e24a93b9a9
parent97458258b8e196f88ba17d4ed985aece3ec5675c (diff)
downloadgcc-0f0b2faf47c360bc60e429fb7b558c25aabc99eb.zip
gcc-0f0b2faf47c360bc60e429fb7b558c25aabc99eb.tar.gz
gcc-0f0b2faf47c360bc60e429fb7b558c25aabc99eb.tar.bz2
typeinfo (__GXX_MERGED_TYPEINFO_NAMES): New macro.
* libsupc++/typeinfo (__GXX_MERGED_TYPEINFO_NAMES): New macro. * libsupc++/tinfo.cc (std::typeinfo::operator==): Use strcmp whenever !__GXX_MERGED_TYPEINFO_NAMES. * libsupc++/tinfo2.cc (std::typeinfo::before): Likewise. From-SVN: r39438
-rw-r--r--libstdc++-v3/ChangeLog7
-rw-r--r--libstdc++-v3/libsupc++/tinfo.cc18
-rw-r--r--libstdc++-v3/libsupc++/tinfo2.cc9
-rw-r--r--libstdc++-v3/libsupc++/typeinfo34
4 files changed, 49 insertions, 19 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 43b1cf9..f0c035a 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,10 @@
+2001-02-04 Mark Mitchell <mark@codesourcery.com>
+
+ * libsupc++/typeinfo (__GXX_MERGED_TYPEINFO_NAMES): New macro.
+ * libsupc++/tinfo.cc (std::typeinfo::operator==): Use strcmp
+ whenever !__GXX_MERGED_TYPEINFO_NAMES.
+ * libsupc++/tinfo2.cc (std::typeinfo::before): Likewise.
+
2001-02-03 Alexandre Oliva <aoliva@redhat.com>
Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
diff --git a/libstdc++-v3/libsupc++/tinfo.cc b/libstdc++-v3/libsupc++/tinfo.cc
index 523f5b8..fefc815 100644
--- a/libstdc++-v3/libsupc++/tinfo.cc
+++ b/libstdc++-v3/libsupc++/tinfo.cc
@@ -41,6 +41,17 @@ std::type_info::
~type_info ()
{ }
+#if !__GXX_MERGED_TYPEINFO_NAMES
+
+// We can't rely on common symbols being shared between shared objects.
+bool std::type_info::
+operator== (const std::type_info& arg) const
+{
+ return (&arg == this) || (__builtin_strcmp (name (), arg.name ()) == 0);
+}
+
+#endif
+
#if !defined(__GXX_ABI_VERSION) || __GXX_ABI_VERSION < 100
// original (old) abi
@@ -64,13 +75,6 @@ convert_to_base (void *addr, bool is_virtual, myint32 offset)
}
-// We can't rely on common symbols being shared between shared objects.
-bool std::type_info::
-operator== (const std::type_info& arg) const
-{
- return (&arg == this) || (__builtin_strcmp (name (), arg.name ()) == 0);
-}
-
extern "C" void
__rtti_class (void *addr, const char *name,
const __class_type_info::base_info *bl, std::size_t bn)
diff --git a/libstdc++-v3/libsupc++/tinfo2.cc b/libstdc++-v3/libsupc++/tinfo2.cc
index bbcbda7..53e0fdf 100644
--- a/libstdc++-v3/libsupc++/tinfo2.cc
+++ b/libstdc++-v3/libsupc++/tinfo2.cc
@@ -1,5 +1,5 @@
// Methods for type_info for -*- C++ -*- Run Time Type Identification.
-// Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000 Free Software Foundation
+// Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation
// This file is part of GNU CC.
@@ -36,13 +36,18 @@ extern "C" void abort ();
using std::type_info;
-#if !defined(__GXX_ABI_VERSION) || __GXX_ABI_VERSION < 100
+#if !__GXX_MERGED_TYPEINFO_NAMES
+
bool
type_info::before (const type_info &arg) const
{
return __builtin_strcmp (name (), arg.name ()) < 0;
}
+#endif
+
+#if !defined(__GXX_ABI_VERSION) || __GXX_ABI_VERSION < 100
+
// type info for pointer type.
struct __pointer_type_info : public type_info {
diff --git a/libstdc++-v3/libsupc++/typeinfo b/libstdc++-v3/libsupc++/typeinfo
index 092963c..949c6d8 100644
--- a/libstdc++-v3/libsupc++/typeinfo
+++ b/libstdc++-v3/libsupc++/typeinfo
@@ -48,6 +48,19 @@ namespace __cxxabiv1
} // namespace __cxxabiv1
#endif
+
+#if !defined(__GXX_ABI_VERSION) || __GXX_ABI_VERSION < 100
+ // In the old ABI, typeinfo name strings were not merged.
+ #define __GXX_MERGED_TYPEINFO_NAMES 0
+#elif !__GXX_WEAK__
+ // If weak symbols are not supported, they are still not merged.
+ #define __GXX_MERGED_TYPEINFO_NAMES 0
+#else
+ // In the new ABI, on platforms that support weak symbols, they are
+ // merged.
+ #define __GXX_MERGED_TYPEINFO_NAMES 1
+#endif
+
namespace std
{
class type_info
@@ -73,28 +86,29 @@ namespace std
public:
// the public interface
#if !defined(__GXX_ABI_VERSION) || __GXX_ABI_VERSION < 100
- // In old abi, there can be multiple instances of a type_info
- // object for one type. Uniqueness must use the _name value, not
- // object address.
- bool before(const type_info& arg) const;
const char* name() const
{ return __name; }
- bool operator==(const type_info& __arg) const;
- bool operator!=(const type_info& __arg) const
- { return !operator==(__arg); }
+#else
+ const char* name() const
+ { return __name; }
+#endif
+#if !__GXX_MERGED_TYPEINFO_NAMES
+ bool before(const type_info& arg) const;
+ // In old abi, or when weak symbols are not supported, there can
+ // be multiple instances of a type_info object for one
+ // type. Uniqueness must use the _name value, not object address.
+ bool operator==(const type_info& __arg) const;
#else
// In new abi we can rely on type_info's NTBS being unique,
// and therefore address comparisons are sufficient.
bool before(const type_info& __arg) const
{ return __name < __arg.__name; }
- const char* name() const
- { return __name; }
bool operator==(const type_info& __arg) const
{ return __name == __arg.__name; }
+#endif
bool operator!=(const type_info& __arg) const
{ return !operator==(__arg); }
-#endif
// the internal interface
#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100