Re: [resend PATCH] gmacros.h: Don't use __alloc_size__ with clang



hi;

thank you for you patch.

GLib uses Bugzilla for tracking and reviewing patches. could you please open a new issue against the "glib" product on https://bugzilla.gnome.org/enter_bug.cgi?product=glib instead of using the mailing list?

thanks!

ciao,
 Emmanuele.

On Wednesday, February 11, 2015, Lubomir Rintel <lkundrak v3 sk> wrote:
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

_______________________________________________
gtk-devel-list mailing list
gtk-devel-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-devel-list


--
https://www.bassi.io
[ ] ebassi [@gmail.com]


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]