codegen: move G_DEFINE_INTERFACE{,_WITH_CODE} before _default_init

to avoid warnings when built with -Wredundant-decls:

  sessionmanager-presence-generated.c:316:1: warning: redundant redeclaration of ‘session_manager_presence_default_init’ [-Wredundant-decls]
  sessionmanager-presence-generated.c:281:1: note: previous definition of ‘session_manager_presence_default_init’ was here
  sessionmanager-presence-generated.c:1273:1: warning: redundant redeclaration of ‘object_default_init’ [-Wredundant-decls]
  sessionmanager-presence-generated.c:1259:1: note: previous definition of ‘object_default_init’ was here

https://bugzilla.gnome.org/show_bug.cgi?id=696108
This commit is contained in:
Guido Günther 2013-03-24 17:11:49 +01:00
parent 576e2ce1db
commit 31c00c1fbe

View File

@ -1029,6 +1029,10 @@ class CodeGenerator:
self.write_gtkdoc_deprecated_and_since_and_close(i, self.c, 0)
self.c.write('\n')
self.c.write('typedef %sIface %sInterface;\n'%(i.camel_name, i.camel_name))
self.c.write('G_DEFINE_INTERFACE (%s, %s, G_TYPE_OBJECT);\n'%(i.camel_name, i.name_lower))
self.c.write('\n')
self.c.write('static void\n'
'%s_default_init (%sIface *iface)\n'
'{\n'%(i.name_lower, i.camel_name));
@ -1175,10 +1179,6 @@ class CodeGenerator:
self.c.write('}\n'
'\n')
self.c.write('typedef %sIface %sInterface;\n'%(i.camel_name, i.camel_name))
self.c.write('G_DEFINE_INTERFACE (%s, %s, G_TYPE_OBJECT);\n'%(i.camel_name, i.name_lower))
self.c.write('\n')
# ----------------------------------------------------------------------------------------------------
def generate_property_accessors(self, i):
@ -2660,6 +2660,9 @@ class CodeGenerator:
%(self.namespace, self.namespace), False))
self.c.write('\n')
self.c.write('typedef %sObjectIface %sObjectInterface;\n'%(self.namespace, self.namespace))
self.c.write('G_DEFINE_INTERFACE_WITH_CODE (%sObject, %sobject, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT));\n'%(self.namespace, self.ns_lower))
self.c.write('\n')
self.c.write('static void\n'
'%sobject_default_init (%sObjectIface *iface)\n'
'{\n'
@ -2680,10 +2683,6 @@ class CodeGenerator:
self.c.write('}\n'
'\n')
self.c.write('typedef %sObjectIface %sObjectInterface;\n'%(self.namespace, self.namespace))
self.c.write('G_DEFINE_INTERFACE_WITH_CODE (%sObject, %sobject, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT));\n'%(self.namespace, self.ns_lower))
self.c.write('\n')
for i in self.ifaces:
self.c.write(self.docbook_gen.expand(
'/**\n'