[libvirt] Dealing with GCC 6.0

Richard W.M. Jones rjones at redhat.com
Tue Feb 2 10:12:31 UTC 2016


On Mon, Feb 01, 2016 at 03:37:07PM +0100, Martin Kletzander wrote:
> So we recently started compiling with gcc 5 and there's a new thing now
> and we don't build on gcc 6.  I know it's just a development build, but
> it finds new things, like:
> 
> fdstream.c: In function 'virFDStreamWrite':
> fdstream.c:390:29: error: logical 'or' of equal expressions [-Werror=logical-op]
>         if (errno == EAGAIN || errno == EWOULDBLOCK) {
>                             ^~
> fdstream.c: In function 'virFDStreamRead':
> fdstream.c:440:29: error: logical 'or' of equal expressions [-Werror=logical-op]
>         if (errno == EAGAIN || errno == EWOULDBLOCK) {
>                             ^~

FWIW this was fixed in libguestfs by rewriting the expression as:

+      if (errno == EWOULDBLOCK ||
+          (EWOULDBLOCK != EAGAIN && errno == EAGAIN))

(commit b12f0a809f7d1aef9215d25bda2f0a2fd955d0f8).  I think the
warning itself is pretty useless.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html




More information about the libvir-list mailing list