[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: [PATCH] kjs/lookup.h
From: Adriaan de Groot <groot () kde ! org>
Date: 2008-12-27 8:50:33
Message-ID: 200812270950.34021.groot () kde ! org
[Download RAW message or body]
Since it's really late in the run-up to KDE 4.2 and I haven't pushed in my
compile / correctness fixes up to now, I'm going to post them to -core-devel
one at a time to see if they can still go in. I've got 25 files patched; about
half of the changes really are Solaris-specific twiddling (like undefining
UNICODE in the encoding guesser because it uses UNICODE as an enum value, or
working around a seeming compiler bug in kjs/wtf/Vector.h) and the other half
are things I think are generally applicable.
This patch works around the workaround for gcc bugs in kjs/lookup.h; those of
us without gcc don't hit that problem, but the non-gcc set of defines seems to
be inconsistent in where the JS object cache lives. With a small massage we
can put the cache into namespace KJS when that is supported.
[ade]
["kjs-lookup.diff" (text/x-patch)]
Index: kjs/lookup.h
===================================================================
--- kjs/lookup.h (revision 901981)
+++ kjs/lookup.h (working copy)
@@ -267,6 +267,26 @@
}
} // namespace
+#if COMPILER(GCC)
+#define KJS_OBJECTCACHE_IN_KJS (0)
+#define KJS_CACHEGLOBALOBJECT_NS
+#define KJS_CACHEGLOBALOBJECT_NS_USE ::
+#else
+#if COMPILER(SUNPRO)
+// SunPro puts the whole thing in namespace KJS::, no linking problems.
+#define KJS_OBJECTCACHE_IN_KJS (1)
+#define KJS_CACHEGLOBALOBJECT_NS KJS::
+#define KJS_CACHEGLOBALOBJECT_NS_USE KJS::
+#else
+#define KJS_OBJECTCACHE_IN_KJS (0)
+#define KJS_CACHEGLOBALOBJECT_NS ::
+#define KJS_CACHEGLOBALOBJECT_NS_USE ::
+#endif
+#endif
+
+#if KJS_OBJECTCACHE_IN_KJS
+namespace KJS {
+#endif
/*
* The template method below can't be in the KJS namespace because it's used in
* KJS_DEFINE_PROPERTY which can be used outside of the KJS namespace. It can be \
moved back @@ -293,6 +313,9 @@
globalObject->put(exec, propertyName, newObject, KJS::Internal | KJS::DontEnum);
return newObject;
}
+#if KJS_OBJECTCACHE_IN_KJS
+}
+#endif
/**
* Helpers to define prototype objects (each of which simply implements
@@ -311,17 +334,10 @@
* then the first line will use KJS_DEFINE_PROTOTYPE_WITH_PROTOTYPE, with \
DOMNodeProto as the second argument.
*/
-// Work around a bug in GCC 4.1
-#if !COMPILER(GCC)
-#define KJS_GCC_ROOT_NS_HACK ::
-#else
-#define KJS_GCC_ROOT_NS_HACK
-#endif
-
// These macros assume that a prototype's only properties are functions
#define KJS_DEFINE_PROTOTYPE(ClassProto) \
class ClassProto : public KJS::JSObject { \
- friend KJS::JSObject *KJS_GCC_ROOT_NS_HACK \
cacheGlobalObject<ClassProto>(KJS::ExecState *exec, const KJS::Identifier \
&propertyName); \ + friend KJS::JSObject* KJS_CACHEGLOBALOBJECT_NS \
cacheGlobalObject<ClassProto>(KJS::ExecState *exec, const KJS::Identifier \
&propertyName); \ public: \
static KJS::JSObject *self(KJS::ExecState *exec); \
virtual const KJS::ClassInfo *classInfo() const { return &info; } \
@@ -337,7 +353,7 @@
#define KJS_DEFINE_PROTOTYPE_WITH_PROTOTYPE(ClassProto, ClassProtoProto) \
class ClassProto : public KJS::JSObject { \
- friend KJS::JSObject* KJS_GCC_ROOT_NS_HACK \
cacheGlobalObject<ClassProto>(KJS::ExecState* exec, const KJS::Identifier& \
propertyName); \ + friend KJS::JSObject* KJS_CACHEGLOBALOBJECT_NS \
cacheGlobalObject<ClassProto>(KJS::ExecState* exec, const KJS::Identifier& \
propertyName); \ public: \
static KJS::JSObject* self(KJS::ExecState* exec); \
virtual const KJS::ClassInfo* classInfo() const { return &info; } \
@@ -357,7 +373,7 @@
KJS::Identifier* ClassProto::s_name = 0; \
KJS::JSObject *ClassProto::self(KJS::ExecState *exec) \
{ \
- return ::cacheGlobalObject<ClassProto>(exec, *name()); \
+ return KJS_CACHEGLOBALOBJECT_NS cacheGlobalObject<ClassProto>(exec, *name()); \
\ } \
bool ClassProto::getOwnPropertySlot(KJS::ExecState *exec, const KJS::Identifier& \
propertyName, KJS::PropertySlot& slot) \ { \
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic