G_DECLARE_DERIVED_TYPE: allow forward declarations

This allows multiple declarations such as:

 typedef struct _Foo Foo;

as is needed when you have systems with circular referencing.

https://bugzilla.gnome.org/show_bug.cgi?id=743596
This commit is contained in:
Christian Hergert 2015-01-27 18:50:04 +00:00 committed by Ryan Lortie
parent e8d3f29300
commit f3c604d273

View File

@ -1464,8 +1464,9 @@ guint g_type_get_type_registration_serial (void);
**/
#define G_DECLARE_DERIVABLE_TYPE(ModuleObjName, module_obj_name, MODULE, OBJ_NAME, ParentName) \
GType module_obj_name##_get_type (void); \
typedef struct { ParentName parent_instance; } ModuleObjName; \
typedef struct _##ModuleObjName ModuleObjName; \
typedef struct _##ModuleObjName##Class ModuleObjName##Class; \
struct _##ModuleObjName { ParentName parent_instance; }; \
\
static inline ModuleObjName * MODULE##_##OBJ_NAME (gpointer ptr) { \
return G_TYPE_CHECK_INSTANCE_CAST (ptr, module_obj_name##_get_type (), ModuleObjName); } \