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(a)redhat.com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org