From: Pavel Hrdina Date: Fri, 24 Apr 2015 10:57:10 +0000 (+0200) Subject: build: add pragma directive to fix build on some gcc X-Git-Tag: v1.2.15-rc1~48 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7674c0454b50b223c8348d2adc6e6db016ddbc2d;p=thirdparty%2Flibvirt.git build: add pragma directive to fix build on some gcc Commit 1268820a removed obsolete index() function and replaced it by strchr. Few versions of gcc has a bug and reports a warning about strchr: ../../src/util/virstring.c:1006: error: logical '&&' with non-zero constant will always evaluate as true [-Wlogical-op] Signed-off-by: Pavel Hrdina --- diff --git a/src/util/virstring.c b/src/util/virstring.c index 7b0cad7540..5794f96840 100644 --- a/src/util/virstring.c +++ b/src/util/virstring.c @@ -986,6 +986,16 @@ virStringHasControlChars(const char *str) } +/* Work around spurious strchr() diagnostics given by -Wlogical-op + * for gcc < 4.6. Doing it via a local pragma keeps the damage + * smaller than disabling it on the package level. Unfortunately, the + * affected GCCs don't allow diagnostic push/pop which would have + * further reduced the impact. */ +#if BROKEN_GCC_WLOGICALOP +# pragma GCC diagnostic ignored "-Wlogical-op" +#endif + + /** * virStringStripControlChars: * @str: the string to strip