]> xenbits.xensource.com Git - libvirt.git/commitdiff
build: bump min required gcc to 4.8
authorDaniel P. Berrangé <berrange@redhat.com>
Tue, 30 Jul 2019 13:07:24 +0000 (14:07 +0100)
committerDaniel P. Berrangé <berrange@redhat.com>
Wed, 7 Aug 2019 13:26:12 +0000 (14:26 +0100)
The previous bump to 4.4 was done in:

  commit 24241c236e5e0b0b51a33ba539b40f5429a0df0e
  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>
config-post.h
m4/virt-compile-warnings.m4
src/internal.h
src/util/virbuffer.c
src/util/virstring.c
src/util/virsysinfo.c

index 093f84a7ce2eccb8fc5433f7f5fce1cc78bc9ed7..f928e192730c834cdb52e590fc194f7bcdbcc22b 100644 (file)
@@ -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
index fc185aef3830d1413fac8dae6664896971e2556c..f9460e82ba9676bdbfe33fad15c1914b63226cc8 100644 (file)
@@ -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,
index f718895460ea6e0cd097a7c89342f3ae6a9d12a2..adc1e3f496a4ef4eb6c19277be7bb80d7cf63441 100644 (file)
 # 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.
index ac03b15a61a612623371c31ed9c27b4d1981491e..12b33f8bd64b9ec230748f57190cb1c4fc51bd68 100644 (file)
@@ -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
index 95bd7d225ecee37957d9b732248f00ee3c47809f..bd269e98fe0fb1b1b2d2dbafae425d0217573830 100644 (file)
@@ -1350,9 +1350,6 @@ virStringHasControlChars(const char *str)
 }
 
 
-VIR_WARNINGS_NO_WLOGICALOP_STRCHR
-
-
 /**
  * virStringStripControlChars:
  * @str: the string to strip
index 5be5e5133d71c0b0e68c6429dbe6edb55dfba21e..af26e0bab953d4425c104f014a54ddd49e652932 100644 (file)
@@ -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)