From f76c6dde2e33233566e886d96e76b5fe0c102d9a Mon Sep 17 00:00:00 2001 From: Matthias Bolte Date: Sat, 13 Nov 2010 14:32:06 +0100 Subject: [PATCH] esx: Avoid warnings about breaking strict-aliasing rules on FreeBSD --- src/esx/esx_vi_generator.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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 -- 2.39.5