[libvirt] [PATCH] esx: Avoid warnings about breaking strict-aliasing rules on FreeBSD

Eric Blake eblake at redhat.com
Sat Nov 13 20:01:55 UTC 2010


On 11/13/2010 08:53 AM, Matthias Bolte wrote:
> ---
>  src/esx/esx_vi_generator.py |   10 ++++++++--
>  1 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/src/esx/esx_vi_generator.py b/src/esx/esx_vi_generator.py
> index c2f7044..01636aa 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

ACK.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20101113/0e228550/attachment-0001.sig>


More information about the libvir-list mailing list