[glib/wip/pwithnall/credentials-fix] gmacros: Use __typeof__ when compiling with Clang




commit dce24dc4492dc7918ff240b9c3d4737d7eff6b82
Author: Philip Withnall <pwithnall endlessos org>
Date:   Wed Oct 21 11:32:32 2020 +0100

    gmacros: Use __typeof__ when compiling with Clang
    
    Just like gcc, clang has supported `__typeof__` for a long time, so
    allow it to be used. This fixes compilation of `gio/gcredentials.c` on
    macOS (which uses clang by default).
    
    I don’t know which version clang started supporting `__typeof__` in, so
    there’s no version check. One can be added in future if there are
    problems.
    
    This fixes commit 5b2bee3f539.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 glib/gmacros.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/glib/gmacros.h b/glib/gmacros.h
index 01139b271..d294fa90f 100644
--- a/glib/gmacros.h
+++ b/glib/gmacros.h
@@ -232,7 +232,9 @@
  * This symbol is private.
  */
 #undef glib_typeof
-#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)) && !defined(__cplusplus)
+#if !defined(__cplusplus) && \
+     ((defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))) || \
+      defined(__clang__))
 #define glib_typeof(t) __typeof__ (t)
 #endif
 


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