Skip to content

Commit

Permalink
Bug 1834955 - Upgrade minimum supported Clang-cl version to 9. r=fire…
Browse files Browse the repository at this point in the history
…fox-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
  • Loading branch information
glandium committed May 29, 2023
1 parent 023322c commit fd126d1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions build/moz.configure/toolchain.configure
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
34 changes: 17 additions & 17 deletions python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ def VS(version):
+ 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
Expand Down Expand Up @@ -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,
Expand All @@ -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",
Expand Down Expand Up @@ -1032,8 +1032,8 @@ def test_clang_cl(self):
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,
},
)

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -1149,8 +1149,8 @@ def test_clang_cl(self):
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,
},
)

Expand Down Expand Up @@ -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,
},
Expand Down

0 comments on commit fd126d1

Please sign in to comment.