Bug 1286204 - Require at least clang 3.6. r?nfroyd
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -227,17 +227,17 @@ def get_compiler_info(compiler, language
%COMPILER clang-cl
%VERSION _MSC_FULL_VER
#else
%COMPILER msvc
%VERSION _MSC_FULL_VER
#endif
#elif defined(__clang__)
%COMPILER clang
- # if !__cplusplus || __cpp_static_assert
+ # if !__cplusplus || __has_feature(cxx_alignof)
%VERSION __clang_major__.__clang_minor__.__clang_patchlevel__
# endif
#elif defined(__GNUC__)
%COMPILER gcc
%VERSION __GNUC__.__GNUC_MINOR__.__GNUC_PATCHLEVEL__
#endif
#if __cplusplus
--- a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
+++ b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
@@ -97,17 +97,17 @@ def CLANGXX(version):
SUPPORTS_GNUXX11)
CLANG_3_3 = CLANG('3.3.0') + DEFAULT_C99
CLANGXX_3_3 = CLANGXX('3.3.0')
CLANG_3_6 = CLANG('3.6.2') + DEFAULT_C11
CLANGXX_3_6 = CLANGXX('3.6.2') + {
'-std=gnu++11': {
- '__cpp_static_assert': '200410',
+ '__has_feature(cxx_alignof)': '1',
},
}
@memoize
def VS(version):
version = Version(version)
return FakeCompiler({
--- a/python/mozbuild/mozbuild/test/configure/test_toolchain_helpers.py
+++ b/python/mozbuild/mozbuild/test/configure/test_toolchain_helpers.py
@@ -21,37 +21,44 @@ from mozunit import (
from mozbuild.preprocessor import Preprocessor
from mozbuild.util import ReadOnlyNamespace
from mozpack import path as mozpath
class CompilerPreprocessor(Preprocessor):
VARSUBST = re.compile('(?P<VAR>\w+)', re.U)
NON_WHITESPACE = re.compile('\S')
+ HAS_FEATURE = re.compile('(__has_feature)\(([^\)]*)\)')
def __init__(self, *args, **kwargs):
Preprocessor.__init__(self, *args, **kwargs)
self.do_filter('c_substitution')
self.setMarker('#\s*')
- def do_if(self, *args, **kwargs):
+ def do_if(self, expression, **kwargs):
# The C preprocessor handles numbers following C rules, which is a
# different handling than what our Preprocessor does out of the box.
# Hack around it enough that the configure tests work properly.
context = self.context
def normalize_numbers(value):
if isinstance(value, types.StringTypes):
if value[-1:] == 'L' and value[:-1].isdigit():
value = int(value[:-1])
return value
+ # Our Preprocessor doesn't handle macros with parameters, so we hack
+ # around that for __has_feature()-like things.
+ def normalize_has_feature(expr):
+ return self.HAS_FEATURE.sub(r'\1\2', expr)
self.context = self.Context(
- (k, normalize_numbers(v)) for k, v in context.iteritems()
+ (normalize_has_feature(k), normalize_numbers(v))
+ for k, v in context.iteritems()
)
try:
- return Preprocessor.do_if(self, *args, **kwargs)
+ return Preprocessor.do_if(self, normalize_has_feature(expression),
+ **kwargs)
finally:
self.context = context
class Context(dict):
def __missing__(self, key):
return None
def filter_c_substitution(self, line):