зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1557547 - Actively reject clang < 4.0 during configure. r=mshal
Bug 1394825 bumped the minimum version of clang we use on automation, for the base toolchain jobs, and there's a libclang test for bindgen, but we should reject the compiler in the first place. The check to do that works in both C and C++, contrary to the original 3.6 test that was checking a C++ feature ; the test was later changed for 3.9, using a check that would have worked in both C and C++, but the C exception was left around. We remove it now. Differential Revision: https://phabricator.services.mozilla.com/D34083 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
953869800a
Коммит
44e96352da
|
@ -395,10 +395,10 @@ def get_compiler_info(compiler, language):
|
||||||
# in Xcode have a completely different versioning scheme despite exposing
|
# in Xcode have a completely different versioning scheme despite exposing
|
||||||
# the version with the same defines.
|
# the version with the same defines.
|
||||||
# So instead, we make things such that the version is missing when the
|
# So instead, we make things such that the version is missing when the
|
||||||
# clang used is below the minimum supported version (currently clang 3.9).
|
# clang used is below the minimum supported version (currently clang 4.0).
|
||||||
# We then only include the version information when the C++ compiler
|
# We then only include the version information when the compiler matches
|
||||||
# matches the feature check, so that an unsupported version of clang would
|
# the feature check, so that an unsupported version of clang would have
|
||||||
# have no version number.
|
# no version number.
|
||||||
check = dedent('''\
|
check = dedent('''\
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#if defined(__clang__)
|
#if defined(__clang__)
|
||||||
|
@ -407,7 +407,7 @@ def get_compiler_info(compiler, language):
|
||||||
#endif
|
#endif
|
||||||
#elif defined(__clang__)
|
#elif defined(__clang__)
|
||||||
%COMPILER "clang"
|
%COMPILER "clang"
|
||||||
# if !__cplusplus || __has_builtin(__builtin_bitreverse8)
|
# if __has_attribute(diagnose_if)
|
||||||
%VERSION __clang_major__.__clang_minor__.__clang_patchlevel__
|
%VERSION __clang_major__.__clang_minor__.__clang_patchlevel__
|
||||||
# endif
|
# endif
|
||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
|
@ -1037,10 +1037,10 @@ def compiler(language, host_or_target, c_compiler=None, other_compiler=None,
|
||||||
% info.version)
|
% info.version)
|
||||||
|
|
||||||
# If you want to bump the version check here search for
|
# If you want to bump the version check here search for
|
||||||
# builtin_bitreverse8 above, and see the associated comment.
|
# diagnose_if above, and see the associated comment.
|
||||||
if info.type == 'clang' and not info.version:
|
if info.type == 'clang' and not info.version:
|
||||||
raise FatalCheckError(
|
raise FatalCheckError(
|
||||||
'Only clang/llvm 3.9 or newer is supported.')
|
'Only clang/llvm 4.0 or newer is supported.')
|
||||||
|
|
||||||
if info.flags:
|
if info.flags:
|
||||||
raise FatalCheckError(
|
raise FatalCheckError(
|
||||||
|
|
|
@ -190,17 +190,14 @@ def CLANGXX(version):
|
||||||
|
|
||||||
CLANG_3_3 = CLANG('3.3.0') + DEFAULT_C99
|
CLANG_3_3 = CLANG('3.3.0') + DEFAULT_C99
|
||||||
CLANGXX_3_3 = CLANGXX('3.3.0')
|
CLANGXX_3_3 = CLANGXX('3.3.0')
|
||||||
CLANG_3_6 = CLANG('3.6.2') + DEFAULT_C11
|
CLANG_4_0 = CLANG('4.0.2') + DEFAULT_C11 + {
|
||||||
CLANGXX_3_6 = CLANGXX('3.6.2') + {
|
'__has_attribute(diagnose_if)': '1',
|
||||||
'-std=gnu++11': {
|
|
||||||
'__has_builtin(__builtin_bitreverse8)': '1',
|
|
||||||
},
|
|
||||||
'-std=gnu++14': {
|
|
||||||
'__has_builtin(__builtin_bitreverse8)': '1',
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
DEFAULT_CLANG = CLANG_3_6
|
CLANGXX_4_0 = CLANGXX('4.0.2') + {
|
||||||
DEFAULT_CLANGXX = CLANGXX_3_6
|
'__has_attribute(diagnose_if)': '1',
|
||||||
|
}
|
||||||
|
DEFAULT_CLANG = CLANG_4_0
|
||||||
|
DEFAULT_CLANGXX = CLANGXX_4_0
|
||||||
|
|
||||||
|
|
||||||
def CLANG_PLATFORM(gcc_platform):
|
def CLANG_PLATFORM(gcc_platform):
|
||||||
|
@ -443,8 +440,8 @@ class LinuxToolchainTest(BaseToolchainTest):
|
||||||
'/usr/bin/g++-7': GXX_7 + GCC_PLATFORM_X86_64_LINUX,
|
'/usr/bin/g++-7': GXX_7 + GCC_PLATFORM_X86_64_LINUX,
|
||||||
'/usr/bin/clang': DEFAULT_CLANG + CLANG_PLATFORM_X86_64_LINUX,
|
'/usr/bin/clang': DEFAULT_CLANG + CLANG_PLATFORM_X86_64_LINUX,
|
||||||
'/usr/bin/clang++': DEFAULT_CLANGXX + CLANG_PLATFORM_X86_64_LINUX,
|
'/usr/bin/clang++': DEFAULT_CLANGXX + CLANG_PLATFORM_X86_64_LINUX,
|
||||||
'/usr/bin/clang-3.6': CLANG_3_6 + CLANG_PLATFORM_X86_64_LINUX,
|
'/usr/bin/clang-4.0': CLANG_4_0 + CLANG_PLATFORM_X86_64_LINUX,
|
||||||
'/usr/bin/clang++-3.6': CLANGXX_3_6 + CLANG_PLATFORM_X86_64_LINUX,
|
'/usr/bin/clang++-4.0': CLANGXX_4_0 + CLANG_PLATFORM_X86_64_LINUX,
|
||||||
'/usr/bin/clang-3.3': CLANG_3_3 + CLANG_PLATFORM_X86_64_LINUX,
|
'/usr/bin/clang-3.3': CLANG_3_3 + CLANG_PLATFORM_X86_64_LINUX,
|
||||||
'/usr/bin/clang++-3.3': CLANGXX_3_3 + CLANG_PLATFORM_X86_64_LINUX,
|
'/usr/bin/clang++-3.3': CLANGXX_3_3 + CLANG_PLATFORM_X86_64_LINUX,
|
||||||
}
|
}
|
||||||
|
@ -486,30 +483,24 @@ class LinuxToolchainTest(BaseToolchainTest):
|
||||||
DEFAULT_GCC_RESULT = GCC_6_RESULT + {'compiler': '/usr/bin/gcc'}
|
DEFAULT_GCC_RESULT = GCC_6_RESULT + {'compiler': '/usr/bin/gcc'}
|
||||||
DEFAULT_GXX_RESULT = GXX_6_RESULT + {'compiler': '/usr/bin/g++'}
|
DEFAULT_GXX_RESULT = GXX_6_RESULT + {'compiler': '/usr/bin/g++'}
|
||||||
|
|
||||||
CLANG_3_3_RESULT = CompilerResult(
|
CLANG_3_3_RESULT = 'Only clang/llvm 4.0 or newer is supported.'
|
||||||
flags=[],
|
CLANGXX_3_3_RESULT = 'Only clang/llvm 4.0 or newer is supported.'
|
||||||
version='3.3.0',
|
CLANG_4_0_RESULT = CompilerResult(
|
||||||
type='clang',
|
|
||||||
compiler='/usr/bin/clang-3.3',
|
|
||||||
language='C',
|
|
||||||
)
|
|
||||||
CLANGXX_3_3_RESULT = 'Only clang/llvm 3.9 or newer is supported.'
|
|
||||||
CLANG_3_6_RESULT = CompilerResult(
|
|
||||||
flags=['-std=gnu99'],
|
flags=['-std=gnu99'],
|
||||||
version='3.6.2',
|
version='4.0.2',
|
||||||
type='clang',
|
type='clang',
|
||||||
compiler='/usr/bin/clang-3.6',
|
compiler='/usr/bin/clang-4.0',
|
||||||
language='C',
|
language='C',
|
||||||
)
|
)
|
||||||
CLANGXX_3_6_RESULT = CompilerResult(
|
CLANGXX_4_0_RESULT = CompilerResult(
|
||||||
flags=['-std=gnu++14'],
|
flags=['-std=gnu++14'],
|
||||||
version='3.6.2',
|
version='4.0.2',
|
||||||
type='clang',
|
type='clang',
|
||||||
compiler='/usr/bin/clang++-3.6',
|
compiler='/usr/bin/clang++-4.0',
|
||||||
language='C++',
|
language='C++',
|
||||||
)
|
)
|
||||||
DEFAULT_CLANG_RESULT = CLANG_3_6_RESULT + {'compiler': '/usr/bin/clang'}
|
DEFAULT_CLANG_RESULT = CLANG_4_0_RESULT + {'compiler': '/usr/bin/clang'}
|
||||||
DEFAULT_CLANGXX_RESULT = CLANGXX_3_6_RESULT + {'compiler': '/usr/bin/clang++'}
|
DEFAULT_CLANGXX_RESULT = CLANGXX_4_0_RESULT + {'compiler': '/usr/bin/clang++'}
|
||||||
|
|
||||||
def test_default(self):
|
def test_default(self):
|
||||||
# We'll try clang and gcc, and find clang first.
|
# We'll try clang and gcc, and find clang first.
|
||||||
|
@ -638,10 +629,10 @@ class LinuxToolchainTest(BaseToolchainTest):
|
||||||
def test_guess_cxx_clang(self):
|
def test_guess_cxx_clang(self):
|
||||||
# When CXX is not set, we guess it from CC.
|
# When CXX is not set, we guess it from CC.
|
||||||
self.do_toolchain_test(self.PATHS, {
|
self.do_toolchain_test(self.PATHS, {
|
||||||
'c_compiler': self.CLANG_3_6_RESULT,
|
'c_compiler': self.CLANG_4_0_RESULT,
|
||||||
'cxx_compiler': self.CLANGXX_3_6_RESULT,
|
'cxx_compiler': self.CLANGXX_4_0_RESULT,
|
||||||
}, environ={
|
}, environ={
|
||||||
'CC': 'clang-3.6',
|
'CC': 'clang-4.0',
|
||||||
})
|
})
|
||||||
|
|
||||||
def test_unsupported_clang(self):
|
def test_unsupported_clang(self):
|
||||||
|
@ -814,8 +805,8 @@ class OSXToolchainTest(BaseToolchainTest):
|
||||||
'/usr/bin/g++-7': GXX_7 + GCC_PLATFORM_X86_64_OSX,
|
'/usr/bin/g++-7': GXX_7 + GCC_PLATFORM_X86_64_OSX,
|
||||||
'/usr/bin/clang': DEFAULT_CLANG + CLANG_PLATFORM_X86_64_OSX,
|
'/usr/bin/clang': DEFAULT_CLANG + CLANG_PLATFORM_X86_64_OSX,
|
||||||
'/usr/bin/clang++': DEFAULT_CLANGXX + CLANG_PLATFORM_X86_64_OSX,
|
'/usr/bin/clang++': DEFAULT_CLANGXX + CLANG_PLATFORM_X86_64_OSX,
|
||||||
'/usr/bin/clang-3.6': CLANG_3_6 + CLANG_PLATFORM_X86_64_OSX,
|
'/usr/bin/clang-4.0': CLANG_4_0 + CLANG_PLATFORM_X86_64_OSX,
|
||||||
'/usr/bin/clang++-3.6': CLANGXX_3_6 + CLANG_PLATFORM_X86_64_OSX,
|
'/usr/bin/clang++-4.0': CLANGXX_4_0 + CLANG_PLATFORM_X86_64_OSX,
|
||||||
'/usr/bin/clang-3.3': CLANG_3_3 + CLANG_PLATFORM_X86_64_OSX,
|
'/usr/bin/clang-3.3': CLANG_3_3 + CLANG_PLATFORM_X86_64_OSX,
|
||||||
'/usr/bin/clang++-3.3': CLANGXX_3_3 + CLANG_PLATFORM_X86_64_OSX,
|
'/usr/bin/clang++-3.3': CLANGXX_3_3 + CLANG_PLATFORM_X86_64_OSX,
|
||||||
}
|
}
|
||||||
|
@ -893,8 +884,8 @@ class WindowsToolchainTest(BaseToolchainTest):
|
||||||
'/usr/bin/g++-6': GXX_6 + GCC_PLATFORM_X86_WIN,
|
'/usr/bin/g++-6': GXX_6 + GCC_PLATFORM_X86_WIN,
|
||||||
'/usr/bin/clang': DEFAULT_CLANG + CLANG_PLATFORM_X86_WIN,
|
'/usr/bin/clang': DEFAULT_CLANG + CLANG_PLATFORM_X86_WIN,
|
||||||
'/usr/bin/clang++': DEFAULT_CLANGXX + CLANG_PLATFORM_X86_WIN,
|
'/usr/bin/clang++': DEFAULT_CLANGXX + CLANG_PLATFORM_X86_WIN,
|
||||||
'/usr/bin/clang-3.6': CLANG_3_6 + CLANG_PLATFORM_X86_WIN,
|
'/usr/bin/clang-4.0': CLANG_4_0 + CLANG_PLATFORM_X86_WIN,
|
||||||
'/usr/bin/clang++-3.6': CLANGXX_3_6 + CLANG_PLATFORM_X86_WIN,
|
'/usr/bin/clang++-4.0': CLANGXX_4_0 + CLANG_PLATFORM_X86_WIN,
|
||||||
'/usr/bin/clang-3.3': CLANG_3_3 + CLANG_PLATFORM_X86_WIN,
|
'/usr/bin/clang-3.3': CLANG_3_3 + CLANG_PLATFORM_X86_WIN,
|
||||||
'/usr/bin/clang++-3.3': CLANGXX_3_3 + CLANG_PLATFORM_X86_WIN,
|
'/usr/bin/clang++-3.3': CLANGXX_3_3 + CLANG_PLATFORM_X86_WIN,
|
||||||
}
|
}
|
||||||
|
@ -1010,8 +1001,8 @@ class Windows64ToolchainTest(WindowsToolchainTest):
|
||||||
'/usr/bin/g++-7': GXX_7 + GCC_PLATFORM_X86_64_WIN,
|
'/usr/bin/g++-7': GXX_7 + GCC_PLATFORM_X86_64_WIN,
|
||||||
'/usr/bin/clang': DEFAULT_CLANG + CLANG_PLATFORM_X86_64_WIN,
|
'/usr/bin/clang': DEFAULT_CLANG + CLANG_PLATFORM_X86_64_WIN,
|
||||||
'/usr/bin/clang++': DEFAULT_CLANGXX + CLANG_PLATFORM_X86_64_WIN,
|
'/usr/bin/clang++': DEFAULT_CLANGXX + CLANG_PLATFORM_X86_64_WIN,
|
||||||
'/usr/bin/clang-3.6': CLANG_3_6 + CLANG_PLATFORM_X86_64_WIN,
|
'/usr/bin/clang-4.0': CLANG_4_0 + CLANG_PLATFORM_X86_64_WIN,
|
||||||
'/usr/bin/clang++-3.6': CLANGXX_3_6 + CLANG_PLATFORM_X86_64_WIN,
|
'/usr/bin/clang++-4.0': CLANGXX_4_0 + CLANG_PLATFORM_X86_64_WIN,
|
||||||
'/usr/bin/clang-3.3': CLANG_3_3 + CLANG_PLATFORM_X86_64_WIN,
|
'/usr/bin/clang-3.3': CLANG_3_3 + CLANG_PLATFORM_X86_64_WIN,
|
||||||
'/usr/bin/clang++-3.3': CLANGXX_3_3 + CLANG_PLATFORM_X86_64_WIN,
|
'/usr/bin/clang++-3.3': CLANGXX_3_3 + CLANG_PLATFORM_X86_64_WIN,
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ class CompilerPreprocessor(Preprocessor):
|
||||||
# simple "FOO" case.
|
# simple "FOO" case.
|
||||||
VARSUBST = re.compile('(?<!")(?P<VAR>\w+)(?!")', re.U)
|
VARSUBST = re.compile('(?<!")(?P<VAR>\w+)(?!")', re.U)
|
||||||
NON_WHITESPACE = re.compile('\S')
|
NON_WHITESPACE = re.compile('\S')
|
||||||
HAS_FEATURE_OR_BUILTIN = re.compile('(__has_(feature|builtin))\(([^\)]*)\)')
|
HAS_FEATURE_OR_BUILTIN = re.compile('(__has_(feature|builtin|attribute))\(([^\)]*)\)')
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
Preprocessor.__init__(self, *args, **kwargs)
|
Preprocessor.__init__(self, *args, **kwargs)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче