diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2020-09-09 21:35:15 +0200 |
---|---|---|
committer | cgzones <cgzones@googlemail.com> | 2020-09-18 12:28:40 +0200 |
commit | 7107d1db0b3361a3e880d903a45920b64a05e9d6 (patch) | |
tree | 926c71c5d2095f156bda3863fc3f8dbcacbc017f /Macros.h | |
parent | f4602f7b4e7fdcf4b3a5d2c0c353b50fef98aa7e (diff) |
Refactor __attribute__ usage
Use internal macros for compatibility with non GNUC compilers.
Diffstat (limited to 'Macros.h')
-rw-r--r-- | Macros.h | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -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 |