[resend PATCH] gmacros.h: Don't use __alloc_size__ with clang
- From: Lubomir Rintel <lkundrak v3 sk>
- To: gtk-devel-list gnome org
- Subject: [resend PATCH] gmacros.h: Don't use __alloc_size__ with clang
- Date: Wed, 11 Feb 2015 11:16:59 +0100
It doesnt's support it yet. Add a clang feature check in case it gets added
later.
Signed-off-by: Lubomir Rintel <lkundrak v3 sk>
---
glib/gmacros.h | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/glib/gmacros.h b/glib/gmacros.h
index 62b61cb..2505b91 100644
--- a/glib/gmacros.h
+++ b/glib/gmacros.h
@@ -47,6 +47,13 @@
#define G_GNUC_EXTENSION
#endif
+/* clang feature checks. Sadly, clang masquerades as GCC even without
+ * a sensible feature parity.
+ */
+#if !defined (__has_builtin)
+#define __has_builtin(builtin) 0
+#endif
+
/* Provide macros to feature the GCC function attribute.
*/
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
@@ -63,7 +70,7 @@
#define G_GNUC_NULL_TERMINATED
#endif
-#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+#if __has_builtin(__alloc_size__) || (!defined (__clang__) && ((__GNUC__ > 4) || (__GNUC__ == 4 &&
__GNUC_MINOR__ >= 3)))
#define G_GNUC_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
#define G_GNUC_ALLOC_SIZE2(x,y) __attribute__((__alloc_size__(x,y)))
#else
--
2.1.0
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]