Bug 1559301 - Straighten up C/C++ standard compiler flags. r=nalexander

- `info.type in ('clang-cl', 'clang', 'gcc')` is always true since MSVC
support was removed.
- For some reason, we didn't enforce C++14 on GCC.

Differential Revision: https://phabricator.services.mozilla.com/D34990

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mike Hommey 2019-06-14 16:14:50 +00:00
parent a589b46441
commit 5091811073

View File

@ -521,22 +521,22 @@ def check_compiler(compiler, language, target):
# 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'):
if info.type == 'clang-cl':
flags.append('-Xclang')
flags.append('-std=gnu99')
if info.type == 'clang-cl':
flags.append('-Xclang')
flags.append('-std=gnu99')
# Note: this is a strict version check because we used to always add
# -std=gnu++14.
cxx14_version = 201402
if info.language == 'C++':
if info.type == 'clang' and info.language_version != cxx14_version:
flags.append('-std=gnu++14')
# MSVC headers include C++14 features, but don't guard them
# with appropriate checks.
elif info.type == 'clang-cl' and info.language_version != cxx14_version:
flags.append('-Xclang')
flags.append('-std=c++14')
if info.language_version != cxx14_version:
# MSVC headers include C++14 features, but don't guard them
# with appropriate checks.
if info.type == 'clang-cl':
flags.append('-Xclang')
flags.append('-std=c++14')
else:
flags.append('-std=gnu++14')
# Check compiler target
# --------------------------------------------------------------------