[glib] macros: Fix Clang attribute detection



commit 1964a8726b06237f751b2aa8b2a3fcd2ce555c44
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Wed Feb 10 22:37:41 2016 +0000

    macros: Fix Clang attribute detection
    
    For attributes we have to use __has_attribute().
    
    https://bugzilla.gnome.org/show_bug.cgi?id=761843

 glib/gmacros.h |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/glib/gmacros.h b/glib/gmacros.h
index 22edb2e..4570d25 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


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