aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2016-12-29 12:52:39 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2017-01-04 00:40:54 +0530
commit731aca216e2e840e114b5ab934e78bd3f8a59e5f (patch)
treefec181ee00cd8e2e3c7f3b1bfebb934d5ef9619d /mesonbuild/compilers.py
parente36183aab43ce92509a7f8d3a20c46c5e4c85714 (diff)
downloadmeson-731aca216e2e840e114b5ab934e78bd3f8a59e5f.zip
meson-731aca216e2e840e114b5ab934e78bd3f8a59e5f.tar.gz
meson-731aca216e2e840e114b5ab934e78bd3f8a59e5f.tar.bz2
icc: Fix C/C++ std options and add a unit test for them
Compiler versions 15.0 and later actually ignore invalid values for the -std= option unless `-diag-error 10159` is passed, so we need to put that in the unit test. I have tested this with versions 14.0.3, 15.0.6, 16.0.4, and 17.0.1. Would be great if someone could test with 13.x.y
Diffstat (limited to 'mesonbuild/compilers.py')
-rw-r--r--mesonbuild/compilers.py37
1 files changed, 20 insertions, 17 deletions
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py
index 9e4e622..bde829a 100644
--- a/mesonbuild/compilers.py
+++ b/mesonbuild/compilers.py
@@ -2448,9 +2448,12 @@ class IntelCCompiler(IntelCompiler, CCompiler):
'3': ['-Wall', '-w3', '-diag-disable:remark', '-Wpedantic', '-Wextra', '-Wpch-messages']}
def get_options(self):
+ c_stds = ['c89', 'c99']
+ g_stds = ['gnu89', 'gnu99']
+ if mesonlib.version_compare(self.version, '>=16.0.0'):
+ c_stds += ['c11']
opts = {'c_std': coredata.UserComboOption('c_std', 'C language standard to use',
- ['none', 'c89', 'c99',
- 'gnu89', 'gnu99'],
+ ['none'] + c_stds + g_stds,
'none')}
return opts
@@ -2469,6 +2472,7 @@ class IntelCCompiler(IntelCompiler, CCompiler):
class IntelCPPCompiler(IntelCompiler, CPPCompiler):
+
def __init__(self, exelist, version, icc_type, is_cross, exe_wrap):
CPPCompiler.__init__(self, exelist, version, is_cross, exe_wrap)
IntelCompiler.__init__(self, icc_type)
@@ -2477,22 +2481,21 @@ class IntelCPPCompiler(IntelCompiler, CPPCompiler):
'3': ['-Wall', '-w3', '-diag-disable:remark', '-Wpedantic', '-Wextra', '-Wpch-messages', '-Wnon-virtual-dtor']}
def get_options(self):
+ c_stds = []
+ g_stds = ['gnu++98']
+ if mesonlib.version_compare(self.version, '>=15.0.0'):
+ c_stds += ['c++11', 'c++14']
+ g_stds += ['gnu++11']
+ if mesonlib.version_compare(self.version, '>=16.0.0'):
+ c_stds += ['c++17']
if mesonlib.version_compare(self.version, '>=17.0.0'):
- opts = {'cpp_std': coredata.UserComboOption('cpp_std', 'C++ language standard to use',
- ['none', 'c++11', 'c++0x', 'c++14',
- 'gnu++98', 'gnu++11', 'gnu++0x', 'gnu++14'],
- 'none'),
- 'cpp_debugstl': coredata.UserBooleanOption('cpp_debugstl',
- 'STL debug mode',
- False)}
- else:
- opts = {'cpp_std': coredata.UserComboOption('cpp_std', 'C++ language standard to use',
- ['none', 'c++03', 'c++11', 'c++0x',
- 'gnu++98', 'gnu++03', 'gnu++11', 'gnu++0x'],
- 'none'),
- 'cpp_debugstl': coredata.UserBooleanOption('cpp_debugstl',
- 'STL debug mode',
- False)}
+ g_stds += ['gnu++14']
+ opts = {'cpp_std': coredata.UserComboOption('cpp_std', 'C++ language standard to use',
+ ['none'] + c_stds + g_stds,
+ 'none'),
+ 'cpp_debugstl': coredata.UserBooleanOption('cpp_debugstl',
+ 'STL debug mode',
+ False)}
return opts
def get_option_compile_args(self, options):