[libvirt] [PATCH] build: work around gcc 6.0 warnings

Pavel Hrdina phrdina at redhat.com
Thu Feb 25 11:15:34 UTC 2016


On Wed, Feb 24, 2016 at 02:29:58PM -0700, Eric Blake wrote:
> gcc 6.0 added an annoying warning:
> 
> 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) {
>                             ^~
> 
> This makes it impossible to build out-of-the-box on rawhide,
> and we aren't guaranteed that the gcc bug will be fixed in a
> timely manner:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69602
> 
> So work around it by further complicating the logic to thwart the
> compiler.

Personally I don't like this approach.  Why don't we take that 6 line reproducer
from GCC BZ and create a m4 macro that will detect that bug in GCC and turn off
the logical-op check?  For me this solution is much cleaner than introducing
some ugly workaround in our code just because GCC has a bug.

Pavel




More information about the libvir-list mailing list