From: Matthias Bolte Date: Sat, 13 Nov 2010 13:32:06 +0000 (+0100) Subject: esx: Avoid warnings about breaking strict-aliasing rules on FreeBSD X-Git-Tag: v0.8.6~99 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f76c6dde2e33233566e886d96e76b5fe0c102d9a;p=thirdparty%2Flibvirt.git esx: Avoid warnings about breaking strict-aliasing rules on FreeBSD --- diff --git a/src/esx/esx_vi_generator.py b/src/esx/esx_vi_generator.py index c2f7044a3b..01636aa6f1 100755 --- a/src/esx/esx_vi_generator.py +++ b/src/esx/esx_vi_generator.py @@ -699,7 +699,10 @@ class Object: if self.features & Object.FEATURE__LIST: if self.extends is not None: - source += " esxVI_%s_Free((esxVI_%s **)&item->_next);\n\n" % (self.extends, self.extends) + # avoid "dereferencing type-punned pointer will break strict-aliasing rules" warnings + source += " esxVI_%s *next = (esxVI_%s *)item->_next;\n\n" % (self.extends, self.extends) + source += " esxVI_%s_Free(&next);\n" % self.extends + source += " item->_next = (esxVI_%s *)next;\n\n" % self.name else: source += " esxVI_%s_Free(&item->_next);\n\n" % self.name @@ -719,7 +722,10 @@ class Object: if self.features & Object.FEATURE__LIST: if self.extends is not None: - source += " esxVI_%s_Free((esxVI_%s **)&item->_next);\n\n" % (self.extends, self.extends) + # avoid "dereferencing type-punned pointer will break strict-aliasing rules" warnings + source += " esxVI_%s *next = (esxVI_%s *)item->_next;\n\n" % (self.extends, self.extends) + source += " esxVI_%s_Free(&next);\n" % self.extends + source += " item->_next = (esxVI_%s *)next;\n\n" % self.name else: source += " esxVI_%s_Free(&item->_next);\n\n" % self.name