Bug 1325632 - part 6 - compile with C++14 support; r=glandium
authorNathan Froyd <froydnj@mozilla.com>
Wed, 15 Nov 2017 13:53:16 -0500
changeset 392047 b6a8db01f25a57d6b70a769ab96c3a407b490945
parent 392046 402cad93aa6ece010f3c834b9d20e431c4ee8f8b
child 392048 0ad4e810bab1313edd3d53b71f69afa692f5dc46
push id32909
push usercbrindusan@mozilla.com
push dateWed, 15 Nov 2017 22:25:14 +0000
treeherdermozilla-central@f41930a869a8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1325632
milestone59.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 1325632 - part 6 - compile with C++14 support; r=glandium
build/moz.configure/toolchain.configure
python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -494,38 +494,34 @@ def check_compiler(compiler, language, t
     # Note: We do a strict version check because there sometimes are backwards
     # incompatible changes in the standard, and not all code that compiles as
     # C99 compiles as e.g. C11 (as of writing, this is true of libnestegg, for
     # example)
     if info.language == 'C' and info.language_version != 199901:
         if info.type in ('clang-cl', 'clang', 'gcc'):
             append_flag('-std=gnu99')
 
-    # Note: MSVC, while supporting C++11, still reports 199711L for __cplusplus.
+    # Note: MSVC, while supporting C++14, still reports 199711L for __cplusplus.
     # Note: this is a strict version check because we used to always add
-    # -std=gnu++11.
+    # -std=gnu++14.
     draft_cxx14_version = 201300
     cxx14_version = 201402
     if info.language == 'C++':
-        if target.kernel != 'WINNT':
-            if info.type in ('clang', 'gcc') and info.language_version != 201103:
-                append_flag('-std=gnu++11')
-        else:
-            if info.type == 'clang' and info.language_version != 201103:
-                append_flag('-std=gnu++11')
-            # MSVC 2015 headers include C++14 features, but don't guard them
-            # with appropriate checks.
-            if info.type == 'clang-cl' and info.language_version != cxx14_version:
-                append_flag('-std=c++14')
-            # GCC 4.9 indicates that it implements draft C++14 features
-            # instead of the full language.
-            elif info.type == 'gcc' and not \
-                (info.language_version == draft_cxx14_version or
-                 info.language_version == cxx14_version):
-                append_flag('-std=gnu++14')
+        if info.type == 'clang' and info.language_version != cxx14_version:
+            append_flag('-std=gnu++14')
+        # MSVC 2015 headers include C++14 features, but don't guard them
+        # with appropriate checks.
+        elif info.type == 'clang-cl' and info.language_version != cxx14_version:
+            append_flag('-std=c++14')
+        # GCC 4.9 indicates that it implements draft C++14 features
+        # instead of the full language.
+        elif info.type == 'gcc' and \
+                info.language_version not in (draft_cxx14_version,
+                                              cxx14_version):
+            append_flag('-std=gnu++14')
 
     # We force clang-cl to emulate Visual C++ 2017 version 15.4
     if info.type == 'clang-cl' and info.version != '19.11.25547':
         # This flag is a direct clang-cl flag that doesn't need -Xclang,
         # add it directly.
         flags.append('-fms-compatibility-version=19.11.25547')
 
     # Check compiler target
--- a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
+++ b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
@@ -83,16 +83,20 @@ def GCC(version):
 @memoize
 def GXX(version):
     return GCC_BASE(version) + DEFAULT_CXX_97 + SUPPORTS_GNUXX11
 
 SUPPORTS_DRAFT_CXX14_VERSION = {
     '-std=gnu++14': DRAFT_CXX_14,
 }
 
+SUPPORTS_DRAFT_CXX14_VERSION = {
+    '-std=gnu++14': DRAFT_CXX_14,
+}
+
 GCC_4_7 = GCC('4.7.3')
 GXX_4_7 = GXX('4.7.3')
 GCC_4_9 = GCC('4.9.3')
 GXX_4_9 = GXX('4.9.3') + SUPPORTS_DRAFT_CXX14_VERSION
 GCC_5 = GCC('5.2.1') + DEFAULT_C11
 GXX_5 = GXX('5.2.1') + SUPPORTS_GNUXX14
 
 GCC_PLATFORM_LITTLE_ENDIAN = {
@@ -428,31 +432,31 @@ class LinuxToolchainTest(BaseToolchainTe
     GCC_4_9_RESULT = CompilerResult(
         flags=['-std=gnu99'],
         version='4.9.3',
         type='gcc',
         compiler='/usr/bin/gcc',
         language='C',
     )
     GXX_4_9_RESULT = CompilerResult(
-        flags=['-std=gnu++11'],
+        flags=['-std=gnu++14'],
         version='4.9.3',
         type='gcc',
         compiler='/usr/bin/g++',
         language='C++',
     )
     GCC_5_RESULT = CompilerResult(
         flags=['-std=gnu99'],
         version='5.2.1',
         type='gcc',
         compiler='/usr/bin/gcc-5',
         language='C',
     )
     GXX_5_RESULT = CompilerResult(
-        flags=['-std=gnu++11'],
+        flags=['-std=gnu++14'],
         version='5.2.1',
         type='gcc',
         compiler='/usr/bin/g++-5',
         language='C++',
     )
     CLANG_3_3_RESULT = CompilerResult(
         flags=[],
         version='3.3.0',
@@ -464,17 +468,17 @@ class LinuxToolchainTest(BaseToolchainTe
     CLANG_3_6_RESULT = CompilerResult(
         flags=['-std=gnu99'],
         version='3.6.2',
         type='clang',
         compiler='/usr/bin/clang',
         language='C',
     )
     CLANGXX_3_6_RESULT = CompilerResult(
-        flags=['-std=gnu++11'],
+        flags=['-std=gnu++14'],
         version='3.6.2',
         type='clang',
         compiler='/usr/bin/clang++',
         language='C++',
     )
 
     def test_gcc(self):
         # We'll try gcc and clang, and find gcc first.