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

Cole Robinson crobinso at redhat.com
Sun Apr 10 02:16:26 UTC 2016


On 04/08/2016 12:27 PM, Andrea Bolognani wrote:
> On Mon, 2016-02-29 at 15:41 +0100, Martin Kletzander wrote:
>> 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.
>>>  
>>> Signed-off-by: Eric Blake <eblake at redhat.com>
>>> ---
>>>  
>>> This is a build-breaker fix for rawhide; but I'll wait for a day
>>> for any reasons why I should not push it during freeze.
>>>  
>> It looks like you're still talking this over and thinking about
>> approaches.  But could we push the fix for the time being so that the
>> release is nicely buildable and then work on making it nicer later?  I'd
>> vote ACK for that.
> 
> Update: the libvirt-fedora-rawhide build host on CentOS CI
> has been updated and it's now running gcc 6.0. The immediate
> result is that build jobs have started to fail (see [1] for
> an example).
> 
> Looking at the gcc bug, it doesn't look like there's been
> much movement in that area, so I think we should take some
> action on our side...
> 
> Eric, you mentioned proposing a v2 that would use #pragma
> instead of uglifying the current checks. Do you still
> intend to work on such alternative approach?
> 

I've attached a patch with the pragma push/pop approach Eric mentioned.
Unfortunately it doesn't work as is on RHEL6 vintage gcc so it's probably not
a realistic option.

> Failing that, I'm personally okay with pushing this.
> 

I agree

- Cole
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-build-Avoid-Wlogical-op-bug-on-gcc6.patch
Type: text/x-diff
Size: 4564 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160409/b60acdf7/attachment-0001.bin>


More information about the libvir-list mailing list