1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

esx: Avoid warnings about breaking strict-aliasing rules on FreeBSD

This commit is contained in:
Matthias Bolte 2010-11-13 14:32:06 +01:00
parent 5c2aa3b7d8
commit f76c6dde2e

View File

@ -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