[libvirt] Compiler warnings

Eric Blake eblake at redhat.com
Mon Oct 17 17:03:32 UTC 2011


On 10/17/2011 10:17 AM, Alex Jia wrote:
> Eric,
> It's latest libvirt upstream, current commit id is commit 0a71c79.
>
> # rpm -q glibc
> glibc-2.12-1.42.el6.x86_64
>

> 430         if (strchr(toescape, *cur))

>>>      CC     libvirt_util_la-buf.lo
>>> util/buf.c: In function 'virBufferEscape':
>>> util/buf.c:430: warning: logical '&&' with non-zero constant will always
>>> evaluate as true [-Wlogical-op]

Something's screwy.  There's no && in that line, unless strchr() is a 
macro based on your particular compilation flags.  I'm suspecting that 
this is a case of -D_FORTIFY_SOURCE going awry.  I don't see how this 
could possibly be a libvirt issue; more likely, it is an issue with the 
choice of compiler flags you are using, coupled with an issue in the 
system headers causing the preprocessor to expand strchr() into 
something that tickles a spurious gcc warning.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org




More information about the libvir-list mailing list