Bug 1579189 - raise the minimum clang version to 5; r=#build
authorNathan Froyd <froydnj@mozilla.com>
Thu, 14 Nov 2019 11:16:38 -0400
changeset 501561 d64119136e15458d4aea5c548b4d10d7099d78f6
parent 501560 9e3f44e87a1a2be927c7fab135653c6b86b982c9
child 502038 88db9bea4580df16dc444668f8c2cddbb3414318
push id114171
push usernfroyd@mozilla.com
push dateThu, 14 Nov 2019 15:21:48 +0000
treeherdermozilla-inbound@d64119136e15 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1579189
milestone72.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1579189 - raise the minimum clang version to 5; r=#build We need this for "full" C++17 support (everything is supported, but some C++17 features still have bugs) and this change also brings Linux into parity with our Mac requirements. MANUAL PUSH: build toolchains on inbound to avoid clogging autoland Differential Revision: https://phabricator.services.mozilla.com/D51450
build/build-clang/clang-4.0-linux64.json
build/build-clang/clang-5.0-linux64.json
build/moz.configure/toolchain.configure
python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
taskcluster/ci/build/linux.yml
taskcluster/ci/fetch/toolchains.yml
taskcluster/ci/toolchain/clang.yml
deleted file mode 100644
--- a/build/build-clang/clang-4.0-linux64.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
-    "stages": "3",
-    "build_libcxx": true,
-    "build_type": "Release",
-    "assertions": false,
-    "python_path": "/usr/bin/python2.7",
-    "gcc_dir": "{MOZ_FETCHES_DIR}/gcc",
-    "cc": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",
-    "cxx": "{MOZ_FETCHES_DIR}/gcc/bin/g++",
-    "as": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",
-    "patches": []
-}
new file mode 100644
--- /dev/null
+++ b/build/build-clang/clang-5.0-linux64.json
@@ -0,0 +1,12 @@
+{
+    "stages": "3",
+    "build_libcxx": true,
+    "build_type": "Release",
+    "assertions": false,
+    "python_path": "/usr/bin/python2.7",
+    "gcc_dir": "{MOZ_FETCHES_DIR}/gcc",
+    "cc": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",
+    "cxx": "{MOZ_FETCHES_DIR}/gcc/bin/g++",
+    "as": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",
+    "patches": []
+}
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -392,32 +392,27 @@ def get_compiler_info(compiler, language
     - the compiler version
     - the compiler supported language
     - the compiler supported language version
     '''
     # Note: We'd normally do a version check for clang, but versions of clang
     # in Xcode have a completely different versioning scheme despite exposing
     # the version with the same defines.
     # So instead, we make things such that the version is missing when the
-    # clang used is below the minimum supported version (currently clang 4.0,
-    # or 5.0 on mac).
+    # clang used is below the minimum supported version (currently clang 5.0).
     # We then only include the version information when the compiler matches
     # the feature check, so that an unsupported version of clang would have
     # no version number.
     check = dedent('''\
         #if defined(_MSC_VER) && defined(__clang__) && defined(_MT)
         %COMPILER "clang-cl"
         %VERSION __clang_major__.__clang_minor__.__clang_patchlevel__
         #elif defined(__clang__)
         %COMPILER "clang"
-        #  if defined(__APPLE__)
-        #    if __has_warning("-Wunguarded-availability")
-        %VERSION __clang_major__.__clang_minor__.__clang_patchlevel__
-        #    endif
-        #  elif __has_attribute(diagnose_if)
+        #  if __has_warning("-Wunguarded-availability")
         %VERSION __clang_major__.__clang_minor__.__clang_patchlevel__
         #  endif
         #elif defined(__GNUC__)
         %COMPILER "gcc"
         %VERSION __GNUC__.__GNUC_MINOR__.__GNUC_PATCHLEVEL__
         #endif
 
         #if __cplusplus
@@ -1033,21 +1028,18 @@ def compiler(language, host_or_target, c
             if info.version < '8.0.0':
                 raise FatalCheckError(
                     'Only clang-cl 8.0 or newer is supported (found version %s)'
                     % info.version)
 
         # If you want to bump the version check here search for
         # diagnose_if above, and see the associated comment.
         if info.type == 'clang' and not info.version:
-            if host_or_target.os == 'OSX':
-                raise FatalCheckError(
-                    'Only clang/llvm 5.0 or newer is supported.')
             raise FatalCheckError(
-                'Only clang/llvm 4.0 or newer is supported.')
+                'Only clang/llvm 5.0 or newer is supported.')
 
         if info.flags:
             raise FatalCheckError(
                 'Unknown compiler or compiler not supported.')
 
         return namespace(
             wrapper=wrapper,
             compiler=compiler,
--- a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
+++ b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
@@ -228,18 +228,18 @@ CLANGXX_4_0 = CLANGXX('4.0.2') + SUPPORT
 CLANG_5_0 = CLANG('5.0.1') + DEFAULT_C11 + {
     '__has_attribute(diagnose_if)': '1',
     '__has_warning("-Wunguarded-availability")': '1',
 }
 CLANGXX_5_0 = CLANGXX('5.0.1') + SUPPORTS_GNUXX17 + {
     '__has_attribute(diagnose_if)': '1',
     '__has_warning("-Wunguarded-availability")': '1',
 }
-DEFAULT_CLANG = CLANG_4_0
-DEFAULT_CLANGXX = CLANGXX_4_0
+DEFAULT_CLANG = CLANG_5_0
+DEFAULT_CLANGXX = CLANGXX_5_0
 
 
 def CLANG_PLATFORM(gcc_platform):
     base = {
         '--target=x86_64-linux-gnu': GCC_PLATFORM_X86_64_LINUX[None],
         '--target=x86_64-apple-darwin11.2.0': GCC_PLATFORM_X86_64_OSX[None],
         '--target=i686-linux-gnu': GCC_PLATFORM_X86_LINUX[None],
         '--target=i686-apple-darwin11.2.0': GCC_PLATFORM_X86_OSX[None],
@@ -474,16 +474,18 @@ class LinuxToolchainTest(BaseToolchainTe
         '/usr/bin/gcc-5': GCC_5 + GCC_PLATFORM_X86_64_LINUX,
         '/usr/bin/g++-5': GXX_5 + GCC_PLATFORM_X86_64_LINUX,
         '/usr/bin/gcc-6': GCC_6 + GCC_PLATFORM_X86_64_LINUX,
         '/usr/bin/g++-6': GXX_6 + GCC_PLATFORM_X86_64_LINUX,
         '/usr/bin/gcc-7': GCC_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_CLANGXX + CLANG_PLATFORM_X86_64_LINUX,
+        '/usr/bin/clang-5.0': CLANG_5_0 + CLANG_PLATFORM_X86_64_LINUX,
+        '/usr/bin/clang++-5.0': CLANGXX_5_0 + CLANG_PLATFORM_X86_64_LINUX,
         '/usr/bin/clang-4.0': CLANG_4_0 + 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': CLANGXX_3_3 + CLANG_PLATFORM_X86_64_LINUX,
     }
 
     GCC_4_7_RESULT = old_gcc_message('4.7.3')
     GXX_4_7_RESULT = GCC_4_7_RESULT
@@ -517,34 +519,36 @@ class LinuxToolchainTest(BaseToolchainTe
         version='7.3.0',
         type='gcc',
         compiler='/usr/bin/g++-7',
         language='C++',
     )
     DEFAULT_GCC_RESULT = GCC_6_RESULT + {'compiler': '/usr/bin/gcc'}
     DEFAULT_GXX_RESULT = GXX_6_RESULT + {'compiler': '/usr/bin/g++'}
 
-    CLANG_3_3_RESULT = 'Only clang/llvm 4.0 or newer is supported.'
-    CLANGXX_3_3_RESULT = 'Only clang/llvm 4.0 or newer is supported.'
-    CLANG_4_0_RESULT = CompilerResult(
+    CLANG_3_3_RESULT = 'Only clang/llvm 5.0 or newer is supported.'
+    CLANGXX_3_3_RESULT = 'Only clang/llvm 5.0 or newer is supported.'
+    CLANG_4_0_RESULT = 'Only clang/llvm 5.0 or newer is supported.'
+    CLANGXX_4_0_RESULT = 'Only clang/llvm 5.0 or newer is supported.'
+    CLANG_5_0_RESULT = CompilerResult(
         flags=['-std=gnu99'],
-        version='4.0.2',
+        version='5.0.1',
         type='clang',
-        compiler='/usr/bin/clang-4.0',
+        compiler='/usr/bin/clang-5.0',
         language='C',
     )
-    CLANGXX_4_0_RESULT = CompilerResult(
+    CLANGXX_5_0_RESULT = CompilerResult(
         flags=['-std=gnu++14'],
-        version='4.0.2',
+        version='5.0.1',
         type='clang',
-        compiler='/usr/bin/clang++-4.0',
+        compiler='/usr/bin/clang++-5.0',
         language='C++',
     )
-    DEFAULT_CLANG_RESULT = CLANG_4_0_RESULT + {'compiler': '/usr/bin/clang'}
-    DEFAULT_CLANGXX_RESULT = CLANGXX_4_0_RESULT + {'compiler': '/usr/bin/clang++'}
+    DEFAULT_CLANG_RESULT = CLANG_5_0_RESULT + {'compiler': '/usr/bin/clang'}
+    DEFAULT_CLANGXX_RESULT = CLANGXX_5_0_RESULT + {'compiler': '/usr/bin/clang++'}
 
     def test_default(self):
         # We'll try clang and gcc, and find clang first.
         self.do_toolchain_test(self.PATHS, {
             'c_compiler': self.DEFAULT_CLANG_RESULT,
             'cxx_compiler': self.DEFAULT_CLANGXX_RESULT,
         })
 
@@ -663,30 +667,37 @@ class LinuxToolchainTest(BaseToolchainTe
         self.do_toolchain_test(paths, {
             'c_compiler': self.DEFAULT_CLANG_RESULT,
             'cxx_compiler': self.DEFAULT_CLANGXX_RESULT,
         })
 
     def test_guess_cxx_clang(self):
         # When CXX is not set, we guess it from CC.
         self.do_toolchain_test(self.PATHS, {
-            'c_compiler': self.CLANG_4_0_RESULT,
-            'cxx_compiler': self.CLANGXX_4_0_RESULT,
+            'c_compiler': self.CLANG_5_0_RESULT,
+            'cxx_compiler': self.CLANGXX_5_0_RESULT,
         }, environ={
-            'CC': 'clang-4.0',
+            'CC': 'clang-5.0',
         })
 
     def test_unsupported_clang(self):
         self.do_toolchain_test(self.PATHS, {
             'c_compiler': self.CLANG_3_3_RESULT,
             'cxx_compiler': self.CLANGXX_3_3_RESULT,
         }, environ={
             'CC': 'clang-3.3',
             'CXX': 'clang++-3.3',
         })
+        self.do_toolchain_test(self.PATHS, {
+            'c_compiler': self.CLANG_4_0_RESULT,
+            'cxx_compiler': self.CLANGXX_4_0_RESULT,
+        }, environ={
+            'CC': 'clang-4.0',
+            'CXX': 'clang++-4.0',
+        })
 
     def test_no_supported_compiler(self):
         # Even if there are gcc-x.y or clang-x.y compilers available, we
         # don't try them. This could be considered something to improve.
         paths = {
             k: v for k, v in self.PATHS.iteritems()
             if os.path.basename(k) not in ('gcc', 'g++', 'clang', 'clang++')
         }
@@ -949,16 +960,18 @@ class WindowsToolchainTest(BaseToolchain
         '/usr/bin/gcc-4.9': GCC_4_9 + GCC_PLATFORM_X86_WIN,
         '/usr/bin/g++-4.9': GXX_4_9 + GCC_PLATFORM_X86_WIN,
         '/usr/bin/gcc-5': GCC_5 + GCC_PLATFORM_X86_WIN,
         '/usr/bin/g++-5': GXX_5 + GCC_PLATFORM_X86_WIN,
         '/usr/bin/gcc-6': GCC_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_CLANGXX + CLANG_PLATFORM_X86_WIN,
+        '/usr/bin/clang-5.0': CLANG_5_0 + CLANG_PLATFORM_X86_WIN,
+        '/usr/bin/clang++-5.0': CLANGXX_5_0 + CLANG_PLATFORM_X86_WIN,
         '/usr/bin/clang-4.0': CLANG_4_0 + 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': CLANGXX_3_3 + CLANG_PLATFORM_X86_WIN,
     }
 
     CLANG_CL_3_9_RESULT = 'Only clang-cl 8.0 or newer is supported (found version 3.9.0)'
     CLANG_CL_8_0_RESULT = CompilerResult(
@@ -973,16 +986,18 @@ class WindowsToolchainTest(BaseToolchain
         version='8.0.0',
         flags=['-Xclang', '-std=c++14'],
         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
+    CLANG_4_0_RESULT = LinuxToolchainTest.CLANG_4_0_RESULT
+    CLANGXX_4_0_RESULT = LinuxToolchainTest.CLANGXX_4_0_RESULT
     DEFAULT_CLANG_RESULT = LinuxToolchainTest.DEFAULT_CLANG_RESULT
     DEFAULT_CLANGXX_RESULT = LinuxToolchainTest.DEFAULT_CLANGXX_RESULT
     GCC_4_9_RESULT = LinuxToolchainTest.GCC_4_9_RESULT
     GXX_4_9_RESULT = LinuxToolchainTest.GXX_4_9_RESULT
     GCC_5_RESULT = LinuxToolchainTest.GCC_5_RESULT
     GXX_5_RESULT = LinuxToolchainTest.GXX_5_RESULT
     GCC_6_RESULT = LinuxToolchainTest.GCC_6_RESULT
     GXX_6_RESULT = LinuxToolchainTest.GXX_6_RESULT
@@ -1066,16 +1081,18 @@ class Windows64ToolchainTest(WindowsTool
         '/usr/bin/gcc-5': GCC_5 + GCC_PLATFORM_X86_64_WIN,
         '/usr/bin/g++-5': GXX_5 + GCC_PLATFORM_X86_64_WIN,
         '/usr/bin/gcc-6': GCC_6 + GCC_PLATFORM_X86_64_WIN,
         '/usr/bin/g++-6': GXX_6 + GCC_PLATFORM_X86_64_WIN,
         '/usr/bin/gcc-7': GCC_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_CLANGXX + CLANG_PLATFORM_X86_64_WIN,
+        '/usr/bin/clang-5.0': CLANG_5_0 + CLANG_PLATFORM_X86_64_WIN,
+        '/usr/bin/clang++-5.0': CLANGXX_5_0 + CLANG_PLATFORM_X86_64_WIN,
         '/usr/bin/clang-4.0': CLANG_4_0 + 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': CLANGXX_3_3 + CLANG_PLATFORM_X86_64_WIN,
     }
 
 
 class LinuxCrossCompileToolchainTest(BaseToolchainTest):
--- a/taskcluster/ci/build/linux.yml
+++ b/taskcluster/ci/build/linux.yml
@@ -247,17 +247,17 @@ linux64-base-toolchains/opt:
             - builds/releng_base_firefox.py
             - builds/releng_base_linux_64_builds.py
         script: "mozharness/scripts/fx_desktop_build.py"
         secrets: true
         tooltool-downloads: public
         need-xvfb: true
     fetches:
         toolchain:
-            - linux64-clang-4.0
+            - linux64-clang-5.0
             - linux64-gcc-6
             - linux64-rust-1.37
             - linux64-cbindgen
             - linux64-sccache
             - linux64-nasm-2.13.02
             - linux64-node
 
 linux64-base-toolchains/debug:
@@ -284,17 +284,17 @@ linux64-base-toolchains/debug:
         script: "mozharness/scripts/fx_desktop_build.py"
         secrets: true
         custom-build-variant-cfg: debug
         mozconfig-variant: debug
         tooltool-downloads: public
         need-xvfb: true
     fetches:
         toolchain:
-            - linux64-clang-4.0
+            - linux64-clang-5.0
             - linux64-gcc-6
             - linux64-rust-1.37
             - linux64-cbindgen
             - linux64-sccache
             - linux64-nasm-2.13.02
             - linux64-node
 
 linux64-base-toolchains-clang/opt:
@@ -320,17 +320,17 @@ linux64-base-toolchains-clang/opt:
             - builds/releng_base_linux_64_builds.py
         script: "mozharness/scripts/fx_desktop_build.py"
         secrets: true
         tooltool-downloads: public
         need-xvfb: true
     fetches:
         toolchain:
             - linux64-binutils
-            - linux64-clang-4.0
+            - linux64-clang-5.0
             - linux64-rust-1.37
             - linux64-cbindgen
             - linux64-nasm-2.13.02
             - linux64-node
 
 linux64-base-toolchains-clang/debug:
     description: "Linux64 base toolchains clang Debug"
     index:
@@ -356,17 +356,17 @@ linux64-base-toolchains-clang/debug:
         secrets: true
         custom-build-variant-cfg: debug
         mozconfig-variant: debug
         tooltool-downloads: public
         need-xvfb: true
     fetches:
         toolchain:
             - linux64-binutils
-            - linux64-clang-4.0
+            - linux64-clang-5.0
             - linux64-rust-1.37
             - linux64-cbindgen
             - linux64-nasm-2.13.02
             - linux64-node
 
 linux/opt:
     description: "Linux32 Opt"
     index:
--- a/taskcluster/ci/fetch/toolchains.yml
+++ b/taskcluster/ci/fetch/toolchains.yml
@@ -382,22 +382,22 @@ llvm-mingw:
 
 android-rs-glue:
     description: android-rs-glue source code
     fetch:
         type: git
         repo: https://github.com/rust-windowing/android-rs-glue
         revision: e3ac6edea5814e1faca0c31ea8fac6877cb929ea
 
-clang-4.0:
-    description: clang 4.0 source code
+clang-5.0:
+    description: clang 5.0.2 source code
     fetch:
         type: git
         repo: https://github.com/llvm/llvm-project
-        revision: 449c3ef93afc7a668eb35e67a83717453e28b25a
+        revision: 6a075b6de4cafebec9ca1ff9eec7229a617c93f6
 
 clang-7:
     description: clang 7 source code
     fetch:
         type: git
         repo: https://github.com/llvm/llvm-project
         revision: d0d8eb2e5415b8be29343e3c17a18e49e67b5551
 
--- a/taskcluster/ci/toolchain/clang.yml
+++ b/taskcluster/ci/toolchain/clang.yml
@@ -5,31 +5,31 @@
 job-defaults:
     worker-type: b-linux-xlarge
     worker:
         max-run-time: 7200
     run:
         resources:
             - 'build/build-clang/build-clang.py'
 
-linux64-clang-4.0:
-    description: "Clang 4.0 toolchain build"
+linux64-clang-5.0:
+    description: "Clang 5.0 toolchain build"
     treeherder:
         symbol: TL(clang4.0)
     worker-type: b-linux-large
     run:
         script: build-clang.sh
         arguments:
-            - 'build/build-clang/clang-4.0-linux64.json'
+            - 'build/build-clang/clang-5.0-linux64.json'
         resources:
-            - 'build/build-clang/clang-4.0-linux64.json'
+            - 'build/build-clang/clang-5.0-linux64.json'
         toolchain-artifact: public/build/clang.tar.xz
     fetches:
         fetch:
-            - clang-4.0
+            - clang-5.0
         toolchain:
             - linux64-gcc-7
 
 linux64-clang-7:
     description: "Clang 7 toolchain build"
     treeherder:
         symbol: TL(clang7)
     run: