aboutsummaryrefslogtreecommitdiffstats
path: root/include/serd/attributes.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/serd/attributes.h')
-rw-r--r--include/serd/attributes.h35
1 files changed, 12 insertions, 23 deletions
diff --git a/include/serd/attributes.h b/include/serd/attributes.h
index 59063153..4ea4d41d 100644
--- a/include/serd/attributes.h
+++ b/include/serd/attributes.h
@@ -4,6 +4,8 @@
#ifndef SERD_ATTRIBUTES_H
#define SERD_ATTRIBUTES_H
+#include "zix/attributes.h"
+
/**
@defgroup serd_attributes Attributes
@ingroup serd_library
@@ -43,41 +45,28 @@
// GCC function attributes
#ifdef __GNUC__
-# define SERD_ALWAYS_INLINE_FUNC __attribute__((always_inline))
-# define SERD_CONST_FUNC __attribute__((const))
-# define SERD_LOG_FUNC(fmt, arg1) __attribute__((format(printf, fmt, arg1)))
-# define SERD_MALLOC_FUNC __attribute__((malloc))
# define SERD_NODISCARD __attribute__((warn_unused_result))
-# define SERD_PURE_FUNC __attribute__((pure))
#else
-# define SERD_ALWAYS_INLINE_FUNC ///< Should absolutely always be inlined
-# define SERD_CONST_FUNC ///< Only reads its parameters
-# define SERD_LOG_FUNC(fmt, arg1) ///< Has printf-like parameters
-# define SERD_MALLOC_FUNC ///< Allocates memory
-# define SERD_NODISCARD ///< Returns a value that must be used
-# define SERD_PURE_FUNC ///< Only reads memory
+# define SERD_NODISCARD ///< Returns a value that must be used
#endif
-// Clang nullability annotations
-#if defined(__clang__) && __clang_major__ >= 7
-# define SERD_NONNULL _Nonnull
-# define SERD_NULLABLE _Nullable
-# define SERD_ALLOCATED _Null_unspecified
+// GCC print format attributes
+#if defined(__MINGW32__)
+# define SERD_LOG_FUNC(fmt, a0) __attribute__((format(gnu_printf, fmt, a0)))
+#elif defined(__GNUC__)
+# define SERD_LOG_FUNC(fmt, a0) __attribute__((format(printf, fmt, a0)))
#else
-# define SERD_NONNULL ///< A non-null pointer
-# define SERD_NULLABLE ///< A nullable pointer
-# define SERD_ALLOCATED ///< An allocated (possibly null) pointer
-# define SERD_UNSPECIFIED ///< A pointer with unspecified nullability
+# define SERD_LOG_FUNC(fmt, a0) ///< Has printf-like parameters
#endif
/// A pure function in the public API that only reads memory
-#define SERD_PURE_API SERD_API SERD_PURE_FUNC
+#define SERD_PURE_API SERD_API ZIX_PURE_FUNC
/// A const function in the public API that is pure and only reads parameters
-#define SERD_CONST_API SERD_API SERD_CONST_FUNC
+#define SERD_CONST_API SERD_API ZIX_CONST_FUNC
/// A malloc function in the public API that returns allocated memory
-#define SERD_MALLOC_API SERD_API SERD_MALLOC_FUNC
+#define SERD_MALLOC_API SERD_API ZIX_MALLOC_FUNC
/**
@}