Refactor __attribute__ usage

Use internal macros for compatibility with non GNUC compilers.
This commit is contained in:
Christian Göttsche
2020-09-09 21:35:15 +02:00
committed by cgzones
parent f4602f7b4e
commit 7107d1db0b
7 changed files with 24 additions and 24 deletions

View File

@ -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