mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
build: bump min required gcc to 4.8
The previous bump to 4.4 was done in:
commit 24241c236e
Author: Daniel P. Berrange <berrange@redhat.com>
Date: Wed Jul 5 10:35:32 2017 +0100
Require use of GCC 4.4 or CLang compilers
with 4.4 picked due to RHEL-6. Since we dropped RHEL-6, the
next oldest distro is RHEL-7 (4.8.5), and thus we pick 4.8
as the new min.
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
7bc812000c
commit
a067b781e9
@ -71,7 +71,7 @@
|
||||
#endif /* LIBVIRT_NSS */
|
||||
|
||||
#ifndef __GNUC__
|
||||
# error "Libvirt requires GCC >= 4.4, or CLang"
|
||||
# error "Libvirt requires GCC >= 4.8, or CLang"
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -86,6 +86,6 @@
|
||||
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
|
||||
#endif
|
||||
|
||||
#if !(__GNUC_PREREQ(4, 4) || defined(__clang__))
|
||||
# error "Libvirt requires GCC >= 4.4, or CLang"
|
||||
#if !(__GNUC_PREREQ(4, 8) || defined(__clang__))
|
||||
# error "Libvirt requires GCC >= 4.8, or CLang"
|
||||
#endif
|
||||
|
@ -68,61 +68,8 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
|
||||
# Source: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
|
||||
dontwarn="$dontwarn -Wdisabled-optimization"
|
||||
|
||||
# gcc 4.2 treats attribute(format) as an implicit attribute(nonnull),
|
||||
# which triggers spurious warnings for our usage
|
||||
AC_CACHE_CHECK([whether the C compiler's -Wformat allows NULL strings],
|
||||
[lv_cv_gcc_wformat_null_works], [
|
||||
save_CFLAGS=$CFLAGS
|
||||
CFLAGS='-Wunknown-pragmas -Werror -Wformat'
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
#include <stddef.h>
|
||||
static __attribute__ ((__format__ (__printf__, 1, 2))) int
|
||||
foo (const char *fmt, ...) { return !fmt; }
|
||||
]], [[
|
||||
return foo(NULL);
|
||||
]])],
|
||||
[lv_cv_gcc_wformat_null_works=yes],
|
||||
[lv_cv_gcc_wformat_null_works=no])
|
||||
CFLAGS=$save_CFLAGS])
|
||||
|
||||
# Gnulib uses '#pragma GCC diagnostic push' to silence some
|
||||
# warnings, but older gcc doesn't support this.
|
||||
AC_CACHE_CHECK([whether pragma GCC diagnostic push works],
|
||||
[lv_cv_gcc_pragma_push_works], [
|
||||
save_CFLAGS=$CFLAGS
|
||||
CFLAGS='-Wunknown-pragmas -Werror'
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic pop
|
||||
]])],
|
||||
[lv_cv_gcc_pragma_push_works=yes],
|
||||
[lv_cv_gcc_pragma_push_works=no])
|
||||
CFLAGS=$save_CFLAGS])
|
||||
if test $lv_cv_gcc_pragma_push_works = no; then
|
||||
dontwarn="$dontwarn -Wmissing-prototypes"
|
||||
dontwarn="$dontwarn -Wmissing-declarations"
|
||||
dontwarn="$dontwarn -Wcast-align"
|
||||
else
|
||||
AC_DEFINE_UNQUOTED([WORKING_PRAGMA_PUSH], 1,
|
||||
[Define to 1 if gcc supports pragma push/pop])
|
||||
fi
|
||||
|
||||
dnl Check whether strchr(s, char variable) causes a bogus compile
|
||||
dnl warning, which is the case with GCC < 4.6 on some glibc
|
||||
AC_CACHE_CHECK([whether the C compiler's -Wlogical-op gives bogus warnings],
|
||||
[lv_cv_gcc_wlogical_op_broken], [
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="-O2 -Wlogical-op -Werror"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
#include <string.h>
|
||||
]], [[
|
||||
const char *haystack;
|
||||
char needle;
|
||||
return strchr(haystack, needle) == haystack;]])],
|
||||
[lv_cv_gcc_wlogical_op_broken=no],
|
||||
[lv_cv_gcc_wlogical_op_broken=yes])
|
||||
CFLAGS="$save_CFLAGS"])
|
||||
|
||||
# Broken in 6.0 and later
|
||||
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69602
|
||||
AC_CACHE_CHECK([whether gcc gives bogus warnings for -Wlogical-op],
|
||||
[lv_cv_gcc_wlogical_op_equal_expr_broken], [
|
||||
save_CFLAGS="$CFLAGS"
|
||||
@ -188,14 +135,8 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
|
||||
wantwarn="$wantwarn -Wswitch-enum"
|
||||
|
||||
# GNULIB turns on -Wformat=2 which implies -Wformat-nonliteral,
|
||||
# so we need to manually re-exclude it. Also, older gcc 4.2
|
||||
# added an implied ATTRIBUTE_NONNULL on any parameter marked
|
||||
# ATTRIBUTE_FMT_PRINT, which causes -Wformat failure on our
|
||||
# intentional use of virReportError(code, NULL).
|
||||
# so we need to manually re-exclude it.
|
||||
wantwarn="$wantwarn -Wno-format-nonliteral"
|
||||
if test $lv_cv_gcc_wformat_null_works = no; then
|
||||
wantwarn="$wantwarn -Wno-format"
|
||||
fi
|
||||
|
||||
# -Wformat enables this by default, and we should keep it,
|
||||
# but need to rewrite various areas of code first
|
||||
@ -283,12 +224,6 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
|
||||
#endif
|
||||
])
|
||||
|
||||
if test "$gl_cv_warn_c__Wlogical_op" = yes &&
|
||||
test "$lv_cv_gcc_wlogical_op_broken" = yes; then
|
||||
AC_DEFINE_UNQUOTED([BROKEN_GCC_WLOGICALOP_STRCHR], 1,
|
||||
[Define to 1 if gcc -Wlogical-op reports false positives on strchr])
|
||||
fi
|
||||
|
||||
if test "$gl_cv_warn_c__Wlogical_op" = yes &&
|
||||
test "$lv_cv_gcc_wlogical_op_equal_expr_broken" = yes; then
|
||||
AC_DEFINE_UNQUOTED([BROKEN_GCC_WLOGICALOP_EQUAL_EXPR], 1,
|
||||
|
@ -185,54 +185,36 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if WORKING_PRAGMA_PUSH
|
||||
# define VIR_WARNINGS_NO_CAST_ALIGN \
|
||||
#define VIR_WARNINGS_NO_CAST_ALIGN \
|
||||
_Pragma ("GCC diagnostic push") \
|
||||
_Pragma ("GCC diagnostic ignored \"-Wcast-align\"")
|
||||
|
||||
# define VIR_WARNINGS_NO_DEPRECATED \
|
||||
#define VIR_WARNINGS_NO_DEPRECATED \
|
||||
_Pragma ("GCC diagnostic push") \
|
||||
_Pragma ("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
|
||||
|
||||
# if HAVE_SUGGEST_ATTRIBUTE_FORMAT
|
||||
# define VIR_WARNINGS_NO_PRINTF \
|
||||
#if HAVE_SUGGEST_ATTRIBUTE_FORMAT
|
||||
# define VIR_WARNINGS_NO_PRINTF \
|
||||
_Pragma ("GCC diagnostic push") \
|
||||
_Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=format\"")
|
||||
# else
|
||||
# define VIR_WARNINGS_NO_PRINTF \
|
||||
#else
|
||||
# define VIR_WARNINGS_NO_PRINTF \
|
||||
_Pragma ("GCC diagnostic push")
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Workaround bogus GCC 6.0 for logical 'or' equal expression warnings.
|
||||
* (GCC bz 69602) */
|
||||
# if BROKEN_GCC_WLOGICALOP_EQUAL_EXPR
|
||||
# define VIR_WARNINGS_NO_WLOGICALOP_EQUAL_EXPR \
|
||||
#if BROKEN_GCC_WLOGICALOP_EQUAL_EXPR
|
||||
# define VIR_WARNINGS_NO_WLOGICALOP_EQUAL_EXPR \
|
||||
_Pragma ("GCC diagnostic push") \
|
||||
_Pragma ("GCC diagnostic ignored \"-Wlogical-op\"")
|
||||
# else
|
||||
# define VIR_WARNINGS_NO_WLOGICALOP_EQUAL_EXPR \
|
||||
#else
|
||||
# define VIR_WARNINGS_NO_WLOGICALOP_EQUAL_EXPR \
|
||||
_Pragma ("GCC diagnostic push")
|
||||
# endif
|
||||
#endif
|
||||
|
||||
# define VIR_WARNINGS_RESET \
|
||||
#define VIR_WARNINGS_RESET \
|
||||
_Pragma ("GCC diagnostic pop")
|
||||
#else
|
||||
# define VIR_WARNINGS_NO_CAST_ALIGN
|
||||
# define VIR_WARNINGS_NO_DEPRECATED
|
||||
# define VIR_WARNINGS_NO_PRINTF
|
||||
# define VIR_WARNINGS_NO_WLOGICALOP_EQUAL_EXPR
|
||||
# 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,9 +421,6 @@ virBufferVasprintf(virBufferPtr buf, const char *format, va_list argptr)
|
||||
}
|
||||
|
||||
|
||||
VIR_WARNINGS_NO_WLOGICALOP_STRCHR
|
||||
|
||||
|
||||
/**
|
||||
* virBufferEscapeString:
|
||||
* @buf: the buffer to append to
|
||||
|
@ -1350,9 +1350,6 @@ virStringHasControlChars(const char *str)
|
||||
}
|
||||
|
||||
|
||||
VIR_WARNINGS_NO_WLOGICALOP_STRCHR
|
||||
|
||||
|
||||
/**
|
||||
* virStringStripControlChars:
|
||||
* @str: the string to strip
|
||||
|
@ -478,10 +478,6 @@ virSysinfoReadARM(void)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VIR_WARNINGS_NO_WLOGICALOP_STRCHR
|
||||
|
||||
static char *
|
||||
virSysinfoParseS390Delimited(const char *base, const char *name, char **value,
|
||||
char delim1, char delim2)
|
||||
|
Loading…
Reference in New Issue
Block a user