summaryrefslogtreecommitdiffstats
path: root/contrib/libcxxrt
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2013-10-16 17:00:21 +0000
committerdim <dim@FreeBSD.org>2013-10-16 17:00:21 +0000
commitfd65ae458671539fdc2244c97a0c6b89a84afe94 (patch)
tree9f95e296fa1dfd07f102ce3dd75fa9949c081a09 /contrib/libcxxrt
parent36f75b57a31f008bd67f1860f9ba59d2c93a0418 (diff)
downloadFreeBSD-src-fd65ae458671539fdc2244c97a0c6b89a84afe94.zip
FreeBSD-src-fd65ae458671539fdc2244c97a0c6b89a84afe94.tar.gz
Since C++ typeinfo objects are currently not guaranteed to be merged at
runtime by the dynamic linker, check for their equality in libcxxrt by not only comparing the typeinfo's name pointers, but also comparing the full names, if necessary. (This is similar to what GNU libstdc++ does in its default configuration.) The 'deep' check can be turned off again by defining LIBCXXRT_MERGED_TYPEINFO, and recompiling libcxxrt. Reviewed by: theraven MFC after: 3 days
Diffstat (limited to 'contrib/libcxxrt')
-rw-r--r--contrib/libcxxrt/typeinfo.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/contrib/libcxxrt/typeinfo.cc b/contrib/libcxxrt/typeinfo.cc
index fda5196..d361406 100644
--- a/contrib/libcxxrt/typeinfo.cc
+++ b/contrib/libcxxrt/typeinfo.cc
@@ -35,15 +35,23 @@ type_info::~type_info() {}
bool type_info::operator==(const type_info &other) const
{
+#ifdef LIBCXXRT_MERGED_TYPEINFO
return __type_name == other.__type_name;
+#else
+ return __type_name == other.__type_name || strcmp(__type_name, other.__type_name) == 0;
+#endif
}
bool type_info::operator!=(const type_info &other) const
{
- return __type_name != other.__type_name;
+ return !operator==(other);
}
bool type_info::before(const type_info &other) const
{
+#ifdef LIBCXXRT_MERGED_TYPEINFO
return __type_name < other.__type_name;
+#else
+ return strcmp(__type_name, other.__type_name) < 0;
+#endif
}
const char* type_info::name() const
{
OpenPOWER on IntegriCloud