Skip to content

Commit

Permalink
Bug 1325632 - part 6 - compile with C++14 support; r=glandium
Browse files Browse the repository at this point in the history
  • Loading branch information
froydnj committed Nov 15, 2017
1 parent 1a10847 commit 6114b2d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
32 changes: 14 additions & 18 deletions build/moz.configure/toolchain.configure
Original file line number Diff line number Diff line change
Expand Up @@ -499,28 +499,24 @@ def check_compiler(compiler, language, target):
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':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ def GXX(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')
Expand Down Expand Up @@ -433,7 +437,7 @@ class LinuxToolchainTest(BaseToolchainTest):
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++',
Expand All @@ -447,7 +451,7 @@ class LinuxToolchainTest(BaseToolchainTest):
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',
Expand All @@ -469,7 +473,7 @@ class LinuxToolchainTest(BaseToolchainTest):
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++',
Expand Down

0 comments on commit 6114b2d

Please sign in to comment.