From fd126d15a56f4f148ff5fa0246ccc580137f0770 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Mon, 29 May 2023 20:31:08 +0000 Subject: [PATCH] Bug 1834955 - Upgrade minimum supported Clang-cl version to 9. r=firefox-build-system-reviewers,sergesanspaille We have less constraints on the minimum supported clang-cl version, and it would unlock C++17 inline variables (which had a bug on Windows targets in clang up-to 8.x). Differential Revision: https://phabricator.services.mozilla.com/D179037 --- build/moz.configure/toolchain.configure | 4 +-- .../using_cxx_in_firefox_code.rst | 2 +- .../configure/test_toolchain_configure.py | 34 +++++++++---------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure index 4d0fc3f1e8e6..0f4c228454ec 100644 --- a/build/moz.configure/toolchain.configure +++ b/build/moz.configure/toolchain.configure @@ -1379,9 +1379,9 @@ def compiler( flags.extend(("-isystem", os.path.join(sysroot.path, path))) if info.type == "clang-cl": - if info.version < "8.0.0": + if info.version < "9.0.0": raise FatalCheckError( - "Only clang-cl 8.0 or newer is supported (found version %s)" + "Only clang-cl 9.0 or newer is supported (found version %s)" % info.version ) if winsysroot and host.os != "WINNT": diff --git a/docs/code-quality/coding-style/using_cxx_in_firefox_code.rst b/docs/code-quality/coding-style/using_cxx_in_firefox_code.rst index a5f1f5515bec..eb14cdf091f4 100644 --- a/docs/code-quality/coding-style/using_cxx_in_firefox_code.rst +++ b/docs/code-quality/coding-style/using_cxx_in_firefox_code.rst @@ -249,7 +249,7 @@ list of acceptable features is given below: * - Inline variables (C++17) - 7.0 - 3.9 - - **No** (clang 5 has bugs with inline variables) + - Yes * - constexpr_if (C++17) - 7.0 - 3.9 diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py index e8a975a8ab4e..f130245d46e6 100644 --- a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py +++ b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py @@ -249,8 +249,8 @@ CLANG_CL_3_9 = ( + SUPPORTS_GNUXX11 + SUPPORTS_CXX14 ) + {"*.cpp": {"__STDC_VERSION__": False, "__cplusplus": "201103L"}} -CLANG_CL_8_0 = ( - CLANG_BASE("8.0.0") +CLANG_CL_9_0 = ( + CLANG_BASE("9.0.0") + VS("18.00.00000") + DEFAULT_C11 + SUPPORTS_GNU99 @@ -966,7 +966,7 @@ class MingwToolchainTest(BaseToolchainTest): PATHS = { "/usr/bin/cl": VS_2017u8 + VS_PLATFORM_X86, "/usr/bin/clang-cl-3.9": CLANG_CL_3_9 + CLANG_CL_PLATFORM_X86, - "/usr/bin/clang-cl": CLANG_CL_8_0 + CLANG_CL_PLATFORM_X86, + "/usr/bin/clang-cl": CLANG_CL_9_0 + CLANG_CL_PLATFORM_X86, "/usr/bin/gcc": DEFAULT_GCC + GCC_PLATFORM_X86_WIN + MINGW32, "/usr/bin/g++": DEFAULT_GXX + GCC_PLATFORM_X86_WIN + MINGW32, "/usr/bin/gcc-4.9": GCC_4_9 + GCC_PLATFORM_X86_WIN + MINGW32, @@ -988,20 +988,20 @@ class MingwToolchainTest(BaseToolchainTest): } CLANG_CL_3_9_RESULT = ( - "Only clang-cl 8.0 or newer is supported (found version 3.9.0)" + "Only clang-cl 9.0 or newer is supported (found version 3.9.0)" ) - CLANG_CL_8_0_RESULT = CompilerResult( - version="8.0.0", + CLANG_CL_9_0_RESULT = CompilerResult( + version="9.0.0", flags=["-Xclang", "-std=gnu99"], type="clang-cl", compiler="/usr/bin/clang-cl", language="C", ) CLANGXX_CL_3_9_RESULT = ( - "Only clang-cl 8.0 or newer is supported (found version 3.9.0)" + "Only clang-cl 9.0 or newer is supported (found version 3.9.0)" ) - CLANGXX_CL_8_0_RESULT = CompilerResult( - version="8.0.0", + CLANGXX_CL_9_0_RESULT = CompilerResult( + version="9.0.0", flags=["-Xclang", "-std=c++17"], type="clang-cl", compiler="/usr/bin/clang-cl", @@ -1032,8 +1032,8 @@ class MingwToolchainTest(BaseToolchainTest): self.do_toolchain_test( self.PATHS, { - "c_compiler": self.CLANG_CL_8_0_RESULT, - "cxx_compiler": self.CLANGXX_CL_8_0_RESULT, + "c_compiler": self.CLANG_CL_9_0_RESULT, + "cxx_compiler": self.CLANGXX_CL_9_0_RESULT, }, ) @@ -1103,7 +1103,7 @@ class Mingw64ToolchainTest(MingwToolchainTest): # real Windows paths. PATHS = { "/usr/bin/cl": VS_2017u8 + VS_PLATFORM_X86_64, - "/usr/bin/clang-cl": CLANG_CL_8_0 + CLANG_CL_PLATFORM_X86_64, + "/usr/bin/clang-cl": CLANG_CL_9_0 + CLANG_CL_PLATFORM_X86_64, "/usr/bin/clang-cl-3.9": CLANG_CL_3_9 + CLANG_CL_PLATFORM_X86_64, "/usr/bin/gcc": DEFAULT_GCC + GCC_PLATFORM_X86_64_WIN + MINGW32, "/usr/bin/g++": DEFAULT_GXX + GCC_PLATFORM_X86_64_WIN + MINGW32, @@ -1149,8 +1149,8 @@ class WindowsToolchainTest(BaseToolchainTest): self.do_toolchain_test( self.PATHS, { - "c_compiler": MingwToolchainTest.CLANG_CL_8_0_RESULT, - "cxx_compiler": MingwToolchainTest.CLANGXX_CL_8_0_RESULT, + "c_compiler": MingwToolchainTest.CLANG_CL_9_0_RESULT, + "cxx_compiler": MingwToolchainTest.CLANGXX_CL_9_0_RESULT, }, ) @@ -1626,13 +1626,13 @@ class WindowsCrossToolchainTest(BaseToolchainTest): DEFAULT_CLANGXX_RESULT = LinuxToolchainTest.DEFAULT_CLANGXX_RESULT def test_clang_cl_cross(self): - paths = {"/usr/bin/clang-cl": CLANG_CL_8_0 + CLANG_CL_PLATFORM_X86_64} + paths = {"/usr/bin/clang-cl": CLANG_CL_9_0 + CLANG_CL_PLATFORM_X86_64} paths.update(LinuxToolchainTest.PATHS) self.do_toolchain_test( paths, { - "c_compiler": MingwToolchainTest.CLANG_CL_8_0_RESULT, - "cxx_compiler": MingwToolchainTest.CLANGXX_CL_8_0_RESULT, + "c_compiler": MingwToolchainTest.CLANG_CL_9_0_RESULT, + "cxx_compiler": MingwToolchainTest.CLANGXX_CL_9_0_RESULT, "host_c_compiler": self.DEFAULT_CLANG_RESULT, "host_cxx_compiler": self.DEFAULT_CLANGXX_RESULT, },