From bdf03cb55da14943c8add1c45db7b5a93b656d59 Mon Sep 17 00:00:00 2001 From: Frederik Seiffert Date: Thu, 11 Nov 2021 15:24:13 +0100 Subject: [PATCH] Update runtime defines to match Apple platforms --- objc/runtime.h | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/objc/runtime.h b/objc/runtime.h index 979562c..c3c976f 100644 --- a/objc/runtime.h +++ b/objc/runtime.h @@ -190,30 +190,32 @@ typedef struct #ifndef YES -# define YES ((BOOL)1) +# if __has_feature(objc_bool) +# define YES __objc_yes +# else +# define YES ((BOOL)1) +# endif #endif #ifndef NO -# define NO ((BOOL)0) -#endif - -#ifdef __GNUC -# define _OBJC_NULL_PTR __null -#elif defined(__cplusplus) -# if __has_feature(cxx_nullptr) -# define _OBJC_NULL_PTR nullptr +# if __has_feature(objc_bool) +# define NO __objc_no # else -# define _OBJC_NULL_PTR 0 +# define NO ((BOOL)0) # endif +#endif + +#if __has_feature(cxx_nullptr) +# define _OBJC_NULL_PTR nullptr #else -# define _OBJC_NULL_PTR ((void*)0) +# define _OBJC_NULL_PTR NULL #endif #ifndef nil -# define nil ((id)_OBJC_NULL_PTR) +# define nil _OBJC_NULL_PTR #endif #ifndef Nil -# define Nil ((Class)_OBJC_NULL_PTR) +# define Nil _OBJC_NULL_PTR #endif #include "slot.h"