[PATCH] build: add pragma directive to fix build on some gcc

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

 



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 <phrdina@xxxxxxxxxx>
---

Pushed as build-breaker fix.

 src/util/virstring.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/util/virstring.c b/src/util/virstring.c
index 7b0cad7..5794f96 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
-- 
2.0.5

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