Re: Non-zero constant warning on RHEL 6.1 with 0.9.7

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

 



On 09.11.2011 07:46, Justin Clift wrote:
> Hi guys,
> 
> Just checking 0.9.7 on RHEL 6.1 x86_64.  Noticed this when compiling
> with make -j 3:
> 
>   make[3]: Entering directory `/home/jc/git_repos/libvirt/src'
>     CC     libvirt_util_la-bitmap.lo
>     CC     libvirt_util_la-authhelper.lo
>     CC     libvirt_util_la-bridge.lo
>     CC     libvirt_util_la-buf.lo
>     CC     libvirt_util_la-command.lo
>   util/buf.c: In function 'virBufferEscape':
>   util/buf.c:469: warning: logical '&&' with non-zero constant will always evaluate as true [-Wlogical-op]
> 
>   ...

I've ran gcc -E on util/buf.c and interesting things are happening there:

the original code:
    while (*cur != 0) {
        if (strchr(toescape, *cur))
            *out++ = '\\';
        *out++ = *cur;
        cur++;
    }

[line 469 is: if (strchr(...))]

after preprocessing stage:

    while (*cur != 0) {
        if ((__extension__ (__builtin_constant_p (*cur) &&
!__builtin_constant_p (toescape) && (*cur) == '\0' ? (char *)
__rawmemchr (toescape, *cur) : __builtin_strchr (toescape, *cur))))
            *out++ = '\\';
        *out++ = *cur;
        cur++;
    }

So I think the problem lies within !__builtin_constant_p (toescape) but
i am not sure how to fix that.

Michal

--
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]