The previous bump to 4.4 was done in:
commit 24241c236e5e0b0b51a33ba539b40f5429a0df0e
Author: Daniel P. Berrange <berrange(a)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 distros are RHEL-7 (4.8.5) or Debian Jessie (4.9.2).
Thus we pick 4.8 as the new min.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
config-post.h | 6 ++--
m4/virt-compile-warnings.m4 | 71 ++-----------------------------------
src/internal.h | 44 +++++++----------------
src/util/virbuffer.c | 3 --
src/util/virstring.c | 3 --
src/util/virsysinfo.c | 4 ---
6 files changed, 19 insertions(+), 112 deletions(-)
diff --git a/config-post.h b/config-post.h
index 093f84a7ce..f928e19273 100644
--- a/config-post.h
+++ b/config-post.h
@@ -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
diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
index fc185aef38..f9460e82ba 100644
--- a/m4/virt-compile-warnings.m4
+++ b/m4/virt-compile-warnings.m4
@@ -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,
diff --git a/src/internal.h b/src/internal.h
index f718895460..adc1e3f496 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -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 \
- _Pragma ("GCC diagnostic push")
-# endif
-
-# 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
+# define VIR_WARNINGS_NO_WLOGICALOP_EQUAL_EXPR \
+ _Pragma ("GCC diagnostic push")
#endif
+#define VIR_WARNINGS_RESET \
+ _Pragma ("GCC diagnostic pop")
/*
* Use this when passing possibly-NULL strings to printf-a-likes.
diff --git a/src/util/virbuffer.c b/src/util/virbuffer.c
index ac03b15a61..12b33f8bd6 100644
--- a/src/util/virbuffer.c
+++ b/src/util/virbuffer.c
@@ -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
diff --git a/src/util/virstring.c b/src/util/virstring.c
index 95bd7d225e..bd269e98fe 100644
--- a/src/util/virstring.c
+++ b/src/util/virstring.c
@@ -1350,9 +1350,6 @@ virStringHasControlChars(const char *str)
}
-VIR_WARNINGS_NO_WLOGICALOP_STRCHR
-
-
/**
* virStringStripControlChars:
* @str: the string to strip
diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c
index 5be5e5133d..af26e0bab9 100644
--- a/src/util/virsysinfo.c
+++ b/src/util/virsysinfo.c
@@ -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)
--
2.21.0