aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2006-11-13 13:10:17 +0000
committerJoseph Myers <jsm28@gcc.gnu.org>2006-11-13 13:10:17 +0000
commitb54c93b7b8602e91e284196327ad2646a01d2838 (patch)
treee7e22593e28800c7b7ed6b9d807015761663859d
parent5da10ac71f76160cb5f94912e29b449cfd2de04d (diff)
downloadgcc-b54c93b7b8602e91e284196327ad2646a01d2838.zip
gcc-b54c93b7b8602e91e284196327ad2646a01d2838.tar.gz
gcc-b54c93b7b8602e91e284196327ad2646a01d2838.tar.bz2
bpapi.h (TARGET_BPABI_CPP_BUILTINS): Define __GXX_TYPEINFO_EQUALITY_INLINE but not __GXX_MERGED_TYPEINFO_NAMES.
gcc: * config/arm/bpapi.h (TARGET_BPABI_CPP_BUILTINS): Define __GXX_TYPEINFO_EQUALITY_INLINE but not __GXX_MERGED_TYPEINFO_NAMES. * config/arm/symbian.h (TARGET_OS_CPP_BUILTINS): Define __GXX_MERGED_TYPEINFO_NAMES. * config/i386/cygming.h (TARGET_OS_CPP_BUILTINS): Define __GXX_TYPEINFO_EQUALITY_INLINE. libstdc++-v3: * libsupc++/typeinfo (__GXX_TYPEINFO_EQUALITY_INLINE): Define. Use instead of __GXX_MERGED_TYPEINFO_NAMES to condition inline definitions. * libsupc++/tinfo.cc (operator==): Condition on __GXX_TYPEINFO_EQUALITY_INLINE; check __GXX_MERGED_TYPEINFO_NAMES to determine algorithm. * libsupc++/tinfo2.cc (type_info::before): Likewise. From-SVN: r118755
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/config/arm/bpabi.h2
-rw-r--r--gcc/config/arm/symbian.h17
-rw-r--r--gcc/config/i386/cygming.h1
-rw-r--r--libstdc++-v3/ChangeLog10
-rw-r--r--libstdc++-v3/libsupc++/tinfo.cc6
-rw-r--r--libstdc++-v3/libsupc++/tinfo2.cc6
-rw-r--r--libstdc++-v3/libsupc++/typeinfo30
8 files changed, 71 insertions, 11 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 78798b2..00039dc0 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2006-11-13 Joseph Myers <joseph@codesourcery.com>
+
+ * config/arm/bpapi.h (TARGET_BPABI_CPP_BUILTINS): Define
+ __GXX_TYPEINFO_EQUALITY_INLINE but not
+ __GXX_MERGED_TYPEINFO_NAMES.
+ * config/arm/symbian.h (TARGET_OS_CPP_BUILTINS): Define
+ __GXX_MERGED_TYPEINFO_NAMES.
+ * config/i386/cygming.h (TARGET_OS_CPP_BUILTINS): Define
+ __GXX_TYPEINFO_EQUALITY_INLINE.
+
2006-11-13 H.J. Lu <hongjiu.lu@intel.com>
Zdenek Dvorak <dvorakz@suse.cz>
diff --git a/gcc/config/arm/bpabi.h b/gcc/config/arm/bpabi.h
index 4c73088..71b2ec5 100644
--- a/gcc/config/arm/bpabi.h
+++ b/gcc/config/arm/bpabi.h
@@ -102,7 +102,7 @@
#define TARGET_BPABI_CPP_BUILTINS() \
do \
{ \
- builtin_define ("__GXX_MERGED_TYPEINFO_NAMES=0"); \
+ builtin_define ("__GXX_TYPEINFO_EQUALITY_INLINE=0"); \
} \
while (false)
diff --git a/gcc/config/arm/symbian.h b/gcc/config/arm/symbian.h
index af1ba9a..eca67db 100644
--- a/gcc/config/arm/symbian.h
+++ b/gcc/config/arm/symbian.h
@@ -79,13 +79,16 @@
/* Define the __symbian__ macro. */
#undef TARGET_OS_CPP_BUILTINS
-#define TARGET_OS_CPP_BUILTINS() \
- do \
- { \
- /* Include the default BPABI stuff. */ \
- TARGET_BPABI_CPP_BUILTINS (); \
- builtin_define ("__symbian__"); \
- } \
+#define TARGET_OS_CPP_BUILTINS() \
+ do \
+ { \
+ /* Include the default BPABI stuff. */ \
+ TARGET_BPABI_CPP_BUILTINS (); \
+ /* Symbian OS does not support merging symbols across DLL \
+ boundaries. */ \
+ builtin_define ("__GXX_MERGED_TYPEINFO_NAMES=0"); \
+ builtin_define ("__symbian__"); \
+ } \
while (false)
/* On SymbianOS, these sections are not writable, so we use "a",
diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h
index 957c02e..9b0cd7f 100644
--- a/gcc/config/i386/cygming.h
+++ b/gcc/config/i386/cygming.h
@@ -70,6 +70,7 @@ Boston, MA 02110-1301, USA. */
/* Even though linkonce works with static libs, this is needed \
to compare typeinfo symbols across dll boundaries. */ \
builtin_define ("__GXX_MERGED_TYPEINFO_NAMES=0"); \
+ builtin_define ("__GXX_TYPEINFO_EQUALITY_INLINE=0"); \
MAYBE_UWIN_CPP_BUILTINS (); \
EXTRA_OS_CPP_BUILTINS (); \
} \
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 0cb3497..bb9d08c 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,13 @@
+2006-11-13 Joseph Myers <joseph@codesourcery.com>
+
+ * libsupc++/typeinfo (__GXX_TYPEINFO_EQUALITY_INLINE): Define.
+ Use instead of __GXX_MERGED_TYPEINFO_NAMES to condition inline
+ definitions.
+ * libsupc++/tinfo.cc (operator==): Condition on
+ __GXX_TYPEINFO_EQUALITY_INLINE; check __GXX_MERGED_TYPEINFO_NAMES
+ to determine algorithm.
+ * libsupc++/tinfo2.cc (type_info::before): Likewise.
+
2006-11-12 Paolo Carlini <pcarlini@suse.de>
* include/ext/bitmap_allocator.h: Uglify some names.
diff --git a/libstdc++-v3/libsupc++/tinfo.cc b/libstdc++-v3/libsupc++/tinfo.cc
index a16488b..a153c2d4 100644
--- a/libstdc++-v3/libsupc++/tinfo.cc
+++ b/libstdc++-v3/libsupc++/tinfo.cc
@@ -44,13 +44,17 @@ std::type_info::
std::bad_cast::~bad_cast() throw() { }
std::bad_typeid::~bad_typeid() throw() { }
-#if !__GXX_MERGED_TYPEINFO_NAMES
+#if !__GXX_TYPEINFO_EQUALITY_INLINE
// We can't rely on common symbols being shared between shared objects.
bool std::type_info::
operator== (const std::type_info& arg) const
{
+#if __GXX_MERGED_TYPEINFO_NAMES
+ return name () == arg.name ();
+#else
return (&arg == this) || (__builtin_strcmp (name (), arg.name ()) == 0);
+#endif
}
#endif
diff --git a/libstdc++-v3/libsupc++/tinfo2.cc b/libstdc++-v3/libsupc++/tinfo2.cc
index 2f5a2cd..8fdcac3 100644
--- a/libstdc++-v3/libsupc++/tinfo2.cc
+++ b/libstdc++-v3/libsupc++/tinfo2.cc
@@ -38,12 +38,16 @@ extern "C" void abort ();
using std::type_info;
-#if !__GXX_MERGED_TYPEINFO_NAMES
+#if !__GXX_TYPEINFO_EQUALITY_INLINE
bool
type_info::before (const type_info &arg) const
{
+#if __GXX_MERGED_TYPEINFO_NAMES
+ return name () < arg.name ();
+#else
return __builtin_strcmp (name (), arg.name ()) < 0;
+#endif
}
#endif
diff --git a/libstdc++-v3/libsupc++/typeinfo b/libstdc++-v3/libsupc++/typeinfo
index bd7ce67..fb5957d 100644
--- a/libstdc++-v3/libsupc++/typeinfo
+++ b/libstdc++-v3/libsupc++/typeinfo
@@ -46,6 +46,22 @@ namespace __cxxabiv1
class __class_type_info;
} // namespace __cxxabiv1
+// Determine whether typeinfo names for the same type are merged (in which
+// case comparison can just compare pointers) or not (in which case
+// strings must be compared and g++.dg/abi/local1.C will fail), and
+// whether comparison is to be implemented inline or not. By default we
+// use inline pointer comparison if weak symbols are available, and
+// out-of-line strcmp if not. Out-of-line pointer comparison is used
+// where the object files are to be portable to multiple systems, some of
+// which may not be able to use pointer comparison, but the particular
+// system for which libstdc++ is being built can use pointer comparison;
+// in particular for most ARM EABI systems, where the ABI specifies
+// out-of-line comparison. Inline strcmp is not currently supported. The
+// compiler's target configuration can override the defaults by defining
+// __GXX_TYPEINFO_EQUALITY_INLINE to 1 or 0 to indicate whether or not
+// comparison is inline, and __GXX_MERGED_TYPEINFO_NAMES to 1 or 0 to
+// indicate whether or not pointer comparison can be used.
+
#ifndef __GXX_MERGED_TYPEINFO_NAMES
#if !__GXX_WEAK__
// If weak symbols are not supported, typeinfo names are not merged.
@@ -56,6 +72,15 @@ namespace __cxxabiv1
#endif
#endif
+// By default follow the same rules as for __GXX_MERGED_TYPEINFO_NAMES.
+#ifndef __GXX_TYPEINFO_EQUALITY_INLINE
+ #if !__GXX_WEAK__
+ #define __GXX_TYPEINFO_EQUALITY_INLINE 0
+ #else
+ #define __GXX_TYPEINFO_EQUALITY_INLINE 1
+ #endif
+#endif
+
namespace std
{
/**
@@ -91,13 +116,16 @@ namespace std
const char* name() const
{ return __name; }
-#if !__GXX_MERGED_TYPEINFO_NAMES
+#if !__GXX_TYPEINFO_EQUALITY_INLINE
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
+ #if !__GXX_MERGED_TYPEINFO_NAMES
+ #error "Inline implementation of type_info comparision requires merging of type_info objects"
+ #endif
/** Returns true if @c *this precedes @c __arg in the implementation's
* collation order. */
// In new abi we can rely on type_info's NTBS being unique,