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 11/15/2011 04:41 AM, Daniel P. Berrange wrote:
>>      while (*cur != 0) {
>> -        if (strchr(toescape, *cur))
>> +        /* strchr work-around for gcc 4.3 & 4.4 bug with -Wlogical-op
>> +         * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36513
>> +         */
>> +        char needle[2] = { *cur, 0 };
>> +        if (strstr(toescape, needle))
>>              *out++ = '\\';
> 
> I'm puzzelled that we need this change here, but we have 175 other
> uses of strchr without trouble
> 
>   $ grep strchr src/*/*.c | wc -l
>   174

Rather, look for instances of strchr that have a constant second argument:

$ git grep strchr".*'" src/*/*.c | wc -l
173

vs. those with a variable second argument:

$ git grep strchr"[^']*\$" src/*/*.c | wc -l
3

further, 2 of those 3 have a constant first argument.  So this really
was the only instance of using strchr() with two variable arguments, and
that is the only use-case that can trigger the gcc bug.

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

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