[libvirt] [PATCH] turn off strict-aliasing warnings in two files
Jim Meyering
jim at meyering.net
Fri Feb 6 19:12:24 UTC 2009
"Daniel P. Berrange" <berrange at redhat.com> wrote:
> On Fri, Feb 06, 2009 at 07:31:46PM +0100, Jim Meyering wrote:
>> Without these changes and with gcc-4.4,
>> I'd get 4 warnings (2 in each file)
>> about strict-aliasing violations.
>> -Wstrict-aliasing is worth keeping in general, so I
>> have disabled it only for the two offending files.
>
>
> Can you show what lines / code trigger the warnings and/r just
> post the warnings themselves ?
bridge.c:657: warning: dereferencing pointer '({anonymous})' does break strict-aliasing rules
bridge.c:658: warning: dereferencing pointer '({anonymous})' does break strict-aliasing rules
qemud.c:671: warning: dereferencing pointer 'sa.72' does break strict-aliasing rules
qemud.c:674: warning: dereferencing pointer 'sa.73' does break strict-aliasing rules
bridge.c:
if ((ret = inet_pton(AF_INET, addr, &inaddr)) < 0)
return errno;
else if (ret == 0)
return EINVAL;
((struct sockaddr_in *)&ifr.ifr_data)->sin_family = AF_INET;
((struct sockaddr_in *)&ifr.ifr_data)->sin_addr = inaddr;
qemud.c:
if (getsockname(sock->fd, (struct sockaddr *)(&sa), &salen) < 0)
goto cleanup;
if (sa.ss_family == AF_INET)
sock->port = htons(((struct sockaddr_in*)&sa)->sin_port);
#ifdef AF_INET6
else if (sa.ss_family == AF_INET6)
sock->port = htons(((struct sockaddr_in6*)&sa)->sin6_port);
More information about the libvir-list
mailing list