[PATCH] virbuffer: fix build on rhel-6

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

 



On rhel-6 is broken gcc that reports this warning:

util/virbuffer.c:500: error: logical '&&' with non-zero constant will
    always evaluate as true [-Wlogical-op]

Move the pragma directive before function virBufferEscapeString because
since commit aeb5262e this function uses 'strchr' too.

Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---

Pushed as build-breaker fix.

 src/util/virbuffer.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/util/virbuffer.c b/src/util/virbuffer.c
index 3d13c90..5b338f8 100644
--- a/src/util/virbuffer.c
+++ b/src/util/virbuffer.c
@@ -421,6 +421,15 @@ virBufferVasprintf(virBufferPtr buf, const char *format, va_list argptr)
     buf->use += count;
 }
 
+/* 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
+
 /**
  * virBufferEscapeString:
  * @buf: the buffer to append to
@@ -535,15 +544,6 @@ virBufferEscapeSexpr(virBufferPtr buf,
     virBufferEscape(buf, '\\', "\\'", format, 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
-
 /**
  * virBufferEscape:
  * @buf: the buffer to append to
-- 
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]