[PATCH] kjs/wtf/ traits specialization for Studio 12
Adriaan de Groot
groot at kde.org
Thu Aug 16 22:43:37 BST 2007
On Thursday 16 August 2007 23:22:32 Adriaan de Groot wrote:
> [ 6%] Building CXX object kjs/CMakeFiles/kjs.dir/date_object.o
>
> >> Assertion: (../lnk/bind.cc, line 268)
> while processing /mnt/KDE4/kdelibs/kjs/collector.h at line 44.
The wtf/HashTraits.h file triggers an internal compiler error in Sun Studio 12
because it's picky about consts, and does not match const char * against a P
* in the template. The patch below spells it out for the compiler, and works
on both gcc 3.4.6 FreeBSD and Sun Studio 12 OpenSolaris. I haven't spotted a
way to do this in a more general fashion, as replacing char with P gives the
same error. Can someone comment on whether this could be applied?
Index: wtf/HashTraits.h
===================================================================
--- wtf/HashTraits.h (revision 700313)
+++ wtf/HashTraits.h (working copy)
@@ -101,6 +101,14 @@
static P* deletedValue() { return reinterpret_cast<P*>(-1); }
};
+ template<> struct HashTraits<const char*> : GenericHashTraits<const
char*> {
+ typedef HashTraits<IntTypes<sizeof(const char*)>::SignedType>
StorageTraits;
+ static const bool emptyValueIsZero = true;
+ static const bool needsDestruction = false;
+ static const char* deletedValue() { return reinterpret_cast<const
char*>(-1); }
+ };
+
+
template<typename P> struct HashTraits<RefPtr<P> > :
GenericHashTraits<RefPtr<P> > {
typedef HashTraits<typename IntTypes<sizeof(P*)>::SignedType>
StorageTraits;
static const bool emptyValueIsZero = true;
--
KDE Quality Team http://www.englishbreakfastnetwork.org/
GPG: FEA2 A3FE http://people.fruitsalad.org/adridg/
"It is impossible to make an emphatic point with only two arms."
More information about the kde-core-devel
mailing list