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
This commit is contained in:
parent
97458258b8
commit
0f0b2faf47
@ -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>
|
2001-02-03 Alexandre Oliva <aoliva@redhat.com>
|
||||||
Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
|
Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
|
||||||
|
|
||||||
|
@ -41,6 +41,17 @@ std::type_info::
|
|||||||
~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
|
#if !defined(__GXX_ABI_VERSION) || __GXX_ABI_VERSION < 100
|
||||||
// original (old) abi
|
// 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
|
extern "C" void
|
||||||
__rtti_class (void *addr, const char *name,
|
__rtti_class (void *addr, const char *name,
|
||||||
const __class_type_info::base_info *bl, std::size_t bn)
|
const __class_type_info::base_info *bl, std::size_t bn)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Methods for type_info for -*- C++ -*- Run Time Type Identification.
|
// 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.
|
// This file is part of GNU CC.
|
||||||
|
|
||||||
@ -36,13 +36,18 @@ extern "C" void abort ();
|
|||||||
|
|
||||||
using std::type_info;
|
using std::type_info;
|
||||||
|
|
||||||
#if !defined(__GXX_ABI_VERSION) || __GXX_ABI_VERSION < 100
|
#if !__GXX_MERGED_TYPEINFO_NAMES
|
||||||
|
|
||||||
bool
|
bool
|
||||||
type_info::before (const type_info &arg) const
|
type_info::before (const type_info &arg) const
|
||||||
{
|
{
|
||||||
return __builtin_strcmp (name (), arg.name ()) < 0;
|
return __builtin_strcmp (name (), arg.name ()) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(__GXX_ABI_VERSION) || __GXX_ABI_VERSION < 100
|
||||||
|
|
||||||
// type info for pointer type.
|
// type info for pointer type.
|
||||||
|
|
||||||
struct __pointer_type_info : public type_info {
|
struct __pointer_type_info : public type_info {
|
||||||
|
@ -48,6 +48,19 @@ namespace __cxxabiv1
|
|||||||
} // namespace __cxxabiv1
|
} // namespace __cxxabiv1
|
||||||
#endif
|
#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
|
namespace std
|
||||||
{
|
{
|
||||||
class type_info
|
class type_info
|
||||||
@ -73,28 +86,29 @@ namespace std
|
|||||||
public:
|
public:
|
||||||
// the public interface
|
// the public interface
|
||||||
#if !defined(__GXX_ABI_VERSION) || __GXX_ABI_VERSION < 100
|
#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
|
const char* name() const
|
||||||
{ return __name; }
|
{ return __name; }
|
||||||
bool operator==(const type_info& __arg) const;
|
#else
|
||||||
bool operator!=(const type_info& __arg) const
|
const char* name() const
|
||||||
{ return !operator==(__arg); }
|
{ 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
|
#else
|
||||||
// In new abi we can rely on type_info's NTBS being unique,
|
// In new abi we can rely on type_info's NTBS being unique,
|
||||||
// and therefore address comparisons are sufficient.
|
// and therefore address comparisons are sufficient.
|
||||||
bool before(const type_info& __arg) const
|
bool before(const type_info& __arg) const
|
||||||
{ return __name < __arg.__name; }
|
{ return __name < __arg.__name; }
|
||||||
const char* name() const
|
|
||||||
{ return __name; }
|
|
||||||
bool operator==(const type_info& __arg) const
|
bool operator==(const type_info& __arg) const
|
||||||
{ return __name == __arg.__name; }
|
{ return __name == __arg.__name; }
|
||||||
|
#endif
|
||||||
bool operator!=(const type_info& __arg) const
|
bool operator!=(const type_info& __arg) const
|
||||||
{ return !operator==(__arg); }
|
{ return !operator==(__arg); }
|
||||||
#endif
|
|
||||||
|
|
||||||
// the internal interface
|
// the internal interface
|
||||||
#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100
|
#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100
|
||||||
|
Loading…
Reference in New Issue
Block a user