build: cleanup GCC < 4.6 -Wlogical-op workaround

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Pavel Hrdina 2016-04-10 18:21:13 +02:00
parent 16b41728b5
commit 7fb81831fc
5 changed files with 17 additions and 28 deletions

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

View File

@ -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.
*/

View 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:

View 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
/**

View 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,