mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-26 12:20:56 +00:00
Bug 1392643 Turn on c++14 for MinGW globally r=bagder,froydnj
Technically this turns on gnu++14. I encountered a few errors when using c++14: 1) _USE_MATH_DEFINES needed to be defined for MinGW 2) MinGW did not define _finite under c++14 3) MinGW's float.h did not define Microsoft specific float functions under c++14 All of these were because c++14 defines _STRICT_ANSI_ which MinGW obeys and avoids defining certain functions. The first two could be patched around, but the third was a blocker, so we switched to gnu++14 MozReview-Commit-ID: 6Y7gEQgApYp --HG-- extra : rebase_source : dabbd40c049c36e780b585e0bef0a8e25887d089
This commit is contained in:
parent
4c42c44c85
commit
83f834aede
@ -374,13 +374,24 @@ def check_compiler(compiler, language, target):
|
||||
# Note: MSVC, while supporting C++11, still reports 199711L for __cplusplus.
|
||||
# Note: this is a strict version check because we used to always add
|
||||
# -std=gnu++11.
|
||||
draft_cxx14_version = 201300
|
||||
cxx14_version = 201402
|
||||
if info.language == 'C++':
|
||||
if info.type in ('clang', 'gcc') 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 != 201402:
|
||||
append_flag('-std=c++14')
|
||||
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')
|
||||
|
||||
# We force clang-cl to emulate Visual C++ 2015 Update 3.
|
||||
if info.type == 'clang-cl' and info.version != '19.00.24213':
|
||||
|
36
python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
Normal file → Executable file
36
python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
Normal file → Executable file
@ -37,6 +37,10 @@ DEFAULT_CXX_11 = {
|
||||
'__cplusplus': '201103L',
|
||||
}
|
||||
|
||||
DRAFT_CXX_14 = {
|
||||
'__cplusplus': '201300L',
|
||||
}
|
||||
|
||||
DEFAULT_CXX_14 = {
|
||||
'__cplusplus': '201402L',
|
||||
}
|
||||
@ -49,6 +53,10 @@ SUPPORTS_GNUXX11 = {
|
||||
'-std=gnu++11': DEFAULT_CXX_11,
|
||||
}
|
||||
|
||||
SUPPORTS_GNUXX14 = {
|
||||
'-std=gnu++14': DEFAULT_CXX_14,
|
||||
}
|
||||
|
||||
SUPPORTS_CXX14 = {
|
||||
'-std=c++14': DEFAULT_CXX_14,
|
||||
}
|
||||
@ -76,13 +84,16 @@ def GCC(version):
|
||||
def GXX(version):
|
||||
return GCC_BASE(version) + DEFAULT_CXX_97 + SUPPORTS_GNUXX11
|
||||
|
||||
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')
|
||||
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')
|
||||
GXX_5 = GXX('5.2.1') + SUPPORTS_GNUXX14
|
||||
|
||||
GCC_PLATFORM_LITTLE_ENDIAN = {
|
||||
'__BYTE_ORDER__': 1234,
|
||||
@ -163,7 +174,7 @@ def CLANG(version):
|
||||
@memoize
|
||||
def CLANGXX(version):
|
||||
return (GCC_BASE('4.2.1') + CLANG_BASE(version) + DEFAULT_CXX_97 +
|
||||
SUPPORTS_GNUXX11)
|
||||
SUPPORTS_GNUXX11 + SUPPORTS_GNUXX14)
|
||||
|
||||
|
||||
CLANG_3_3 = CLANG('3.3.0') + DEFAULT_C99
|
||||
@ -173,6 +184,9 @@ CLANGXX_3_6 = CLANGXX('3.6.2') + {
|
||||
'-std=gnu++11': {
|
||||
'__has_feature(cxx_alignof)': '1',
|
||||
},
|
||||
'-std=gnu++14': {
|
||||
'__has_feature(cxx_alignof)': '1',
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@ -901,9 +915,21 @@ class WindowsToolchainTest(BaseToolchainTest):
|
||||
CLANGXX_3_6_RESULT = LinuxToolchainTest.CLANGXX_3_6_RESULT
|
||||
GCC_4_7_RESULT = LinuxToolchainTest.GCC_4_7_RESULT
|
||||
GCC_4_9_RESULT = LinuxToolchainTest.GCC_4_9_RESULT
|
||||
GXX_4_9_RESULT = LinuxToolchainTest.GXX_4_9_RESULT
|
||||
GXX_4_9_RESULT = CompilerResult(
|
||||
flags=['-std=gnu++14'],
|
||||
version='4.9.3',
|
||||
type='gcc',
|
||||
compiler='/usr/bin/g++',
|
||||
language='C++',
|
||||
)
|
||||
GCC_5_RESULT = LinuxToolchainTest.GCC_5_RESULT
|
||||
GXX_5_RESULT = LinuxToolchainTest.GXX_5_RESULT
|
||||
GXX_5_RESULT = CompilerResult(
|
||||
flags=['-std=gnu++14'],
|
||||
version='5.2.1',
|
||||
type='gcc',
|
||||
compiler='/usr/bin/g++-5',
|
||||
language='C++',
|
||||
)
|
||||
|
||||
# VS2015u3 or greater is required.
|
||||
def test_msvc(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user