Index: src/OFArray.h ================================================================== --- src/OFArray.h +++ src/OFArray.h @@ -67,11 +67,11 @@ * \brief Creates a new OFArray with the specified objects, terminated by nil. * * \param firstObject The first object in the array * \return A new autoreleased OFArray */ -+ (instancetype)arrayWithObjects: (id)firstObject, ...; ++ (instancetype)arrayWithObjects: (id)firstObject, ... OF_SENTINEL; /** * \brief Creates a new OFArray with the objects from the specified array. * * \param array An array @@ -102,11 +102,11 @@ * \brief Initializes an OFArray with the specified objects. * * \param firstObject The first object * \return An initialized OFArray */ -- initWithObjects: (id)firstObject, ...; +- initWithObjects: (id)firstObject, ... OF_SENTINEL; /** * \brief Initializes an OFArray with the specified object and a va_list. * * \param firstObject The first object Index: src/OFDictionary.h ================================================================== --- src/OFDictionary.h +++ src/OFDictionary.h @@ -99,11 +99,11 @@ * \brief Creates a new OFDictionary with the specified keys objects. * * \param firstKey The first key * \return A new autoreleased OFDictionary */ -+ (instancetype)dictionaryWithKeysAndObjects: (id)firstKey, ...; ++ (instancetype)dictionaryWithKeysAndObjects: (id)firstKey, ... OF_SENTINEL; /** * \brief Initializes an already allocated OFDictionary. * * \return An initialized OFDictionary @@ -159,11 +159,11 @@ * and objects. * * \param firstKey The first key * \return A new initialized OFDictionary */ -- initWithKeysAndObjects: (id)firstKey, ...; +- initWithKeysAndObjects: (id)firstKey, ... OF_SENTINEL; /** * \brief Initializes an already allocated OFDictionary with the specified key * and va_list. * Index: src/OFObject.h ================================================================== --- src/OFObject.h +++ src/OFObject.h @@ -44,16 +44,22 @@ #endif #ifndef __has_feature # define __has_feature(x) 0 #endif + +#ifdef __GNUC__ +# define __GCC_VERSION__ (__GNUC__ * 100 + __GNUC_MINOR__) +#else +# define __GCC_VERSION__ 0 +#endif #if defined(__clang__) # define OF_HAVE_PROPERTIES # define OF_HAVE_OPTIONAL_PROTOCOLS # define OF_HAVE_FAST_ENUMERATION -#elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC__) >= 406 +#elif __GCC_VERSION__ >= 406 # define OF_HAVE_PROPERTIES # define OF_HAVE_OPTIONAL_PROTOCOLS # define OF_HAVE_FAST_ENUMERATION #endif @@ -69,10 +75,14 @@ # undef YES # define YES __objc_yes # undef NO # define NO __objc_no #endif + +#if defined(__clang__) || __GCC_VERSION__ >= 406 +# define OF_SENTINEL __attribute__((sentinel)) +#endif #if __has_feature(objc_arc) # define OF_RETURNS_RETAINED __attribute__((ns_returns_retained)) # define OF_RETURNS_NOT_RETAINED __attribute__((ns_returns_not_retained)) # define OF_RETURNS_INNER_POINTER __attribute__((objc_returns_inner_pointer))