From 31c00c1fbeba76e046ade5792b9b3b3638d9f11c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Sun, 24 Mar 2013 17:11:49 +0100 Subject: [PATCH] codegen: move G_DEFINE_INTERFACE{,_WITH_CODE} before _default_init MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- gio/gdbus-2.0/codegen/codegen.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/gio/gdbus-2.0/codegen/codegen.py b/gio/gdbus-2.0/codegen/codegen.py index ee2834fb3..293b93e94 100644 --- a/gio/gdbus-2.0/codegen/codegen.py +++ b/gio/gdbus-2.0/codegen/codegen.py @@ -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'