summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2016-02-10 22:37:41 +0000
committerEmmanuele Bassi <ebassi@gnome.org>2016-02-10 22:37:41 +0000
commit1964a8726b06237f751b2aa8b2a3fcd2ce555c44 (patch)
treeed8e379ce0634c41da8d9abdf893415dc548027a
parentc7f540b9e98bca42fc2207c16425ac326edf8ab3 (diff)
downloadglib-1964a8726b06237f751b2aa8b2a3fcd2ce555c44.tar.gz
macros: Fix Clang attribute detection
For attributes we have to use __has_attribute(). https://bugzilla.gnome.org/show_bug.cgi?id=761843
-rw-r--r--glib/gmacros.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/glib/gmacros.h b/glib/gmacros.h
index 22edb2ef6..4570d2524 100644
--- a/glib/gmacros.h
+++ b/glib/gmacros.h
@@ -91,6 +91,10 @@
#endif
/* Clang feature detection: http://clang.llvm.org/docs/LanguageExtensions.html */
+#ifndef __has_attribute
+#define __has_attribute(x) 0
+#endif
+
#ifndef __has_feature
#define __has_feature(x) 0
#endif
@@ -100,7 +104,7 @@
#endif
#if (!defined(__clang__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) || \
- (defined(__clang__) && __has_feature(__alloc_size__))
+ (defined(__clang__) && __has_attribute(__alloc_size__))
#define G_GNUC_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
#define G_GNUC_ALLOC_SIZE2(x,y) __attribute__((__alloc_size__(x,y)))
#else