From 9f3f089e60d5de07e24b6c6cb9a6094678ed0481 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Fri, 8 Dec 2017 12:56:55 +0000 Subject: [PATCH] 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 Reviewed-by: Philip Withnall https://bugzilla.gnome.org/show_bug.cgi?id=790697 --- gobject/gobject.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gobject/gobject.h b/gobject/gobject.h index 15f3529b9..490d9266a 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 /**