summaryrefslogtreecommitdiffstats
path: root/zix/common.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-11-11 12:22:28 +0100
committerDavid Robillard <d@drobilla.net>2020-11-11 12:26:56 +0100
commit3c18febd87234f54c149bb4a6353e3b0e0103db7 (patch)
tree26c32150fada522778e8df63b747fbe10e7aa3dc /zix/common.h
parent387f52cd29b6078d441da5fd07a951a481c10b6d (diff)
downloadzix-3c18febd87234f54c149bb4a6353e3b0e0103db7.tar.gz
zix-3c18febd87234f54c149bb4a6353e3b0e0103db7.tar.bz2
zix-3c18febd87234f54c149bb4a6353e3b0e0103db7.zip
Add const, pure, and malloc function attributes
Diffstat (limited to 'zix/common.h')
-rw-r--r--zix/common.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/zix/common.h b/zix/common.h
index 3271858..f7ec4c3 100644
--- a/zix/common.h
+++ b/zix/common.h
@@ -46,6 +46,21 @@
# define ZIX_API
# define ZIX_PRIVATE static
#endif
+
+#ifdef __GNUC__
+# define ZIX_PURE_FUNC __attribute__((pure))
+# define ZIX_CONST_FUNC __attribute__((const))
+# define ZIX_MALLOC_FUNC __attribute__((malloc))
+#else
+# define ZIX_PURE_FUNC
+# define ZIX_CONST_FUNC
+# define ZIX_MALLOC_FUNC
+#endif
+
+#define ZIX_PURE_API ZIX_API ZIX_PURE_FUNC
+#define ZIX_CONST_API ZIX_API ZIX_CONST_FUNC
+#define ZIX_MALLOC_API ZIX_API ZIX_MALLOC_FUNC
+
/** @endcond */
#ifdef __cplusplus