gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Clang extension for BOOL and nil


From: Vincent R.
Subject: Re: Clang extension for BOOL and nil
Date: Sat, 24 Aug 2013 13:02:21 +0200
User-agent: Roundcube Webmail/0.6

Le 23.08.2013 12:32, David Chisnall a écrit :
I've been meaning to make this change for a little while.  It makes a
few bits of static analysis easier. I don't have time to do this next
week, but if you send a patch I'd be happy to commit it.

Please find a small patch, tested with clang but not gcc.

Index: objc/runtime.h
===================================================================
--- objc/runtime.h      (revision 37015)
+++ objc/runtime.h      (working copy)
@@ -188,17 +188,30 @@



-#ifndef YES
-#      define YES ((BOOL)1)
+#if __has_feature(objc_bool)
+#      ifndef YES
+#              define YES             __objc_yes
+#      endif
+#      ifndef NO
+#              define NO              __objc_no
+#      endif
+#else
+#      ifndef YES
+#              define YES ((BOOL)1)
+#      endif
+#      ifndef NO
+#              define NO ((BOOL)0)
+#      endif
 #endif
-#ifndef NO
-#      define NO ((BOOL)0)
-#endif

 #ifdef __GNUC
 #      define _OBJC_NULL_PTR __null
 #elif defined(__cplusplus)
-#      define _OBJC_NULL_PTR 0
+#      if __has_feature(cxx_nullptr)
+#      define _OBJC_NULL_PTR nullptr
+#      else
+#              define _OBJC_NULL_PTR 0
+#      endif
 #else
 #      define _OBJC_NULL_PTR ((void*)0)
 #endif

Attachment: runtime.diff
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]