[glib] Account for clangs lack of __alloc_size__



commit 42870201f8cd304d9e38b1b99d63a407dc9ae107
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Mar 22 14:18:36 2015 -0400

    Account for clangs lack of __alloc_size__
    
    clang's emulation of gcc 4.3 is not perfect, despite its
    pretending that it is.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=745821

 glib/gmacros.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/glib/gmacros.h b/glib/gmacros.h
index b34cc77..735db2b 100644
--- a/glib/gmacros.h
+++ b/glib/gmacros.h
@@ -63,7 +63,8 @@
 #define G_GNUC_NULL_TERMINATED
 #endif
 
-#if     (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+#if     (!defined(__clang__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) || \
+        (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]