2010-12-27 Jake Helfert <jake@jakeonthenet.com>
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 27 Dec 2010 21:41:39 +0000 (21:41 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 27 Dec 2010 21:41:39 +0000 (21:41 +0000)
        Reviewed and reworked by Darin Adler.

        Building WebKit with Visual Studio 2010 fails due
        to ambiguous assignment operator errors.
        https://bugs.webkit.org/show_bug.cgi?id=51116

        * wtf/NullPtr.h: Added a HAVE(NULLPTR) definition for use with
        Platform.h HAVE macro, and included the Visual Studio 2010 compiler
        as one of the ones that has nullptr.
        * wtf/NullPtr.cpp: Updated condition to match.

        * wtf/PassOwnArrayPtr.h: Don't include the operator=(nullptr_t)
        overload if we are compiling in loose mode and the compiler has
        nullptr, because assignment of 0 will otherwise encounter
        ambiguitity with this overload and the overload for loose mode
        that takes a raw pointer. The conditional can be removed when we
        get rid of loose mode.
        * wtf/PassOwnPtr.h: Ditto.

        * wtf/PassRefPtr.h: Don't include the operator=(nullptr_t) overload
        if the compiler has nullptr, because assignment of 0 would be
        ambiguous with the overload that takes a raw pointer. The conditional
        can be removed if we ever decide we no longer need to support
        assigning 0, but might need a way to catch that usage on older compilers.
        * wtf/RefPtr.h: Ditto.
        * wtf/RetainPtr.h: Ditto

        * JavaScriptCore.xcodeproj/project.pbxproj: Added NullPtr.cpp,
        accidentally omitted when the file was first added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@74695 268f45cc-cd09-0410-ab3c-d52691b4dbfc

JavaScriptCore/ChangeLog
JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
JavaScriptCore/wtf/NullPtr.cpp
JavaScriptCore/wtf/NullPtr.h
JavaScriptCore/wtf/PassOwnArrayPtr.h
JavaScriptCore/wtf/PassOwnPtr.h
JavaScriptCore/wtf/PassRefPtr.h
JavaScriptCore/wtf/RefPtr.h
JavaScriptCore/wtf/RetainPtr.h

index e3ddeb1..94e522c 100644 (file)
@@ -1,3 +1,35 @@
+2010-12-27  Jake Helfert  <jake@jakeonthenet.com>
+
+        Reviewed and reworked by Darin Adler.
+
+        Building WebKit with Visual Studio 2010 fails due
+        to ambiguous assignment operator errors.
+        https://bugs.webkit.org/show_bug.cgi?id=51116
+
+        * wtf/NullPtr.h: Added a HAVE(NULLPTR) definition for use with
+        Platform.h HAVE macro, and included the Visual Studio 2010 compiler
+        as one of the ones that has nullptr.
+        * wtf/NullPtr.cpp: Updated condition to match.
+        
+        * wtf/PassOwnArrayPtr.h: Don't include the operator=(nullptr_t)
+        overload if we are compiling in loose mode and the compiler has
+        nullptr, because assignment of 0 will otherwise encounter
+        ambiguitity with this overload and the overload for loose mode
+        that takes a raw pointer. The conditional can be removed when we
+        get rid of loose mode.
+        * wtf/PassOwnPtr.h: Ditto.
+
+        * wtf/PassRefPtr.h: Don't include the operator=(nullptr_t) overload
+        if the compiler has nullptr, because assignment of 0 would be
+        ambiguous with the overload that takes a raw pointer. The conditional
+        can be removed if we ever decide we no longer need to support
+        assigning 0, but might need a way to catch that usage on older compilers.
+        * wtf/RefPtr.h: Ditto.
+        * wtf/RetainPtr.h: Ditto
+
+        * JavaScriptCore.xcodeproj/project.pbxproj: Added NullPtr.cpp,
+        accidentally omitted when the file was first added.
+
 2010-12-26  Xan Lopez  <xlopez@igalia.com>
 
         Reviewed by Eric Seidel.
index 415d387..3111554 100644 (file)
                9330402C0E6A764000786E6A /* SmallStrings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93303FE80E6A72B500786E6A /* SmallStrings.cpp */; };
                933F5CDC1269229B0049191E /* NullPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 933F5CDB126922690049191E /* NullPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
                937013480CA97E0E00FA14D3 /* pcre_ucp_searchfuncs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 937013470CA97E0E00FA14D3 /* pcre_ucp_searchfuncs.cpp */; settings = {COMPILER_FLAGS = "-Wno-sign-compare"; }; };
+               93854A9A12C93D3B00DAAF77 /* NullPtr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93854A9912C93D3B00DAAF77 /* NullPtr.cpp */; };
                93E26BD408B1514100F85226 /* pcre_xclass.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93E26BD308B1514100F85226 /* pcre_xclass.cpp */; };
                9534AAFB0E5B7A9600B8A45B /* JSProfilerPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 952C63AC0E4777D600C13936 /* JSProfilerPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
                95742F650DD11F5A000917FB /* Profile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95742F630DD11F5A000917FB /* Profile.cpp */; };
                9374D3A7038D9D74008635CE /* ScopeChain.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = ScopeChain.h; sourceTree = "<group>"; tabWidth = 8; };
                9374D3A8038D9D74008635CE /* ScopeChain.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScopeChain.cpp; sourceTree = "<group>"; tabWidth = 8; };
                937B63CC09E766D200A671DD /* DerivedSources.make */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = DerivedSources.make; sourceTree = "<group>"; usesTabs = 1; };
+               93854A9912C93D3B00DAAF77 /* NullPtr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NullPtr.cpp; path = ./wtf/NullPtr.cpp; sourceTree = SOURCE_ROOT; };
                938772E5038BFE19008635CE /* JSArray.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = JSArray.h; sourceTree = "<group>"; tabWidth = 8; };
                938C4F690CA06BC700D9310A /* ASCIICType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASCIICType.h; sourceTree = "<group>"; };
                938C4F6B0CA06BCE00D9310A /* DisallowCType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DisallowCType.h; sourceTree = "<group>"; };
                                9303F5690991190000AD71B8 /* Noncopyable.h */,
                                65E1A2F4122B880D00B26097 /* NonCopyingSort.h */,
                                C0A2723F0E509F1E00E96E15 /* NotFound.h */,
+                               93854A9912C93D3B00DAAF77 /* NullPtr.cpp */,
                                933F5CDB126922690049191E /* NullPtr.h */,
                                1400067612A6F7830064D123 /* OSAllocator.h */,
                                1400069212A6F9E10064D123 /* OSAllocatorPosix.cpp */,
                                E1EF79AA0CE97BA60088D500 /* UTF8.cpp in Sources */,
                                868BFA17117CF19900B908B1 /* WTFString.cpp in Sources */,
                                86D08D5311793613006E5ED0 /* WTFThreadData.cpp in Sources */,
+                               93854A9A12C93D3B00DAAF77 /* NullPtr.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index e7d94b2..c4228e3 100644 (file)
@@ -26,7 +26,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 #include "NullPtr.h"
 
-#if !__has_feature(cxx_nullptr)
+#include "Platform.h"
+
+#if !HAVE(NULLPTR)
 
 std::nullptr_t nullptr;
 
index 10a5814..08ece56 100644 (file)
@@ -35,7 +35,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     #define __has_feature(feature) 0
 #endif
 
-#if !__has_feature(cxx_nullptr)
+#if __has_feature(cxx_nullptr) || (defined(_MSC_VER) && _MSC_VER >= 1600)
+
+#define HAVE_NULLPTR 1
+
+#else
 
 namespace std {
     class nullptr_t { };
index 6a55491..499e850 100644 (file)
@@ -73,7 +73,9 @@ public:
 #endif
 
     PassOwnArrayPtr& operator=(const PassOwnArrayPtr<T>&);
+#if !defined(LOOSE_PASS_OWN_ARRAY_PTR) || !HAVE(NULLPTR)
     PassOwnArrayPtr& operator=(std::nullptr_t) { clear(); return *this; }
+#endif
     template<typename U> PassOwnArrayPtr& operator=(const PassOwnArrayPtr<U>&);
 
     template<typename U> friend PassOwnArrayPtr<U> adoptArrayPtr(U*);
index 60453fc..823f8b1 100644 (file)
@@ -72,7 +72,9 @@ namespace WTF {
         operator UnspecifiedBoolType() const { return m_ptr ? &PassOwnPtr::m_ptr : 0; }
 
         PassOwnPtr& operator=(const PassOwnPtr<T>&);
+#if !defined(LOOSE_PASS_OWN_PTR) || !HAVE(NULLPTR)
         PassOwnPtr& operator=(std::nullptr_t) { clear(); return *this; }
+#endif
         template<typename U> PassOwnPtr& operator=(const PassOwnPtr<U>&);
 
         template<typename U> friend PassOwnPtr<U> adoptPtr(U*);
index b179cef..7b4af6b 100644 (file)
@@ -91,7 +91,9 @@ namespace WTF {
 
         PassRefPtr& operator=(T*);
         PassRefPtr& operator=(const PassRefPtr&);
+#if !HAVE(NULLPTR)
         PassRefPtr& operator=(std::nullptr_t) { clear(); return *this; }
+#endif
         template<typename U> PassRefPtr& operator=(const PassRefPtr<U>&);
         template<typename U> PassRefPtr& operator=(const RefPtr<U>&);
 
index 6afa886..d57f88a 100644 (file)
@@ -74,7 +74,9 @@ namespace WTF {
         RefPtr& operator=(T*);
         RefPtr& operator=(const PassRefPtr<T>&);
         RefPtr& operator=(const NonNullPassRefPtr<T>&);
+#if !HAVE(NULLPTR)
         RefPtr& operator=(std::nullptr_t) { clear(); return *this; }
+#endif
         template<typename U> RefPtr& operator=(const RefPtr<U>&);
         template<typename U> RefPtr& operator=(const PassRefPtr<U>&);
         template<typename U> RefPtr& operator=(const NonNullPassRefPtr<U>&);
index 8a14cfe..fa7c163 100644 (file)
@@ -87,7 +87,9 @@ namespace WTF {
         template<typename U> RetainPtr& operator=(const RetainPtr<U>&);
         RetainPtr& operator=(PtrType);
         template<typename U> RetainPtr& operator=(U*);
+#if !HAVE(NULLPTR)
         RetainPtr& operator=(std::nullptr_t) { clear(); return *this; }
+#endif
 
         void adoptCF(PtrType);
         void adoptNS(PtrType);