+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>
~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
}
-// 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)
// 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.
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 {
} // 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
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