Title: [103758] trunk/Source/_javascript_Core
Revision
103758
Author
[email protected]
Date
2011-12-27 22:07:56 -0800 (Tue, 27 Dec 2011)

Log Message

Continue moving compiler feature checks to use the COMPILER_SUPPORTS() macro
https://bugs.webkit.org/show_bug.cgi?id=75268

Reviewed by Anders Carlsson.

* wtf/Compiler.h:
Add support for COMPILER_SUPPORTS(CXX_NULLPTR) and COMPILER_SUPPORTS(CXX_DELETED_FUNCTIONS).

* wtf/Noncopyable.h:
Use COMPILER_SUPPORTS(CXX_DELETED_FUNCTIONS).

* wtf/NullPtr.cpp:
* wtf/NullPtr.h:
Use COMPILER_SUPPORTS(CXX_NULLPTR). Remove support for HAVE(NULLPTR).

* wtf/RefPtr.h:
* wtf/RetainPtr.h:
Switch from HAVE(NULLPTR) to COMPILER_SUPPORTS(CXX_NULLPTR).

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (103757 => 103758)


--- trunk/Source/_javascript_Core/ChangeLog	2011-12-28 05:29:03 UTC (rev 103757)
+++ trunk/Source/_javascript_Core/ChangeLog	2011-12-28 06:07:56 UTC (rev 103758)
@@ -1,3 +1,24 @@
+2011-12-27  Sam Weinig  <[email protected]>
+
+        Continue moving compiler feature checks to use the COMPILER_SUPPORTS() macro
+        https://bugs.webkit.org/show_bug.cgi?id=75268
+
+        Reviewed by Anders Carlsson.
+
+        * wtf/Compiler.h:
+        Add support for COMPILER_SUPPORTS(CXX_NULLPTR) and COMPILER_SUPPORTS(CXX_DELETED_FUNCTIONS).
+
+        * wtf/Noncopyable.h:
+        Use COMPILER_SUPPORTS(CXX_DELETED_FUNCTIONS).
+
+        * wtf/NullPtr.cpp:
+        * wtf/NullPtr.h:
+        Use COMPILER_SUPPORTS(CXX_NULLPTR). Remove support for HAVE(NULLPTR).
+
+        * wtf/RefPtr.h:
+        * wtf/RetainPtr.h:
+        Switch from HAVE(NULLPTR) to COMPILER_SUPPORTS(CXX_NULLPTR).
+
 2011-12-27  Anders Carlsson  <[email protected]>
 
         Misc fixes and cleanups in Functional.h

Modified: trunk/Source/_javascript_Core/wtf/Compiler.h (103757 => 103758)


--- trunk/Source/_javascript_Core/wtf/Compiler.h	2011-12-28 05:29:03 UTC (rev 103757)
+++ trunk/Source/_javascript_Core/wtf/Compiler.h	2011-12-28 06:07:56 UTC (rev 103758)
@@ -42,8 +42,11 @@
 #define __has_extension __has_feature /* Compatibility with older versions of clang */
 #endif
 
+/* Specific compiler features */
 #define WTF_COMPILER_SUPPORTS_CXX_VARIADIC_TEMPLATES __has_feature(cxx_variadic_templates)
 #define WTF_COMPILER_SUPPORTS_CXX_RVALUE_REFERENCES __has_feature(cxx_rvalue_references)
+#define WTF_COMPILER_SUPPORTS_CXX_DELETED_FUNCTIONS __has_feature(cxx_deleted_functions)
+#define WTF_COMPILER_SUPPORTS_CXX_NULLPTR __has_feature(cxx_nullptr)
 
 #endif
 
@@ -57,8 +60,14 @@
 #elif _MSC_VER < 1600
 #define WTF_COMPILER_MSVC9_OR_LOWER 1
 #endif
+
+/* Specific compiler features */
+#if _MSC_VER >= 1600
+#define WTF_COMPILER_SUPPORTS_CXX_NULLPTR 1
 #endif
 
+#endif
+
 /* COMPILER(RVCT) - ARM RealView Compilation Tools */
 /* COMPILER(RVCT4_OR_GREATER) - ARM RealView Compilation Tools 4.0 or greater */
 #if defined(__CC_ARM) || defined(__ARMCC__)
@@ -82,6 +91,12 @@
 #define WTF_COMPILER_GCC 1
 #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
 #define GCC_VERSION_AT_LEAST(major, minor, patch) (GCC_VERSION >= (major * 10000 + minor * 100 + patch))
+
+/* Specific compiler features */
+#if !COMPILER(CLANG) && GCC_VERSION_AT_LEAST(4, 6, 0) && defined(__GXX_EXPERIMENTAL_CXX0X__)
+#define WTF_COMPILER_SUPPORTS_CXX_NULLPTR 1 
+#endif
+
 #else
 /* Define this for !GCC compilers, just so we can write things like GCC_VERSION_AT_LEAST(4, 1, 0). */
 #define GCC_VERSION_AT_LEAST(major, minor, patch) 0

Modified: trunk/Source/_javascript_Core/wtf/Noncopyable.h (103757 => 103758)


--- trunk/Source/_javascript_Core/wtf/Noncopyable.h	2011-12-28 05:29:03 UTC (rev 103757)
+++ trunk/Source/_javascript_Core/wtf/Noncopyable.h	2011-12-28 06:07:56 UTC (rev 103758)
@@ -21,11 +21,9 @@
 #ifndef WTF_Noncopyable_h
 #define WTF_Noncopyable_h
 
-#ifndef __has_feature
-    #define __has_feature(x) 0
-#endif
+#include "Compiler.h"
 
-#if __has_feature(cxx_deleted_functions)
+#if COMPILER_SUPPORTS(CXX_DELETED_FUNCTIONS)
     #define WTF_MAKE_NONCOPYABLE(ClassName) \
         _Pragma("clang diagnostic push") \
         _Pragma("clang diagnostic ignored \"-Wunknown-pragmas\"") \

Modified: trunk/Source/_javascript_Core/wtf/NullPtr.cpp (103757 => 103758)


--- trunk/Source/_javascript_Core/wtf/NullPtr.cpp	2011-12-28 05:29:03 UTC (rev 103757)
+++ trunk/Source/_javascript_Core/wtf/NullPtr.cpp	2011-12-28 06:07:56 UTC (rev 103758)
@@ -27,7 +27,7 @@
 #include "config.h"
 #include "NullPtr.h"
 
-#if !HAVE(NULLPTR)
+#if !COMPILER_SUPPORTS(CXX_NULLPTR)
 
 std::nullptr_t nullptr;
 

Modified: trunk/Source/_javascript_Core/wtf/NullPtr.h (103757 => 103758)


--- trunk/Source/_javascript_Core/wtf/NullPtr.h	2011-12-28 05:29:03 UTC (rev 103757)
+++ trunk/Source/_javascript_Core/wtf/NullPtr.h	2011-12-28 06:07:56 UTC (rev 103758)
@@ -31,14 +31,8 @@
 // nullptr_t type and nullptr object. They are defined in the same namespaces they
 // would be in compiler and library that had the support.
 
-#ifndef __has_feature
-    #define __has_feature(feature) 0
-#endif
+#if COMPILER_SUPPORTS(CXX_NULLPTR)
 
-#if __has_feature(cxx_nullptr) || (GCC_VERSION_AT_LEAST(4, 6, 0) && defined(__GXX_EXPERIMENTAL_CXX0X__)) || (defined(_MSC_VER) && _MSC_VER >= 1600 && !COMPILER(INTEL))
-
-#define HAVE_NULLPTR 1
-
 #include <cstddef>
 
 #else

Modified: trunk/Source/_javascript_Core/wtf/RefPtr.h (103757 => 103758)


--- trunk/Source/_javascript_Core/wtf/RefPtr.h	2011-12-28 05:29:03 UTC (rev 103757)
+++ trunk/Source/_javascript_Core/wtf/RefPtr.h	2011-12-28 06:07:56 UTC (rev 103758)
@@ -75,7 +75,7 @@
         RefPtr& operator=(T*);
         RefPtr& operator=(const PassRefPtr<T>&);
         RefPtr& operator=(const NonNullPassRefPtr<T>&);
-#if !HAVE(NULLPTR)
+#if !COMPILER_SUPPORTS(CXX_NULLPTR)
         RefPtr& operator=(std::nullptr_t) { clear(); return *this; }
 #endif
         template<typename U> RefPtr& operator=(const RefPtr<U>&);

Modified: trunk/Source/_javascript_Core/wtf/RetainPtr.h (103757 => 103758)


--- trunk/Source/_javascript_Core/wtf/RetainPtr.h	2011-12-28 05:29:03 UTC (rev 103757)
+++ trunk/Source/_javascript_Core/wtf/RetainPtr.h	2011-12-28 06:07:56 UTC (rev 103758)
@@ -100,7 +100,7 @@
         template<typename U> RetainPtr& operator=(RetainPtr<U>&&);
 #endif
 
-#if !HAVE(NULLPTR)
+#if !COMPILER_SUPPORTS(CXX_NULLPTR)
         RetainPtr& operator=(std::nullptr_t) { clear(); return *this; }
 #endif
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to