summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2025-04-02 14:20:44 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2025-04-04 12:46:55 +0300
commitff0c758b2a8015f7e7ca6fc627c29ef7bb4771b3 (patch)
tree49de8a9f3a3d17d4f26a7c61e984027243834092
parent47984f813450bcbcd102ed45d579011deb4572c1 (diff)
downloadmeson-ff0c758b2a8015f7e7ca6fc627c29ef7bb4771b3.tar.gz
compilers: move -std options to get_option_std_args, special-casing CUDA
Move building the -std option to the new get_option_std_args method, special casing CUDA to never include the option from the host compiler. This fixes again #8523, which was broken by the option refactoring (unsurprisingly, since the fix was ripped out unceremoniously without a replacement). Fixes: #14365 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--mesonbuild/compilers/c.py26
-rw-r--r--mesonbuild/compilers/cpp.py91
-rw-r--r--mesonbuild/compilers/cuda.py14
-rw-r--r--mesonbuild/compilers/fortran.py6
-rw-r--r--mesonbuild/compilers/mixins/elbrus.py2
-rw-r--r--mesonbuild/compilers/objc.py4
-rw-r--r--mesonbuild/compilers/objcpp.py4
-rw-r--r--mesonbuild/compilers/rust.py2
-rw-r--r--mesonbuild/compilers/swift.py3
9 files changed, 88 insertions, 64 deletions
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py
index de21d4873..a6769fc96 100644
--- a/mesonbuild/compilers/c.py
+++ b/mesonbuild/compilers/c.py
@@ -132,7 +132,7 @@ class ClangCCompiler(ClangCStds, ClangCompiler, CCompiler):
gnu_winlibs)
return opts
- def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
+ def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
args = []
std = self.get_compileropt_value('std', env, target, subproject)
assert isinstance(std, str)
@@ -220,7 +220,7 @@ class ArmclangCCompiler(ArmclangCompiler, CCompiler):
std_opt.set_versions(['c90', 'c99', 'c11'], gnu=True)
return opts
- def get_option_compile_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
+ def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
args = []
std = self.get_compileropt_value('std', env, target, subproject)
assert isinstance(std, str)
@@ -264,7 +264,7 @@ class GnuCCompiler(GnuCStds, GnuCompiler, CCompiler):
gnu_winlibs)
return opts
- def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
+ def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
args = []
key = OptionKey('c_std', machine=self.for_machine)
std = self.get_compileropt_value(key, env, target, subproject)
@@ -388,7 +388,7 @@ class IntelCCompiler(IntelGnuLikeCompiler, CCompiler):
std_opt.set_versions(stds, gnu=True)
return opts
- def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
+ def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
args: T.List[str] = []
std = self.get_compileropt_value('std', env, target, subproject)
assert isinstance(std, str)
@@ -451,7 +451,7 @@ class VisualStudioCCompiler(MSVCCompiler, VisualStudioLikeCCompilerMixin, CCompi
std_opt.set_versions(stds, gnu=True, gnu_deprecated=True)
return opts
- def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
+ def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
args = []
std = self.get_compileropt_value('std', env, target, subproject)
@@ -473,7 +473,7 @@ class ClangClCCompiler(ClangCStds, ClangClCompiler, VisualStudioLikeCCompilerMix
full_version=full_version)
ClangClCompiler.__init__(self, target)
- def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
+ def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
std = self.get_compileropt_value('std', env, target, subproject)
assert isinstance(std, str)
if std != "none":
@@ -502,7 +502,7 @@ class IntelClCCompiler(IntelVisualStudioLikeCompiler, VisualStudioLikeCCompilerM
std_opt.set_versions(['c89', 'c99', 'c11'])
return opts
- def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
+ def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
args: T.List[str] = []
std = self.get_compileropt_value('winlibs', env, target, subproject)
assert isinstance(std, str)
@@ -536,7 +536,7 @@ class ArmCCompiler(ArmCompiler, CCompiler):
std_opt.set_versions(['c89', 'c99', 'c11'])
return opts
- def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
+ def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
args = []
std = self.get_compileropt_value('std', env, target, subproject)
assert isinstance(std, str)
@@ -569,7 +569,7 @@ class CcrxCCompiler(CcrxCompiler, CCompiler):
def get_no_stdinc_args(self) -> T.List[str]:
return []
- def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
+ def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
args = []
std = self.get_compileropt_value('std', env, target, subproject)
assert isinstance(std, str)
@@ -617,7 +617,7 @@ class Xc16CCompiler(Xc16Compiler, CCompiler):
def get_no_stdinc_args(self) -> T.List[str]:
return []
- def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
+ def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
args = []
std = self.get_compileropt_value('std', env, target, subproject)
assert isinstance(std, str)
@@ -698,7 +698,7 @@ class TICCompiler(TICompiler, CCompiler):
def get_no_stdinc_args(self) -> T.List[str]:
return []
- def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
+ def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
args = []
std = self.get_compileropt_value('std', env, target, subproject)
assert isinstance(std, str)
@@ -732,7 +732,7 @@ class MetrowerksCCompilerARM(MetrowerksCompiler, CCompiler):
self._update_language_stds(opts, ['c99'])
return opts
- def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
+ def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
args = []
std = self.get_compileropt_value('std', env, target, subproject)
assert isinstance(std, str)
@@ -760,7 +760,7 @@ class MetrowerksCCompilerEmbeddedPowerPC(MetrowerksCompiler, CCompiler):
self._update_language_stds(opts, ['c99'])
return opts
- def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
+ def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
args = []
std = self.get_compileropt_value('std', env, target, subproject)
assert isinstance(std, str)
diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py
index 3768556e6..b85751d05 100644
--- a/mesonbuild/compilers/cpp.py
+++ b/mesonbuild/compilers/cpp.py
@@ -268,17 +268,13 @@ class ClangCPPCompiler(_StdCPPLibMixin, ClangCPPStds, ClangCompiler, CPPCompiler
def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
args: T.List[str] = []
- std = self.get_compileropt_value('std', env, target, subproject)
rtti = self.get_compileropt_value('rtti', env, target, subproject)
debugstl = self.get_compileropt_value('debugstl', env, target, subproject)
eh = self.get_compileropt_value('eh', env, target, subproject)
- assert isinstance(std, str)
assert isinstance(rtti, bool)
assert isinstance(eh, str)
assert isinstance(debugstl, bool)
- if std != 'none':
- args.append(self._find_best_cpp_std(std))
non_msvc_eh_options(eh, args)
@@ -296,6 +292,14 @@ class ClangCPPCompiler(_StdCPPLibMixin, ClangCPPStds, ClangCompiler, CPPCompiler
return args
+ def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
+ args: T.List[str] = []
+ std = self.get_compileropt_value('std', env, target, subproject)
+ assert isinstance(std, str)
+ if std != 'none':
+ args.append(self._find_best_cpp_std(std))
+ return args
+
def get_option_link_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
if self.info.is_windows() or self.info.is_cygwin():
# without a typedict mypy can't understand this.
@@ -368,7 +372,7 @@ class EmscriptenCPPCompiler(EmscriptenMixin, ClangCPPCompiler):
info, linker=linker,
defines=defines, full_version=full_version)
- def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
+ def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
args: T.List[str] = []
std = self.get_compileropt_value('std', env, target, subproject)
assert isinstance(std, str)
@@ -412,7 +416,7 @@ class ArmclangCPPCompiler(ArmclangCompiler, CPPCompiler):
std_opt.set_versions(['c++98', 'c++03', 'c++11', 'c++14', 'c++17'], gnu=True)
return opts
- def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
+ def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
args: T.List[str] = []
std = self.get_compileropt_value('std', env, target, subproject)
assert isinstance(std, str)
@@ -481,19 +485,14 @@ class GnuCPPCompiler(_StdCPPLibMixin, GnuCPPStds, GnuCompiler, CPPCompiler):
def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
args: T.List[str] = []
- std = self.get_compileropt_value('std', env, target, subproject)
rtti = self.get_compileropt_value('rtti', env, target, subproject)
debugstl = self.get_compileropt_value('debugstl', env, target, subproject)
eh = self.get_compileropt_value('eh', env, target, subproject)
- assert isinstance(std, str)
assert isinstance(rtti, bool)
assert isinstance(eh, str)
assert isinstance(debugstl, bool)
- if std != 'none':
- args.append(self._find_best_cpp_std(std))
-
non_msvc_eh_options(eh, args)
if not rtti:
@@ -503,6 +502,14 @@ class GnuCPPCompiler(_StdCPPLibMixin, GnuCPPStds, GnuCompiler, CPPCompiler):
args.append('-D_GLIBCXX_DEBUG=1')
return args
+ def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
+ args: T.List[str] = []
+ std = self.get_compileropt_value('std', env, target, subproject)
+ assert isinstance(std, str)
+ if std != 'none':
+ args.append(self._find_best_cpp_std(std))
+ return args
+
def get_option_link_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
if self.info.is_windows() or self.info.is_cygwin():
# without a typedict mypy can't understand this.
@@ -634,11 +641,6 @@ class ElbrusCPPCompiler(ElbrusCompiler, CPPCompiler):
# Elbrus C++ compiler does not support RTTI, so don't check for it.
def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
args: T.List[str] = []
- std = self.get_compileropt_value('std', env, target, subproject)
- assert isinstance(std, str)
- if std != 'none':
- args.append(self._find_best_cpp_std(std))
-
eh = self.get_compileropt_value('eh', env, target, subproject)
assert isinstance(eh, str)
@@ -650,6 +652,14 @@ class ElbrusCPPCompiler(ElbrusCompiler, CPPCompiler):
args.append('-D_GLIBCXX_DEBUG=1')
return args
+ def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
+ args: T.List[str] = []
+ std = self.get_compileropt_value('std', env, target, subproject)
+ assert isinstance(std, str)
+ if std != 'none':
+ args.append(self._find_best_cpp_std(std))
+ return args
+
class IntelCPPCompiler(IntelGnuLikeCompiler, CPPCompiler):
def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool,
@@ -711,22 +721,14 @@ class IntelCPPCompiler(IntelGnuLikeCompiler, CPPCompiler):
def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
args: T.List[str] = []
- std = self.get_compileropt_value('std', env, target, subproject)
rtti = self.get_compileropt_value('rtti', env, target, subproject)
debugstl = self.get_compileropt_value('debugstl', env, target, subproject)
eh = self.get_compileropt_value('eh', env, target, subproject)
- assert isinstance(std, str)
assert isinstance(rtti, bool)
assert isinstance(eh, str)
assert isinstance(debugstl, bool)
- if std != 'none':
- remap_cpp03 = {
- 'c++03': 'c++98',
- 'gnu++03': 'gnu++98'
- }
- args.append('-std=' + remap_cpp03.get(std, std))
if eh == 'none':
args.append('-fno-exceptions')
if rtti:
@@ -735,6 +737,19 @@ class IntelCPPCompiler(IntelGnuLikeCompiler, CPPCompiler):
args.append('-D_GLIBCXX_DEBUG=1')
return args
+ def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
+ args: T.List[str] = []
+ std = self.get_compileropt_value('std', env, target, subproject)
+ assert isinstance(std, str)
+ if std != 'none':
+ remap_cpp03 = {
+ 'c++03': 'c++98',
+ 'gnu++03': 'gnu++98'
+ }
+ args.append('-std=' + remap_cpp03.get(std, std))
+
+ return args
+
def get_option_link_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
return []
@@ -801,11 +816,9 @@ class VisualStudioLikeCPPCompilerMixin(CompilerMixinBase):
def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
args: T.List[str] = []
- std = self.get_compileropt_value('std', env, target, subproject)
eh = self.get_compileropt_value('eh', env, target, subproject)
rtti = self.get_compileropt_value('rtti', env, target, subproject)
- assert isinstance(std, str)
assert isinstance(rtti, bool)
assert isinstance(eh, str)
@@ -819,14 +832,18 @@ class VisualStudioLikeCPPCompilerMixin(CompilerMixinBase):
if not rtti:
args.append('/GR-')
- permissive, ver = self.VC_VERSION_MAP[std]
+ return args
+
+ def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
+ args: T.List[str] = []
+ std = self.get_compileropt_value('std', env, target, subproject)
+ assert isinstance(std, str)
+ permissive, ver = self.VC_VERSION_MAP[std]
if ver is not None:
args.append(f'/std:c++{ver}')
-
if not permissive:
args.append('/permissive-')
-
return args
def get_compiler_check_args(self, mode: CompileCheckMode) -> T.List[str]:
@@ -840,7 +857,7 @@ class CPP11AsCPP14Mixin(CompilerMixinBase):
This is a limitation of Clang and MSVC that ICL doesn't share.
"""
- def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
+ def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
# Note: there is no explicit flag for supporting C++11; we attempt to do the best we can
# which means setting the C++ standard version to C++14, in compilers that support it
# (i.e., after VS2015U3)
@@ -854,7 +871,7 @@ class CPP11AsCPP14Mixin(CompilerMixinBase):
mlog.warning(self.id, 'does not support C++11;',
'attempting best effort; setting the standard to C++14',
once=True, fatal=False)
- original_args = super().get_option_compile_args(target, env, subproject)
+ original_args = super().get_option_std_args(target, env, subproject)
std_mapping = {'/std:c++11': '/std:c++14',
'/std:c++14': '/std:vc++14'}
processed_args = [std_mapping.get(x, x) for x in original_args]
@@ -891,12 +908,12 @@ class VisualStudioCPPCompiler(CPP11AsCPP14Mixin, VisualStudioLikeCPPCompilerMixi
cpp_stds.extend(['c++20', 'vc++20'])
return self._get_options_impl(super().get_options(), cpp_stds)
- def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
+ def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
std = self.get_compileropt_value('std', env, target, subproject)
if std != 'none' and version_compare(self.version, '<19.00.24210'):
mlog.warning('This version of MSVC does not support cpp_std arguments', fatal=False)
- args = super().get_option_compile_args(target, env, subproject)
+ args = super().get_option_std_args(target, env, subproject)
if version_compare(self.version, '<19.11'):
try:
@@ -969,7 +986,7 @@ class ArmCPPCompiler(ArmCompiler, CPPCompiler):
std_opt.set_versions(['c++03', 'c++11'])
return opts
- def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
+ def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
args: T.List[str] = []
std = self.get_compileropt_value('std', env, target, subproject)
assert isinstance(std, str)
@@ -1028,7 +1045,7 @@ class TICPPCompiler(TICompiler, CPPCompiler):
std_opt.set_versions(['c++03'])
return opts
- def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
+ def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
args: T.List[str] = []
std = self.get_compileropt_value('std', env, target, subproject)
assert isinstance(std, str)
@@ -1068,7 +1085,7 @@ class MetrowerksCPPCompilerARM(MetrowerksCompiler, CPPCompiler):
self._update_language_stds(opts, [])
return opts
- def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
+ def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
args: T.List[str] = []
std = self.get_compileropt_value('std', env, target, subproject)
assert isinstance(std, str)
@@ -1096,7 +1113,7 @@ class MetrowerksCPPCompilerEmbeddedPowerPC(MetrowerksCompiler, CPPCompiler):
self._update_language_stds(opts, [])
return opts
- def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
+ def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
args: T.List[str] = []
std = self.get_compileropt_value('std', env, target, subproject)
assert isinstance(std, str)
diff --git a/mesonbuild/compilers/cuda.py b/mesonbuild/compilers/cuda.py
index b67aa8715..509044cd4 100644
--- a/mesonbuild/compilers/cuda.py
+++ b/mesonbuild/compilers/cuda.py
@@ -663,6 +663,14 @@ class CudaCompiler(Compiler):
def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
args = self.get_ccbin_args(target, env, subproject)
+
+ try:
+ host_compiler_args = self.host_compiler.get_option_compile_args(target, env, subproject)
+ except KeyError:
+ host_compiler_args = []
+ return args + self._to_host_flags(host_compiler_args)
+
+ def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
# On Windows, the version of the C++ standard used by nvcc is dictated by
# the combination of CUDA version and MSVC version; the --std= is thus ignored
# and attempting to use it will result in a warning: https://stackoverflow.com/a/51272091/741027
@@ -670,13 +678,13 @@ class CudaCompiler(Compiler):
std = self.get_compileropt_value('std', env, target, subproject)
assert isinstance(std, str)
if std != 'none':
- args.append('--std=' + std)
+ return ['--std=' + std]
try:
- host_compiler_args = self.host_compiler.get_option_compile_args(target, env, subproject)
+ host_compiler_args = self.host_compiler.get_option_std_args(target, env, subproject)
except KeyError:
host_compiler_args = []
- return args + self._to_host_flags(host_compiler_args)
+ return self._to_host_flags(host_compiler_args)
def get_option_link_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
args = self.get_ccbin_args(target, env, subproject)
diff --git a/mesonbuild/compilers/fortran.py b/mesonbuild/compilers/fortran.py
index 088551872..0bbd7d0ef 100644
--- a/mesonbuild/compilers/fortran.py
+++ b/mesonbuild/compilers/fortran.py
@@ -285,7 +285,7 @@ class GnuFortranCompiler(GnuCompiler, FortranCompiler):
self._update_language_stds(opts, fortran_stds)
return opts
- def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
+ def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
args: T.List[str] = []
std = self.get_compileropt_value('std', env, target, subproject)
assert isinstance(std, str)
@@ -419,7 +419,7 @@ class IntelFortranCompiler(IntelGnuLikeCompiler, FortranCompiler):
self._update_language_stds(opts, ['none', 'legacy', 'f95', 'f2003', 'f2008', 'f2018'])
return opts
- def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
+ def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
args: T.List[str] = []
std = self.get_compileropt_value('std', env, target, subproject)
stds = {'legacy': 'none', 'f95': 'f95', 'f2003': 'f03', 'f2008': 'f08', 'f2018': 'f18'}
@@ -473,7 +473,7 @@ class IntelClFortranCompiler(IntelVisualStudioLikeCompiler, FortranCompiler):
self._update_language_stds(opts, ['none', 'legacy', 'f95', 'f2003', 'f2008', 'f2018'])
return opts
- def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
+ def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
args: T.List[str] = []
std = self.get_compileropt_value('std', env, target, subproject)
stds = {'legacy': 'none', 'f95': 'f95', 'f2003': 'f03', 'f2008': 'f08', 'f2018': 'f18'}
diff --git a/mesonbuild/compilers/mixins/elbrus.py b/mesonbuild/compilers/mixins/elbrus.py
index eac68bd94..7037db232 100644
--- a/mesonbuild/compilers/mixins/elbrus.py
+++ b/mesonbuild/compilers/mixins/elbrus.py
@@ -83,7 +83,7 @@ class ElbrusCompiler(GnuLikeCompiler):
# Actually it's not supported for now, but probably will be supported in future
return 'pch'
- def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
+ def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
args: T.List[str] = []
key = OptionKey(f'{self.language}_std', subproject=subproject, machine=self.for_machine)
if target:
diff --git a/mesonbuild/compilers/objc.py b/mesonbuild/compilers/objc.py
index 776f5037d..c36373f43 100644
--- a/mesonbuild/compilers/objc.py
+++ b/mesonbuild/compilers/objc.py
@@ -76,7 +76,7 @@ class GnuObjCCompiler(GnuCStds, GnuCompiler, ObjCCompiler):
self.supported_warn_args(gnu_common_warning_args) +
self.supported_warn_args(gnu_objc_warning_args))}
- def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
+ def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
args: T.List[str] = []
key = OptionKey('c_std', subproject=subproject, machine=self.for_machine)
if target:
@@ -114,7 +114,7 @@ class ClangObjCCompiler(ClangCStds, ClangCompiler, ObjCCompiler):
return 'c_std'
return super().make_option_name(key)
- def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
+ def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
args = []
key = OptionKey('c_std', machine=self.for_machine)
std = self.get_compileropt_value(key, env, target, subproject)
diff --git a/mesonbuild/compilers/objcpp.py b/mesonbuild/compilers/objcpp.py
index b38fdb60d..b1cb605e3 100644
--- a/mesonbuild/compilers/objcpp.py
+++ b/mesonbuild/compilers/objcpp.py
@@ -81,7 +81,7 @@ class GnuObjCPPCompiler(GnuCPPStds, GnuCompiler, ObjCPPCompiler):
self.supported_warn_args(gnu_common_warning_args) +
self.supported_warn_args(gnu_objc_warning_args))}
- def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
+ def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
args: T.List[str] = []
key = OptionKey('cpp_std', subproject=subproject, machine=self.for_machine)
if target:
@@ -110,7 +110,7 @@ class ClangObjCPPCompiler(ClangCPPStds, ClangCompiler, ObjCPPCompiler):
'3': default_warn_args + ['-Wextra', '-Wpedantic'],
'everything': ['-Weverything']}
- def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
+ def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
args = []
key = OptionKey('cpp_std', machine=self.for_machine)
std = self.get_compileropt_value(key, env, target, subproject)
diff --git a/mesonbuild/compilers/rust.py b/mesonbuild/compilers/rust.py
index e35c10231..53b3afbf2 100644
--- a/mesonbuild/compilers/rust.py
+++ b/mesonbuild/compilers/rust.py
@@ -255,7 +255,7 @@ class RustCompiler(Compiler):
# provided by the linker flags.
return []
- def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
+ def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
args = []
std = self.get_compileropt_value('std', env, target, subproject)
assert isinstance(std, str)
diff --git a/mesonbuild/compilers/swift.py b/mesonbuild/compilers/swift.py
index b04ccbd0e..c28e7af25 100644
--- a/mesonbuild/compilers/swift.py
+++ b/mesonbuild/compilers/swift.py
@@ -130,8 +130,7 @@ class SwiftCompiler(Compiler):
return opts
- def get_option_compile_args(self, target: build.BuildTarget, env: Environment, subproject: T.Optional[str] = None
- ) -> T.List[str]:
+ def get_option_std_args(self, target: build.BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
args: T.List[str] = []
std = self.get_compileropt_value('std', env, target, subproject)