From 7107d1db0b3361a3e880d903a45920b64a05e9d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Wed, 9 Sep 2020 21:35:15 +0200 Subject: Refactor __attribute__ usage Use internal macros for compatibility with non GNUC compilers. --- Macros.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'Macros.h') diff --git a/Macros.h b/Macros.h index cb84b291..ef4e8908 100644 --- a/Macros.h +++ b/Macros.h @@ -13,4 +13,20 @@ #define CLAMP(x, low, high) (((x) > (high)) ? (high) : MAXIMUM(x, low)) #endif +#ifdef __GNUC__ // defined by GCC and Clang + +#define ATTR_FORMAT(type, index, check) __attribute__((format (type, index, check))) +#define ATTR_NONNULL __attribute__((nonnull)) +#define ATTR_NORETURN __attribute__((noreturn)) +#define ATTR_UNUSED __attribute__((unused)) + +#else /* __GNUC__ */ + +#define ATTR_FORMAT(type, index, check) +#define ATTR_NONNULL +#define ATTR_NORETURN +#define ATTR_UNUSED + +#endif /* __GNUC__ */ + #endif -- cgit v1.2.3