diff options
-rwxr-xr-x | configure.py | 6 | ||||
-rwxr-xr-x | src/scripts/python_unittests.py | 14 |
2 files changed, 18 insertions, 2 deletions
diff --git a/configure.py b/configure.py index 25f142cb9..fea687a87 100755 --- a/configure.py +++ b/configure.py @@ -2707,10 +2707,12 @@ class CompilerDetector(object): xcode_version_to_clang = { '703': '3.8', '800': '3.9', - '802': '4.0' + # 802 has no support for clang 4.0 flags -Og and -MJ, 900 has. + '802': '3.9', + '900': '4.0', } - match = re.search(r'Apple LLVM version [0-9.]+ \(clang-([0-9]{3})\.', cc_output) + match = re.search(r'Apple LLVM version [0-9\.]+ \(clang-([0-9]+)\.', cc_output) if match: apple_clang_version = match.group(1) if apple_clang_version in xcode_version_to_clang: diff --git a/src/scripts/python_unittests.py b/src/scripts/python_unittests.py index fff32e03f..1df35f0cd 100755 --- a/src/scripts/python_unittests.py +++ b/src/scripts/python_unittests.py @@ -96,6 +96,20 @@ Candidate multilib: .;@m32 Selected multilib: .;@m32""" self.assertEqual(detector.version_from_compiler_output(compiler_out), "3.7") + def test_clang_version_appleclang(self): + detector = CompilerDetector("clang", "clang++", "darwin") + compiler_out = """Apple LLVM version 8.1.0 (clang-802.0.42) +Target: x86_64-apple-darwin16.7.0 +Thread model: posix +InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin""" + self.assertEqual(detector.version_from_compiler_output(compiler_out), "3.9") + + compiler_out = """Apple LLVM version 9.0.0 (clang-900.0.35) +Target: x86_64-apple-darwin16.7.0 +Thread model: posix +InstalledDir: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin""" + self.assertEqual(detector.version_from_compiler_output(compiler_out), "4.0") + def test_msvc_version(self): detector = CompilerDetector("msvc", "cl.exe", "windows") compiler_out = """msvc_version.c |