Fix compilation with clang on Mac OS X
authorSimon Hausmann <simon.hausmann@digia.com>
Thu, 3 Jan 2013 13:00:59 +0000 (14:00 +0100)
committerLars Knoll <lars.knoll@digia.com>
Thu, 3 Jan 2013 13:31:32 +0000 (14:31 +0100)
Add missing friend declarations for required access to private
fields and moved operator< into namespace so that the compiler can
find it when calling qSort().

Change-Id: I6c94b6fc79c5039903e62ce08b0a6b273133e104
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
qv4managed.h
qv4mm.cpp
qv4mm.h

index 22138b9..6ccc68c 100644 (file)
@@ -52,6 +52,9 @@ namespace VM {
 
 class MemoryManager;
 struct Object;
+struct ObjectPrototype;
+struct ExecutionContext;
+struct ScriptFunction;
 
 struct Managed
 {
@@ -73,6 +76,11 @@ protected:
 
 private:
     friend class MemoryManager;
+    friend struct Object;
+    friend struct ObjectPrototype;
+    friend struct FunctionObject;
+    friend struct ExecutionContext;
+    friend struct ScriptFunction;
 
     union {
         Managed *nextFree;
index ea60313..fe652b4 100644 (file)
--- a/qv4mm.cpp
+++ b/qv4mm.cpp
@@ -90,11 +90,14 @@ struct MemoryManager::Data
     }
 };
 
-static bool operator<(const MemoryManager::Data::Chunk &a, const MemoryManager::Data::Chunk &b)
+namespace QQmlJS { namespace VM {
+
+bool operator<(const MemoryManager::Data::Chunk &a, const MemoryManager::Data::Chunk &b)
 {
     return a.memory.base() < b.memory.base();
 }
 
+} } // namespace QQmlJS::VM
 
 MemoryManager::MemoryManager()
     : m_d(new Data(true))
diff --git a/qv4mm.h b/qv4mm.h
index cefb97b..10b64c5 100644 (file)
--- a/qv4mm.h
+++ b/qv4mm.h
@@ -39,7 +39,7 @@
 namespace QQmlJS {
 namespace VM {
 
-class Managed;
+struct Managed;
 
 class MemoryManager
 {