summaryrefslogtreecommitdiffstats
path: root/Macros.h
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2020-09-09 21:35:15 +0200
committercgzones <cgzones@googlemail.com>2020-09-18 12:28:40 +0200
commit7107d1db0b3361a3e880d903a45920b64a05e9d6 (patch)
tree926c71c5d2095f156bda3863fc3f8dbcacbc017f /Macros.h
parentf4602f7b4e7fdcf4b3a5d2c0c353b50fef98aa7e (diff)
Refactor __attribute__ usage
Use internal macros for compatibility with non GNUC compilers.
Diffstat (limited to 'Macros.h')
-rw-r--r--Macros.h16
1 files changed, 16 insertions, 0 deletions
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

© 2014-2024 Faster IT GmbH | imprint | privacy policy