From 8f16d0f3c99666c36f37ef10df0b916e88c1afaa Mon Sep 17 00:00:00 2001 From: David Seifert Date: Sun, 16 Sep 2018 11:39:54 +0200 Subject: Fix ICC on macOS --- mesonbuild/compilers/cpp.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'mesonbuild/compilers/cpp.py') diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py index 004f65e..6220b93 100644 --- a/mesonbuild/compilers/cpp.py +++ b/mesonbuild/compilers/cpp.py @@ -261,12 +261,15 @@ class IntelCPPCompiler(IntelCompiler, CPPCompiler): '-Wpch-messages', '-Wnon-virtual-dtor'] self.warn_args = {'1': default_warn_args, '2': default_warn_args + ['-Wextra'], - '3': default_warn_args + ['-Wextra', '-Wpedantic']} + '3': default_warn_args + ['-Wextra']} def get_options(self): opts = CPPCompiler.get_options(self) - c_stds = [] - g_stds = ['gnu++98'] + # Every Unix compiler under the sun seems to accept -std=c++03, + # with the exception of ICC. Instead of preventing the user from + # globally requesting C++03, we transparently remap it to C++98 + c_stds = ['c++98', 'c++03'] + g_stds = ['gnu++98', 'gnu++03'] if version_compare(self.version, '>=15.0.0'): c_stds += ['c++11', 'c++14'] g_stds += ['gnu++11'] @@ -286,7 +289,11 @@ class IntelCPPCompiler(IntelCompiler, CPPCompiler): args = [] std = options['cpp_std'] if std.value != 'none': - args.append('-std=' + std.value) + remap_cpp03 = { + 'c++03': 'c++98', + 'gnu++03': 'gnu++98' + } + args.append('-std=' + remap_cpp03.get(std.value, std.value)) if options['cpp_debugstl'].value: args.append('-D_GLIBCXX_DEBUG=1') return args @@ -294,6 +301,10 @@ class IntelCPPCompiler(IntelCompiler, CPPCompiler): def get_option_link_args(self, options): return [] + def has_arguments(self, args, env, code, mode): + # -diag-error 10148 is required to catch invalid -W options + return super().has_arguments(args + ['-diag-error', '10006', '-diag-error', '10148'], env, code, mode) + class VisualStudioCPPCompiler(VisualStudioCCompiler, CPPCompiler): def __init__(self, exelist, version, is_cross, exe_wrap, is_64): -- cgit v1.1