Index: src/OFObject.h ================================================================== --- src/OFObject.h +++ src/OFObject.h @@ -667,11 +667,11 @@ * * @param size The size of the memory to allocate * @return A pointer to the allocated memory. May return NULL if the specified * size is 0. */ -- (nullable void *)allocMemoryWithSize: (size_t)size; +- (nullable void *)allocMemoryWithSize: (size_t)size OF_WARN_UNUSED_RESULT; /*! * @brief Allocates memory for the specified number of items and stores it in * the object's memory pool. * @@ -681,11 +681,11 @@ * @param count The number of items to allocate * @return A pointer to the allocated memory. May return NULL if the specified * size or count is 0. */ - (nullable void *)allocMemoryWithSize: (size_t)size - count: (size_t)count; + count: (size_t)count OF_WARN_UNUSED_RESULT; /*! * @brief Resizes memory in the object's memory pool to the specified size. * * If the pointer is NULL, this is equivalent to allocating memory. @@ -694,11 +694,11 @@ * @param pointer A pointer to the already allocated memory * @param size The new size for the memory chunk * @return A pointer to the resized memory chunk */ - (nullable void *)resizeMemory: (nullable void *)pointer - size: (size_t)size; + size: (size_t)size OF_WARN_UNUSED_RESULT; /*! * @brief Resizes memory in the object's memory pool to the specific number of * items of the specified size. * @@ -710,11 +710,11 @@ * @param count The number of items to resize to * @return A pointer to the resized memory chunk */ - (nullable void *)resizeMemory: (nullable void *)pointer size: (size_t)size - count: (size_t)count; + count: (size_t)count OF_WARN_UNUSED_RESULT; /*! * @brief Frees allocated memory and removes it from the object's memory pool. * * Does nothing if the pointer is NULL. Index: src/macros.h ================================================================== --- src/macros.h +++ src/macros.h @@ -211,13 +211,15 @@ #endif #if defined(__clang__) || OF_GCC_VERSION >= 406 # define OF_SENTINEL __attribute__((__sentinel__)) # define OF_NO_RETURN __attribute__((__noreturn__)) +# define OF_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__)) #else # define OF_SENTINEL # define OF_NO_RETURN +# define OF_WARN_UNUSED_RESULT #endif #if __has_attribute(__unavailable__) # define OF_UNAVAILABLE __attribute__((__unavailable__)) #else