summaryrefslogtreecommitdiffstats
path: root/Macros.h
diff options
context:
space:
mode:
authorBenny Baumann <BenBE@geshi.org>2021-06-27 12:44:01 +0200
committerBenBE <BenBE@geshi.org>2021-07-06 17:20:32 +0200
commit44d1200ca47d1ffb5b20a9da183b1e0b25bfb8f7 (patch)
treea1b49791bb8b24454e440dc59e2102ff97c9f797 /Macros.h
parent3da142b4b6a1ab418d7cc564f42b0f5675293df3 (diff)
Check for alloc_size attribute in configure.ac
Diffstat (limited to 'Macros.h')
-rw-r--r--Macros.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/Macros.h b/Macros.h
index 14249f3d..5e8891a4 100644
--- a/Macros.h
+++ b/Macros.h
@@ -37,8 +37,6 @@
#define ATTR_NONNULL __attribute__((nonnull))
#define ATTR_NORETURN __attribute__((noreturn))
#define ATTR_UNUSED __attribute__((unused))
-#define ATTR_ALLOC_SIZE1(a) __attribute__((alloc_size (a)))
-#define ATTR_ALLOC_SIZE2(a, b) __attribute__((alloc_size (a, b)))
#define ATTR_MALLOC __attribute__((malloc))
#else /* __GNUC__ */
@@ -47,12 +45,22 @@
#define ATTR_NONNULL
#define ATTR_NORETURN
#define ATTR_UNUSED
-#define ATTR_ALLOC_SIZE1(a)
-#define ATTR_ALLOC_SIZE2(a, b)
#define ATTR_MALLOC
#endif /* __GNUC__ */
+#ifdef HAVE_ATTR_ALLOC_SIZE
+
+#define ATTR_ALLOC_SIZE1(a) __attribute__((alloc_size (a)))
+#define ATTR_ALLOC_SIZE2(a, b) __attribute__((alloc_size (a, b)))
+
+#else
+
+#define ATTR_ALLOC_SIZE1(a)
+#define ATTR_ALLOC_SIZE2(a, b)
+
+#endif /* HAVE_ATTR_ALLOC_SIZE */
+
// ignore casts discarding const specifier, e.g.
// const char [] -> char * / void *
// const char *[2]' -> char *const *

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