Re: [libvirt] [PATCH] turn off strict-aliasing warnings in two files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Daniel P. Berrange" <berrange@xxxxxxxxxx> 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);

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]