Blame SOURCES/0001-codegen-Change-pointer-casting-to-remove-type-punnin.patch

407148
From 64b76c7ca5cf5b4ede2f4b423114f46141890e1e Mon Sep 17 00:00:00 2001
407148
From: Robert Ancell <robert.ancell@canonical.com>
407148
Date: Fri, 7 Sep 2018 10:19:05 +1200
407148
Subject: [PATCH] codegen: Change pointer casting to remove type-punning
407148
 warnings
407148
407148
The existing code was generating code with undefined results that modern compilers warn about:
407148
407148
accounts-generated.c:204:23: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
407148
     (GDBusArgInfo **) &_accounts_accounts_method_info_list_cached_users_OUT_ARG_pointers,
407148
---
407148
 gio/gdbus-2.0/codegen/codegen.py | 22 +++++++++++-----------
407148
 1 file changed, 11 insertions(+), 11 deletions(-)
407148
407148
diff --git a/gio/gdbus-2.0/codegen/codegen.py b/gio/gdbus-2.0/codegen/codegen.py
407148
index e74131cdb..0d95cdcda 100644
407148
--- a/gio/gdbus-2.0/codegen/codegen.py
407148
+++ b/gio/gdbus-2.0/codegen/codegen.py
407148
@@ -1129,10 +1129,10 @@ class CodeGenerator:
407148
                                '\n')
407148
 
407148
         if len(args) > 0:
407148
-            self.outfile.write('static const _ExtendedGDBusArgInfo * const %s_pointers[] =\n'
407148
+            self.outfile.write('static const GDBusArgInfo * const %s_pointers[] =\n'
407148
                              '{\n'%(prefix))
407148
             for a in args:
407148
-                self.outfile.write('  &%s_%s,\n'%(prefix, a.name))
407148
+                self.outfile.write('  &%s_%s.parent_struct,\n'%(prefix, a.name))
407148
             self.outfile.write('  NULL\n'
407148
                                '};\n'
407148
                                '\n')
407148
@@ -1175,10 +1175,10 @@ class CodeGenerator:
407148
                     self.outfile.write('};\n'
407148
                                        '\n')
407148
 
407148
-                self.outfile.write('static const _ExtendedGDBusMethodInfo * const _%s_method_info_pointers[] =\n'
407148
+                self.outfile.write('static const GDBusMethodInfo * const _%s_method_info_pointers[] =\n'
407148
                                    '{\n'%(i.name_lower))
407148
                 for m in i.methods:
407148
-                    self.outfile.write('  &_%s_method_info_%s,\n'%(i.name_lower, m.name_lower))
407148
+                    self.outfile.write('  &_%s_method_info_%s.parent_struct,\n'%(i.name_lower, m.name_lower))
407148
                 self.outfile.write('  NULL\n'
407148
                                    '};\n'
407148
                                    '\n')
407148
@@ -1209,10 +1209,10 @@ class CodeGenerator:
407148
                     self.outfile.write('};\n'
407148
                                        '\n')
407148
 
407148
-                self.outfile.write('static const _ExtendedGDBusSignalInfo * const _%s_signal_info_pointers[] =\n'
407148
+                self.outfile.write('static const GDBusSignalInfo * const _%s_signal_info_pointers[] =\n'
407148
                                    '{\n'%(i.name_lower))
407148
                 for s in i.signals:
407148
-                    self.outfile.write('  &_%s_signal_info_%s,\n'%(i.name_lower, s.name_lower))
407148
+                    self.outfile.write('  &_%s_signal_info_%s.parent_struct,\n'%(i.name_lower, s.name_lower))
407148
                 self.outfile.write('  NULL\n'
407148
                                    '};\n'
407148
                                    '\n')
407148
@@ -1251,10 +1251,10 @@ class CodeGenerator:
407148
                     self.outfile.write('};\n'
407148
                                        '\n')
407148
 
407148
-                self.outfile.write('static const _ExtendedGDBusPropertyInfo * const _%s_property_info_pointers[] =\n'
407148
+                self.outfile.write('static const GDBusPropertyInfo * const _%s_property_info_pointers[] =\n'
407148
                                    '{\n'%(i.name_lower))
407148
                 for p in i.properties:
407148
-                    self.outfile.write('  &_%s_property_info_%s,\n'%(i.name_lower, p.name_lower))
407148
+                    self.outfile.write('  &_%s_property_info_%s.parent_struct,\n'%(i.name_lower, p.name_lower))
407148
                 self.outfile.write('  NULL\n'
407148
                                    '};\n'
407148
                                    '\n')
407148
@@ -1948,7 +1948,7 @@ class CodeGenerator:
407148
             self.outfile.write('  const _ExtendedGDBusPropertyInfo *info;\n'
407148
                                '  GVariant *variant;\n'
407148
                                '  g_assert (prop_id != 0 && prop_id - 1 < %d);\n'
407148
-                               '  info = _%s_property_info_pointers[prop_id - 1];\n'
407148
+                               '  info = (const _ExtendedGDBusPropertyInfo *) _%s_property_info_pointers[prop_id - 1];\n'
407148
                                '  variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);\n'
407148
                                '  if (info->use_gvariant)\n'
407148
                                '    {\n'
407148
@@ -2001,7 +2001,7 @@ class CodeGenerator:
407148
             self.outfile.write('  const _ExtendedGDBusPropertyInfo *info;\n'
407148
                                '  GVariant *variant;\n'
407148
                                '  g_assert (prop_id != 0 && prop_id - 1 < %d);\n'
407148
-                               '  info = _%s_property_info_pointers[prop_id - 1];\n'
407148
+                               '  info = (const _ExtendedGDBusPropertyInfo *) _%s_property_info_pointers[prop_id - 1];\n'
407148
                                '  variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));\n'
407148
                                '  g_dbus_proxy_call (G_DBUS_PROXY (object),\n'
407148
                                '    "org.freedesktop.DBus.Properties.Set",\n'
407148
@@ -2887,7 +2887,7 @@ class CodeGenerator:
407148
                                '  if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))\n'
407148
                                '    {\n'
407148
                                '      if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)\n'
407148
-                               '        _%s_schedule_emit_changed (skeleton, _%s_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);\n'
407148
+                               '        _%s_schedule_emit_changed (skeleton, (const _ExtendedGDBusPropertyInfo *) _%s_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);\n'
407148
                                '      g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);\n'
407148
                                '      g_object_notify_by_pspec (object, pspec);\n'
407148
                                '    }\n'
407148
-- 
407148
2.19.1
407148