提交 9fb6aff0 编写于 作者: P Pavel Hrdina 提交者: Cole Robinson

build: cleanup GCC < 4.6 -Wlogical-op workaround

Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
(cherry picked from commit 7fb81831)
上级 b4a32e51
......@@ -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
])
......@@ -253,6 +253,16 @@
# 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.
*/
......
......@@ -421,14 +421,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:
......
......@@ -986,14 +986,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
/**
......
......@@ -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,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册