summaryrefslogtreecommitdiffstats
path: root/include/zix
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2024-06-22 20:12:47 -0400
committerDavid Robillard <d@drobilla.net>2024-06-22 20:17:18 -0400
commitb7e4e28dccdff26bc5e402926e61039f8e9ee966 (patch)
treeef32ba29988fc443a9398a699cbbcc3525ec72f5 /include/zix
parentaab5940036858663eb445c00166511ce2aea9c9d (diff)
downloadzix-b7e4e28dccdff26bc5e402926e61039f8e9ee966.tar.gz
zix-b7e4e28dccdff26bc5e402926e61039f8e9ee966.tar.bz2
zix-b7e4e28dccdff26bc5e402926e61039f8e9ee966.zip
Add ZIX_NODISCARD attribute
Diffstat (limited to 'include/zix')
-rw-r--r--include/zix/attributes.h2
1 files changed, 2 insertions, 0 deletions
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