Bug 1270446 - Make check_compiler() return a namespace instead of a tuple. r=chmanchester
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 22 Apr 2016 09:24:32 +0900
changeset 296358 6faf0619a211d3841089aabb2405183483eb4a9a
parent 296357 a381b242fcd57388e7a406dba27758c151ddd1a4
child 296359 8e38b67846f12fc5423810c67a1f25721f57cdc4
push id76310
push usermh@glandium.org
push dateFri, 06 May 2016 12:25:15 +0000
treeherdermozilla-inbound@61bae26a46bc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschmanchester
bugs1270446
milestone49.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 1270446 - Make check_compiler() return a namespace instead of a tuple. r=chmanchester
build/moz.configure/toolchain.configure
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -346,17 +346,21 @@ def check_compiler(compiler, language):
     # We force clang-cl to emulate Visual C++ 2013 Update 3 with fallback to
     # cl.exe.
     if info.type == 'clang-cl' and info.version != '18.00.30723':
         # Those flags are direct clang-cl flags that don't need -Xclang, add
         # them directly.
         flags.append('-fms-compatibility-version=18.00.30723')
         flags.append('-fallback')
 
-    return info.type, info.version, flags
+    return namespace(
+        type=info.type,
+        version=info.version,
+        flags=flags,
+    )
 
 
 @template
 def default_c_compilers(host_or_target):
     '''Template defining the set of default C compilers for the host and
     target platforms.
     `host_or_target` is either `host` or `target` (the @depends functions
     from init.configure.
@@ -521,62 +525,61 @@ def compiler(language, host_or_target, c
                     % quote(os.path.dirname(full_path)))
             if os.path.normcase(find_program(compiler)) != os.path.normcase(
                     full_path):
                 die('Found `%s` before `%s` in your $PATH. '
                     'Please reorder your $PATH.',
                     quote(os.path.dirname(found_compiler)),
                     quote(os.path.dirname(full_path)))
 
-        type, version, more_flags = check_compiler(
-            wrapper + [compiler] + flags, language)
+        info = check_compiler(wrapper + [compiler] + flags, language)
 
         # Check that the additional flags we got are enough to not require any
         # more flags.
-        if more_flags:
-            flags += more_flags
-            type, version, more_flags = check_compiler(
-                wrapper + [compiler] + flags, language)
+        if info.flags:
+            flags += info.flags
+            info = check_compiler(wrapper + [compiler] + flags, language)
 
-        if more_flags:
+        if info.flags:
             raise FatalCheckError(
                 'Unknown compiler or compiler not supported.')
 
         # Compiler version checks
         # ===================================================
         # Check the compiler version here instead of in `compiler_version` so
         # that the `checking` message doesn't pretend the compiler can be used
         # to then bail out one line later.
-        if type == 'gcc' and version < '4.8.0':
+        if info.type == 'gcc' and info.version < '4.8.0':
             raise FatalCheckError(
                 'Only GCC 4.8 or newer is supported (found version %s).'
-                % version)
+                % info.version)
 
         # If you want to bump the version check here search for
         # __cpp_static_assert above, and see the associated comment.
-        if type == 'clang' and not version:
+        if info.type == 'clang' and not info.version:
             raise FatalCheckError(
                 'Only clang/llvm 3.4 or newer is supported.')
 
-        if type == 'msvc':
-            if version < '18.00.30723' or ('19' < version < '19.00.23506'):
+        if info.type == 'msvc':
+            if info.version < '18.00.30723' or (
+                    '19' < info.version < '19.00.23506'):
                 raise FatalCheckError(
                     'This version (%s) of the MSVC compiler is not '
                     'supported.\n'
                     'You must install Visual C++ 2013 Update 3, Visual '
                     'C++ 2015 Update 1, or newer in order to build.\n'
                     'See https://developer.mozilla.org/en/'
-                    'Windows_Build_Prerequisites' % version)
+                    'Windows_Build_Prerequisites' % info.version)
 
         return namespace(
             wrapper=wrapper,
             compiler=compiler,
             flags=flags,
-            type=type,
-            version=version,
+            type=info.type,
+            version=info.version,
         )
 
     @depends(valid_compiler)
     @checking('%s version' % what)
     def compiler_version(compiler):
         return compiler.version
 
     if language == 'C++':