[glib] Use escaped version of typeof



commit 9f3f089e60d5de07e24b6c6cb9a6094678ed0481
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Fri Dec 8 12:56:55 2017 +0000

    Use escaped version of typeof
    
    When compiling code that includes gobject.h using GCC with the ISO
    standard, the `typeof` keyword is disabled, as it's a GCC extension.
    
    The GCC documentation recommends:
    
    > If you are writing a header file that must work when included in
    > ISO C programs, write __typeof__ instead of typeof.
    
    Which is precisely what we're going to do.
    
    Signed-off-by: Emmanuele Bassi <ebassi gnome org>
    Reviewed-by: Philip Withnall <withnall endlessm com>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=790697

 gobject/gobject.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gobject/gobject.h b/gobject/gobject.h
index 15f3529..490d926 100644
--- a/gobject/gobject.h
+++ b/gobject/gobject.h
@@ -510,8 +510,8 @@ void        g_object_remove_weak_pointer      (GObject        *object,
 
 #if defined(__GNUC__) && GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_56
 /* Make reference APIs type safe with macros */
-#define g_object_ref(Obj)      ((typeof(Obj)) (g_object_ref) (Obj))
-#define g_object_ref_sink(Obj) ((typeof(Obj)) (g_object_ref_sink) (Obj))
+#define g_object_ref(Obj)      ((__typeof__(Obj)) (g_object_ref) (Obj))
+#define g_object_ref_sink(Obj) ((__typeof__(Obj)) (g_object_ref_sink) (Obj))
 #endif
 
 /**


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