Check for the assume_nonnull feature instead of noescape
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Feb 2015 22:40:51 +0000 (22:40 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Feb 2015 22:40:51 +0000 (22:40 +0000)
https://bugs.webkit.org/show_bug.cgi?id=141666

Reviewed by Dan Bernstein.

* Shared/API/Cocoa/WKFoundation.h:

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

Source/WebKit2/ChangeLog
Source/WebKit2/Shared/API/Cocoa/WKFoundation.h

index b8eee8c..86ee14e 100644 (file)
@@ -1,5 +1,14 @@
 2015-02-16  Anders Carlsson  <andersca@apple.com>
 
+        Check for the assume_nonnull feature instead of noescape
+        https://bugs.webkit.org/show_bug.cgi?id=141666
+
+        Reviewed by Dan Bernstein.
+
+        * Shared/API/Cocoa/WKFoundation.h:
+
+2015-02-16  Anders Carlsson  <andersca@apple.com>
+
         Add nullability qualifiers to all API headers
         https://bugs.webkit.org/show_bug.cgi?id=141652
         rdar://problem/19793630
index 5a04f5c..a24bd96 100644 (file)
 #define WK_UNAVAILABLE
 #endif
 
-// We check for the "noescape" attribute here since it was added in the same version of clang
-// that added nullability qualifiers.
+#if __has_feature(assume_nonnull)
+
 #ifdef NS_ASSUME_NONNULL_BEGIN
 #define WK_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
-#elif __has_attribute(noescape)
-#define WK_ASSUME_NONNULL_BEGIN _Pragma("clang assume_nonnull begin")
 #else
-#define WK_ASSUME_NONNULL_BEGIN
+#define WK_ASSUME_NONNULL_BEGIN _Pragma("clang assume_nonnull begin")
 #endif
 
 #ifdef NS_ASSUME_NONNULL_END
 #define WK_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
-#elif __has_attribute(noescape)
+#else
 #define WK_ASSUME_NONNULL_END _Pragma("clang assume_nonnull end")
+#endif
+
+#define WK_NULLABLE nullable
+#define WK_NULL_UNSPECIFIED null_unspecified
+#define WK_NULLABLE_SPECIFIER __nullable
+#define WK_NULLABLE_PROPERTY nullable,
+
 #else
+
+#define WK_ASSUME_NONNULL_BEGIN
 #define WK_ASSUME_NONNULL_END
-#endif
 
-#if !__has_attribute(noescape)
 #define WK_NULLABLE
 #define WK_NULL_UNSPECIFIED
 #define WK_NULLABLE_SPECIFIER
 #define WK_NULLABLE_PROPERTY
-#else
-#define WK_NULLABLE nullable
-#define WK_NULL_UNSPECIFIED null_unspecified
-#define WK_NULLABLE_SPECIFIER __nullable
-#define WK_NULLABLE_PROPERTY nullable,
+
 #endif
 
 #if defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED < 101000