]> xenbits.xensource.com Git - libvirt.git/commitdiff
build: cleanup GCC < 4.6 -Wlogical-op workaround
authorPavel Hrdina <phrdina@redhat.com>
Sun, 10 Apr 2016 16:21:13 +0000 (18:21 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Mon, 11 Apr 2016 10:09:11 +0000 (12:09 +0200)
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
m4/virt-compile-warnings.m4
src/internal.h
src/util/virbuffer.c
src/util/virstring.c
src/util/virsysinfo.c

index 3dd0665c3d35e5556e5504f11fea62a261fc978f..1b0a2cf9e3e1e0e55ba708df4275e8967b532ab0 100644 (file)
@@ -236,7 +236,7 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
 
     if test "$gl_cv_warn_c__Wlogical_op" = yes &&
        test "$lv_cv_gcc_wlogical_op_broken" = yes; then
-      AC_DEFINE_UNQUOTED([BROKEN_GCC_WLOGICALOP], 1,
+      AC_DEFINE_UNQUOTED([BROKEN_GCC_WLOGICALOP_STRCHR], 1,
        [Define to 1 if gcc -Wlogical-op reports false positives on strchr])
     fi
 ])
index 9ebaf3c5a89339d0840283c24cd02a24c2378575..cf86a56af1ff1d0419d1827417c85fe7403d5746 100644 (file)
 #  define VIR_WARNINGS_RESET
 # endif
 
+/* Workaround bogus GCC < 4.6 that produces false -Wlogical-op warnings for
+ * strchr(). Those old GCCs don't support push/pop. */
+# if BROKEN_GCC_WLOGICALOP_STRCHR
+#  define VIR_WARNINGS_NO_WLOGICALOP_STRCHR                \
+    _Pragma ("GCC diagnostic ignored \"-Wlogical-op\"")
+# else
+#  define VIR_WARNINGS_NO_WLOGICALOP_STRCHR
+# endif
+
+
 /*
  * Use this when passing possibly-NULL strings to printf-a-likes.
  */
index 43cd1a7175e630236b8aa89b4f612c5fcf0e8897..d582e7dbec1ae6af4815d942c08c845958a563b1 100644 (file)
@@ -417,14 +417,9 @@ 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
+
+VIR_WARNINGS_NO_WLOGICALOP_STRCHR
+
 
 /**
  * virBufferEscapeString:
index 7ec42aa18903d115b2f3d7ffc2f906a2da9587b8..2d7fbf3eb4644b4f0f12447477b0f48e8025a11e 100644 (file)
@@ -989,14 +989,7 @@ 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
+VIR_WARNINGS_NO_WLOGICALOP_STRCHR
 
 
 /**
index 05d33a8ce2b6b2de07f6cc8476b778caf3d5ed52..e8dbd4d01a44632955c4277dba0f2a7e65d502bd 100644 (file)
@@ -428,17 +428,8 @@ virSysinfoRead(void)
 
 
 #elif defined(__s390__) || defined(__s390x__)
-/*
-  we need to ignore warnings about strchr caused by -Wlogical-op
-  for some GCC versions.
-  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
+
+VIR_WARNINGS_NO_WLOGICALOP_STRCHR
 
 static char *
 virSysinfoParseDelimited(const char *base, const char *name, char **value,