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
])
# 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.
*/
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:
}
-/* 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
/**
#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,