[PATCH] configure: Bump minimum Clang version to 10.0

Thomas Huth posted 1 patch 1 year, 2 months ago
configure | 25 ++++++-------------------
1 file changed, 6 insertions(+), 19 deletions(-)
[PATCH] configure: Bump minimum Clang version to 10.0
Posted by Thomas Huth 1 year, 2 months ago
Anthony Perard recently reported some problems with Clang v6.0 from
Ubuntu Bionic (with regards to the -Wmissing-braces configure test).
Since we're not officially supporting that version of Ubuntu anymore,
we should better bump our minimum version check in the configure script
instead of using our time to fix problems of unsupported compilers.
According to repology.org, our supported distros ship these versions
of Clang (looking at the highest version only):

              Fedora 36: 14.0.5
      CentOS 8 (RHEL-8): 12.0.1
              Debian 11: 13.0.1
     OpenSUSE Leap 15.4: 13.0.1
       Ubuntu LTS 20.04: 12.0.0
          FreeBSD Ports: 15.0.7
          NetBSD pkgsrc: 15.0.7
               Homebrew: 15.0.7
            MSYS2 mingw: 15.0.7
            Haiku ports: 12.0.1

While it seems like we could update to v12.0.0 from that point of view,
the default version on Ubuntu 20.04 is still v10.0, and we use that for
our CI tests based via the tests/docker/dockerfiles/ubuntu2004.docker
file.

Thus let's make v10.0 our minimum version now (which corresponds to
Apple Clang version v12.0). The -Wmissing-braces check can then be
removed, too, since both our minimum GCC and our minimum Clang version
now handle this correctly.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 configure | 25 ++++++-------------------
 1 file changed, 6 insertions(+), 19 deletions(-)

diff --git a/configure b/configure
index 9e407ce2e3..17732736ca 100755
--- a/configure
+++ b/configure
@@ -1018,7 +1018,7 @@ cat << EOF
   debug-tcg       TCG debugging (default is disabled)
   debug-info      debugging information
   safe-stack      SafeStack Stack Smash Protection. Depends on
-                  clang/llvm >= 3.7 and requires coroutine backend ucontext.
+                  clang/llvm and requires coroutine backend ucontext.
 
 NOTE: The object files are built at the place where configure is launched
 EOF
@@ -1138,12 +1138,12 @@ fi
 cat > $TMPC << EOF
 #if defined(__clang_major__) && defined(__clang_minor__)
 # ifdef __apple_build_version__
-#  if __clang_major__ < 10 || (__clang_major__ == 10 && __clang_minor__ < 0)
-#   error You need at least XCode Clang v10.0 to compile QEMU
+#  if __clang_major__ < 12 || (__clang_major__ == 12 && __clang_minor__ < 0)
+#   error You need at least XCode Clang v12.0 to compile QEMU
 #  endif
 # else
-#  if __clang_major__ < 6 || (__clang_major__ == 6 && __clang_minor__ < 0)
-#   error You need at least Clang v6.0 to compile QEMU
+#  if __clang_major__ < 10 || (__clang_major__ == 10 && __clang_minor__ < 0)
+#   error You need at least Clang v10.0 to compile QEMU
 #  endif
 # endif
 #elif defined(__GNUC__) && defined(__GNUC_MINOR__)
@@ -1156,7 +1156,7 @@ cat > $TMPC << EOF
 int main (void) { return 0; }
 EOF
 if ! compile_prog "" "" ; then
-    error_exit "You need at least GCC v7.4 or Clang v6.0 (or XCode Clang v10.0)"
+    error_exit "You need at least GCC v7.4 or Clang v10.0 (or XCode Clang v12.0)"
 fi
 
 # Accumulate -Wfoo and -Wno-bar separately.
@@ -1261,19 +1261,6 @@ EOF
   fi
 fi
 
-# Disable -Wmissing-braces on older compilers that warn even for
-# the "universal" C zero initializer {0}.
-cat > $TMPC << EOF
-struct {
-  int a[2];
-} x = {0};
-EOF
-if compile_object "-Werror" "" ; then
-  :
-else
-  QEMU_CFLAGS="$QEMU_CFLAGS -Wno-missing-braces"
-fi
-
 # Our module code doesn't support Windows
 if test "$modules" = "yes" && test "$mingw32" = "yes" ; then
   error_exit "Modules are not available for Windows"
-- 
2.31.1
Re: [PATCH] configure: Bump minimum Clang version to 10.0
Posted by Alex Bennée 1 year, 2 months ago
Thomas Huth <thuth@redhat.com> writes:

> Anthony Perard recently reported some problems with Clang v6.0 from
> Ubuntu Bionic (with regards to the -Wmissing-braces configure test).
> Since we're not officially supporting that version of Ubuntu anymore,
> we should better bump our minimum version check in the configure script
> instead of using our time to fix problems of unsupported compilers.
> According to repology.org, our supported distros ship these versions
> of Clang (looking at the highest version only):
>
>               Fedora 36: 14.0.5
>       CentOS 8 (RHEL-8): 12.0.1
>               Debian 11: 13.0.1
>      OpenSUSE Leap 15.4: 13.0.1
>        Ubuntu LTS 20.04: 12.0.0
>           FreeBSD Ports: 15.0.7
>           NetBSD pkgsrc: 15.0.7
>                Homebrew: 15.0.7
>             MSYS2 mingw: 15.0.7
>             Haiku ports: 12.0.1
>
> While it seems like we could update to v12.0.0 from that point of view,
> the default version on Ubuntu 20.04 is still v10.0, and we use that for
> our CI tests based via the tests/docker/dockerfiles/ubuntu2004.docker
> file.
>
> Thus let's make v10.0 our minimum version now (which corresponds to
> Apple Clang version v12.0). The -Wmissing-braces check can then be
> removed, too, since both our minimum GCC and our minimum Clang version
> now handle this correctly.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro
Re: [PATCH] configure: Bump minimum Clang version to 10.0
Posted by Richard Henderson 1 year, 2 months ago
On 1/31/23 08:02, Thomas Huth wrote:
> Anthony Perard recently reported some problems with Clang v6.0 from
> Ubuntu Bionic (with regards to the -Wmissing-braces configure test).
> Since we're not officially supporting that version of Ubuntu anymore,
> we should better bump our minimum version check in the configure script
> instead of using our time to fix problems of unsupported compilers.
> According to repology.org, our supported distros ship these versions
> of Clang (looking at the highest version only):
> 
>                Fedora 36: 14.0.5
>        CentOS 8 (RHEL-8): 12.0.1
>                Debian 11: 13.0.1
>       OpenSUSE Leap 15.4: 13.0.1
>         Ubuntu LTS 20.04: 12.0.0
>            FreeBSD Ports: 15.0.7
>            NetBSD pkgsrc: 15.0.7
>                 Homebrew: 15.0.7
>              MSYS2 mingw: 15.0.7
>              Haiku ports: 12.0.1
> 
> While it seems like we could update to v12.0.0 from that point of view,
> the default version on Ubuntu 20.04 is still v10.0, and we use that for
> our CI tests based via the tests/docker/dockerfiles/ubuntu2004.docker
> file.
> 
> Thus let's make v10.0 our minimum version now (which corresponds to
> Apple Clang version v12.0). The -Wmissing-braces check can then be
> removed, too, since both our minimum GCC and our minimum Clang version
> now handle this correctly.
> 
> Signed-off-by: Thomas Huth<thuth@redhat.com>
> ---
>   configure | 25 ++++++-------------------
>   1 file changed, 6 insertions(+), 19 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~