Bug 1373562 part 3 - Add compiler argument -fallback for clang-cl. r?glandium
Add the flag because current trunk clang-cl crashes when compile
Firefox. Also raise error only when check_compiler returns new flags
from the second invocation.
MozReview-Commit-ID: AIjeCQwuFqk
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -377,21 +377,22 @@ def check_compiler(compiler, language, t
if info.language == 'C++':
if info.type in ('clang', 'gcc') and info.language_version != 201103:
append_flag('-std=gnu++11')
# MSVC 2015 headers include C++14 features, but don't guard them
# with appropriate checks.
if info.type == 'clang-cl' and info.language_version != 201402:
append_flag('-std=c++14')
- # We force clang-cl to emulate Visual C++ 2015 Update 3.
- if info.type == 'clang-cl' and info.version != '19.00.24213':
- # This flag is a direct clang-cl flag that doesn't need -Xclang,
- # add it directly.
- flags.append('-fms-compatibility-version=19.00.24213')
+ if info.type == 'clang-cl':
+ # Direct clang-cl flags don't need -Xclang, add them directly.
+ flags.append('-fallback')
+ # We force clang-cl to emulate Visual C++ 2015 Update 3.
+ if info.version != '19.00.24213':
+ flags.append('-fms-compatibility-version=19.00.24213')
# Check compiler target
# --------------------------------------------------------------------
if not info.cpu or info.cpu != target.cpu:
if info.type == 'clang':
append_flag('--target=%s' % target.toolchain)
elif info.type == 'gcc':
same_arch_different_bits = (
@@ -727,17 +728,17 @@ def compiler(language, host_or_target, c
host_or_target.endianness):
raise FatalCheckError(
'%s %s compiler target endianness (%s) does not match --%s '
'endianness (%s)'
% (host_or_target_str.capitalize(), language,
info.target_endianness or 'unknown', host_or_target_str,
host_or_target.endianness))
- if info.flags:
+ if any(flag not in flags for flag in info.flags):
raise FatalCheckError(
'Unknown compiler or compiler not supported.')
# Compiler version checks
# ===================================================
# Check the compiler version here instead of in `compiler_version` so
# that the `checking` message doesn't pretend the compiler can be used
# to then bail out one line later.
--- a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
+++ b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
@@ -875,25 +875,25 @@ class WindowsToolchainTest(BaseToolchain
VSXX_2015u3_RESULT = CompilerResult(
flags=[],
version='19.00.24213',
type='msvc',
compiler='/usr/bin/cl',
language='C++',
)
CLANG_CL_3_9_RESULT = CompilerResult(
- flags=['-Xclang', '-std=gnu99',
+ flags=['-Xclang', '-std=gnu99', '-fallback',
'-fms-compatibility-version=19.00.24213'],
version='19.00.24213',
type='clang-cl',
compiler='/usr/bin/clang-cl',
language='C',
)
CLANGXX_CL_3_9_RESULT = CompilerResult(
- flags=['-Xclang', '-std=c++14',
+ flags=['-Xclang', '-std=c++14', '-fallback',
'-fms-compatibility-version=19.00.24213'],
version='19.00.24213',
type='clang-cl',
compiler='/usr/bin/clang-cl',
language='C++',
)
CLANG_3_3_RESULT = LinuxToolchainTest.CLANG_3_3_RESULT
CLANGXX_3_3_RESULT = LinuxToolchainTest.CLANGXX_3_3_RESULT