From b7e4e28dccdff26bc5e402926e61039f8e9ee966 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 22 Jun 2024 20:12:47 -0400 Subject: Add ZIX_NODISCARD attribute --- include/zix/attributes.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/zix/attributes.h b/include/zix/attributes.h index eddb80e..a0ed276 100644 --- a/include/zix/attributes.h +++ b/include/zix/attributes.h @@ -38,11 +38,13 @@ # define ZIX_PURE_FUNC __attribute__((pure)) # define ZIX_CONST_FUNC __attribute__((const)) # define ZIX_MALLOC_FUNC __attribute__((malloc)) +# define ZIX_NODISCARD __attribute__((warn_unused_result)) #else # define ZIX_ALWAYS_INLINE_FUNC ///< Should absolutely always be inlined # define ZIX_PURE_FUNC ///< Only reads memory # define ZIX_CONST_FUNC ///< Only reads its parameters # define ZIX_MALLOC_FUNC ///< Allocates memory with no pointers in it +# define ZIX_NODISCARD ///< Returns a value that must be used #endif /// A pure function in the public API that only reads memory -- cgit v1.2.1