aboutsummaryrefslogtreecommitdiffstats
path: root/src/scripts
diff options
context:
space:
mode:
authorSimon Warta <[email protected]>2017-09-07 23:53:06 +0200
committerSimon Warta <[email protected]>2017-09-07 23:57:18 +0200
commit59ca3d8b4b733ad72b0eda950e9f730dc5898762 (patch)
tree95f53827d5787727627c5e3134555024fc0f3129 /src/scripts
parenteb0232cc7db8849b1c4f2f07c9e3516c8b5c4f0c (diff)
Improve appleclang version logic
For appleclang version >= X, return minimal clang version Y. This now works for all intermediate versions between the known fixed points. This is especially important for compiling today's code with a future compiler.
Diffstat (limited to 'src/scripts')
-rwxr-xr-xsrc/scripts/python_unittests.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/scripts/python_unittests.py b/src/scripts/python_unittests.py
index 1df35f0cd..649ccf662 100755
--- a/src/scripts/python_unittests.py
+++ b/src/scripts/python_unittests.py
@@ -110,6 +110,31 @@ 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_clang_version_appleclang_intermediate(self):
+ # fake versions in between the knwon ones
+ # clang-700.0.0 is lower than all known versions
+ # clang-802.1.0 is a minor update of known clang-802
+ # clang-1111.9.99 is a random future value
+ detector = CompilerDetector("clang", "clang++", "darwin")
+
+ compiler_out = """Apple LLVM version 7.0.0 (clang-700.0.0)
+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.8")
+
+ compiler_out = """Apple LLVM version 8.1.1 (clang-802.1.0)
+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 11.11.0 (clang-1111.9.99)
+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), "4.0")
+
def test_msvc_version(self):
detector = CompilerDetector("msvc", "cl.exe", "windows")
compiler_out = """msvc_version.c