http://bugzilla.gnome.org/show_bug.cgi?id=337128
Bug 337128 – Macro expansion problems calling G_DEFINE_TYPE_EXTENDED
Index: gobject/gtype.h
===================================================================
RCS file: /cvs/gnome/glib/gobject/gtype.h,v
retrieving revision 1.63
diff -u -p -d -r1.63 gtype.h
--- gobject/gtype.h	27 Sep 2005 23:19:16 -0000	1.63
+++ gobject/gtype.h	18 Apr 2006 20:45:20 -0000
@@ -325,10 +325,16 @@ gpointer g_type_instance_get_private    
  * example: G_DEFINE_TYPE_WITH_CODE (GtkGadget, gtk_gadget, GTK_TYPE_WIDGET,
  *                                   g_print ("GtkGadget-id: %lu\n", g_define_type_id));
  */
-#define G_DEFINE_TYPE(TN, t_n, T_P)                         G_DEFINE_TYPE_EXTENDED (TN, t_n, T_P, 0, {})
-#define G_DEFINE_TYPE_WITH_CODE(TN, t_n, T_P, _C_)          G_DEFINE_TYPE_EXTENDED (TN, t_n, T_P, 0, _C_)
-#define G_DEFINE_ABSTRACT_TYPE(TN, t_n, T_P)                G_DEFINE_TYPE_EXTENDED (TN, t_n, T_P, G_TYPE_FLAG_ABSTRACT, {})
-#define G_DEFINE_ABSTRACT_TYPE_WITH_CODE(TN, t_n, T_P, _C_) G_DEFINE_TYPE_EXTENDED (TN, t_n, T_P, G_TYPE_FLAG_ABSTRACT, _C_)
+#define G_DEFINE_TYPE(TN, t_n, T_P) \
+	_G_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, 0)     _G_DEFINE_TYPE_EXTENDED_END
+#define G_DEFINE_TYPE_WITH_CODE(TN, t_n, T_P, _C_) \
+	_G_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, 0) _C_ _G_DEFINE_TYPE_EXTENDED_END
+#define G_DEFINE_ABSTRACT_TYPE(TN, t_n, T_P) \
+	_G_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, G_TYPE_FLAG_ABSTRACT)     _G_DEFINE_TYPE_EXTENDED_END
+#define G_DEFINE_ABSTRACT_TYPE_WITH_CODE(TN, t_n, T_P, _C_) \
+	_G_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, G_TYPE_FLAG_ABSTRACT) _C_ _G_DEFINE_TYPE_EXTENDED_END
+#define G_DEFINE_TYPE_EXTENDED(TN, t_n, T_P, _f_, _C_) \
+	_G_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, _f_) _C_ _G_DEFINE_TYPE_EXTENDED_END
 
 /* convenience macro to ease interface addition in the CODE
  * section of G_DEFINE_TYPE_WITH_CODE() (this macro relies on
@@ -345,7 +351,7 @@ gpointer g_type_instance_get_private    
   g_type_add_interface_static (g_define_type_id, TYPE_IFACE, &g_implement_interface_info); \
 }
 
-#define G_DEFINE_TYPE_EXTENDED(TypeName, type_name, TYPE_PARENT, flags, CODE) \
+#define _G_DEFINE_TYPE_EXTENDED_BEGIN(TypeName, type_name, TYPE_PARENT, flags) \
 \
 static void     type_name##_init              (TypeName        *self); \
 static void     type_name##_class_init        (TypeName##Class *klass); \
@@ -375,7 +381,10 @@ type_name##_get_type (void) \
         NULL    /* value_table */ \
       }; \
       g_define_type_id = g_type_register_static (TYPE_PARENT, g_intern_static_string (#TypeName), &g_define_type_info, (GTypeFlags) flags); \
-      { CODE ; } \
+      {
+#define _G_DEFINE_TYPE_EXTENDED_END \
+        ; \
+      } \
     } \
   return g_define_type_id; \
 }
