mirror of
https://github.com/mesonbuild/meson.git
synced 2026-08-07 08:10:51 +00:00
compilers: Remove Environment parameter from Compiler.get_option_std_args
This commit is contained in:
@@ -939,7 +939,7 @@ class Backend:
|
||||
# Add compile args for c_* or cpp_* build options set on the
|
||||
# command-line or default_options inside project().
|
||||
commands += compiler.get_option_compile_args(target, self.environment, target.subproject)
|
||||
commands += compiler.get_option_std_args(target, self.environment, target.subproject)
|
||||
commands += compiler.get_option_std_args(target, target.subproject)
|
||||
|
||||
optimization = self.get_target_option(target, 'optimization')
|
||||
assert isinstance(optimization, str), 'for mypy'
|
||||
|
||||
@@ -1829,7 +1829,7 @@ class NinjaBackend(backends.Backend):
|
||||
args += cython.get_debug_args(self.get_target_option(target, 'debug'))
|
||||
args += cython.get_optimization_args(self.get_target_option(target, 'optimization'))
|
||||
args += cython.get_option_compile_args(target, self.environment, target.subproject)
|
||||
args += cython.get_option_std_args(target, self.environment, target.subproject)
|
||||
args += cython.get_option_std_args(target, target.subproject)
|
||||
args += self.build.get_global_args(cython, target.for_machine)
|
||||
args += self.build.get_project_args(cython, target.subproject, target.for_machine)
|
||||
args += target.get_extra_args('cython')
|
||||
|
||||
@@ -1034,7 +1034,7 @@ class Vs2010Backend(backends.Backend):
|
||||
file_args[l] += comp.get_option_compile_args(
|
||||
target, self.environment, target.subproject)
|
||||
file_args[l] += comp.get_option_std_args(
|
||||
target, self.environment, target.subproject)
|
||||
target, target.subproject)
|
||||
|
||||
# Add compile args added using add_project_arguments()
|
||||
for l, args in self.build.projects_args[target.for_machine].get(target.subproject, {}).items():
|
||||
|
||||
@@ -1744,7 +1744,7 @@ class XCodeBackend(backends.Backend):
|
||||
# Start with warning args
|
||||
warn_args = compiler.get_warn_args(self.get_target_option(target, 'warning_level'))
|
||||
std_args = compiler.get_option_compile_args(target, self.environment, target.subproject)
|
||||
std_args += compiler.get_option_std_args(target, self.environment, target.subproject)
|
||||
std_args += compiler.get_option_std_args(target, target.subproject)
|
||||
# Add compile args added using add_project_arguments()
|
||||
pargs = self.build.projects_args[target.for_machine].get(target.subproject, {}).get(lang, [])
|
||||
# Add compile args added using add_global_arguments()
|
||||
|
||||
@@ -128,7 +128,7 @@ class ClangCCompiler(ClangCStds, ClangCompiler, CCompiler):
|
||||
gnu_winlibs)
|
||||
return opts
|
||||
|
||||
def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
def get_option_std_args(self, target: BuildTarget, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
args = []
|
||||
std = self.get_compileropt_value('std', target, subproject)
|
||||
assert isinstance(std, str)
|
||||
@@ -213,7 +213,7 @@ class ArmclangCCompiler(ArmclangCompiler, CCompiler):
|
||||
std_opt.set_versions(['c90', 'c99', 'c11'], gnu=True)
|
||||
return opts
|
||||
|
||||
def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
def get_option_std_args(self, target: BuildTarget, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
args = []
|
||||
std = self.get_compileropt_value('std', target, subproject)
|
||||
assert isinstance(std, str)
|
||||
@@ -256,7 +256,7 @@ class GnuCCompiler(GnuCStds, GnuCompiler, CCompiler):
|
||||
gnu_winlibs)
|
||||
return opts
|
||||
|
||||
def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
def get_option_std_args(self, target: BuildTarget, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
args = []
|
||||
key = OptionKey('c_std', machine=self.for_machine)
|
||||
std = self.get_compileropt_value(key, target, subproject)
|
||||
@@ -373,7 +373,7 @@ class IntelCCompiler(IntelGnuLikeCompiler, CCompiler):
|
||||
std_opt.set_versions(stds, gnu=True)
|
||||
return opts
|
||||
|
||||
def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
def get_option_std_args(self, target: BuildTarget, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
args: T.List[str] = []
|
||||
std = self.get_compileropt_value('std', target, subproject)
|
||||
assert isinstance(std, str)
|
||||
@@ -435,7 +435,7 @@ class VisualStudioCCompiler(MSVCCompiler, VisualStudioLikeCCompilerMixin, CCompi
|
||||
std_opt.set_versions(stds, gnu=True, gnu_deprecated=True)
|
||||
return opts
|
||||
|
||||
def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
def get_option_std_args(self, target: BuildTarget, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
args = []
|
||||
std = self.get_compileropt_value('std', target, subproject)
|
||||
|
||||
@@ -456,7 +456,7 @@ class ClangClCCompiler(ClangCStds, ClangClCompiler, VisualStudioLikeCCompilerMix
|
||||
env, linker=linker, full_version=full_version)
|
||||
ClangClCompiler.__init__(self, target)
|
||||
|
||||
def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
def get_option_std_args(self, target: BuildTarget, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
std = self.get_compileropt_value('std', target, subproject)
|
||||
assert isinstance(std, str)
|
||||
if std != "none":
|
||||
@@ -484,7 +484,7 @@ class IntelClCCompiler(IntelVisualStudioLikeCompiler, VisualStudioLikeCCompilerM
|
||||
std_opt.set_versions(['c89', 'c99', 'c11'])
|
||||
return opts
|
||||
|
||||
def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
def get_option_std_args(self, target: BuildTarget, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
args: T.List[str] = []
|
||||
std = self.get_compileropt_value('std', target, subproject)
|
||||
assert isinstance(std, str)
|
||||
@@ -517,7 +517,7 @@ class ArmCCompiler(ArmCompiler, CCompiler):
|
||||
std_opt.set_versions(['c89', 'c99', 'c11'])
|
||||
return opts
|
||||
|
||||
def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
def get_option_std_args(self, target: BuildTarget, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
args = []
|
||||
std = self.get_compileropt_value('std', target, subproject)
|
||||
assert isinstance(std, str)
|
||||
@@ -550,7 +550,7 @@ class CcrxCCompiler(CcrxCompiler, CCompiler):
|
||||
def get_no_stdinc_args(self) -> T.List[str]:
|
||||
return []
|
||||
|
||||
def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
def get_option_std_args(self, target: BuildTarget, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
args = []
|
||||
std = self.get_compileropt_value('std', target, subproject)
|
||||
assert isinstance(std, str)
|
||||
@@ -598,7 +598,7 @@ class Xc16CCompiler(Xc16Compiler, CCompiler):
|
||||
def get_no_stdinc_args(self) -> T.List[str]:
|
||||
return []
|
||||
|
||||
def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
def get_option_std_args(self, target: BuildTarget, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
args = []
|
||||
std = self.get_compileropt_value('std', target, subproject)
|
||||
assert isinstance(std, str)
|
||||
@@ -693,7 +693,7 @@ class TICCompiler(TICompiler, CCompiler):
|
||||
def get_no_stdinc_args(self) -> T.List[str]:
|
||||
return []
|
||||
|
||||
def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
def get_option_std_args(self, target: BuildTarget, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
args = []
|
||||
std = self.get_compileropt_value('std', target, subproject)
|
||||
assert isinstance(std, str)
|
||||
@@ -727,7 +727,7 @@ class MetrowerksCCompilerARM(MetrowerksCompiler, CCompiler):
|
||||
self._update_language_stds(opts, ['c99'])
|
||||
return opts
|
||||
|
||||
def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
def get_option_std_args(self, target: BuildTarget, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
args = []
|
||||
std = self.get_compileropt_value('std', target, subproject)
|
||||
assert isinstance(std, str)
|
||||
@@ -755,7 +755,7 @@ class MetrowerksCCompilerEmbeddedPowerPC(MetrowerksCompiler, CCompiler):
|
||||
self._update_language_stds(opts, ['c99'])
|
||||
return opts
|
||||
|
||||
def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
def get_option_std_args(self, target: BuildTarget, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
args = []
|
||||
std = self.get_compileropt_value('std', target, subproject)
|
||||
assert isinstance(std, str)
|
||||
|
||||
@@ -635,7 +635,7 @@ class Compiler(HoldableObject, metaclass=abc.ABCMeta):
|
||||
def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
return []
|
||||
|
||||
def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
def get_option_std_args(self, target: BuildTarget, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
return []
|
||||
|
||||
def get_option_link_args(self, target: 'BuildTarget', subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
|
||||
@@ -286,7 +286,7 @@ 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]:
|
||||
def get_option_std_args(self, target: BuildTarget, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
args: T.List[str] = []
|
||||
std = self.get_compileropt_value('std', target, subproject)
|
||||
assert isinstance(std, str)
|
||||
@@ -359,7 +359,7 @@ class EmscriptenCPPCompiler(EmscriptenMixin, ClangCPPCompiler):
|
||||
ClangCPPCompiler.__init__(self, ccache, exelist, version, for_machine, env,
|
||||
linker=linker, defines=defines, full_version=full_version)
|
||||
|
||||
def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
def get_option_std_args(self, target: BuildTarget, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
args: T.List[str] = []
|
||||
std = self.get_compileropt_value('std', target, subproject)
|
||||
assert isinstance(std, str)
|
||||
@@ -402,7 +402,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_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
def get_option_std_args(self, target: BuildTarget, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
args: T.List[str] = []
|
||||
std = self.get_compileropt_value('std', target, subproject)
|
||||
assert isinstance(std, str)
|
||||
@@ -488,7 +488,7 @@ 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]:
|
||||
def get_option_std_args(self, target: BuildTarget, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
args: T.List[str] = []
|
||||
std = self.get_compileropt_value('std', target, subproject)
|
||||
assert isinstance(std, str)
|
||||
@@ -636,7 +636,7 @@ 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]:
|
||||
def get_option_std_args(self, target: BuildTarget, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
args: T.List[str] = []
|
||||
std = self.get_compileropt_value('std', target, subproject)
|
||||
assert isinstance(std, str)
|
||||
@@ -720,7 +720,7 @@ 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]:
|
||||
def get_option_std_args(self, target: BuildTarget, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
args: T.List[str] = []
|
||||
std = self.get_compileropt_value('std', target, subproject)
|
||||
assert isinstance(std, str)
|
||||
@@ -817,7 +817,7 @@ class VisualStudioLikeCPPCompilerMixin(CompilerMixinBase):
|
||||
|
||||
return args
|
||||
|
||||
def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
def get_option_std_args(self, target: BuildTarget, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
args: T.List[str] = []
|
||||
std = self.get_compileropt_value('std', target, subproject)
|
||||
assert isinstance(std, str)
|
||||
@@ -840,21 +840,21 @@ class CPP11AsCPP14Mixin(CompilerMixinBase):
|
||||
This is a limitation of Clang and MSVC that ICL doesn't share.
|
||||
"""
|
||||
|
||||
def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
def get_option_std_args(self, target: BuildTarget, 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)
|
||||
# if one is using anything before that point, one cannot set the standard.
|
||||
stdkey = self.form_compileropt_key('std').evolve(subproject=subproject)
|
||||
if target is not None:
|
||||
std = env.coredata.get_option_for_target(target, stdkey)
|
||||
std = self.environment.coredata.get_option_for_target(target, stdkey)
|
||||
else:
|
||||
std = env.coredata.optstore.get_value_for(stdkey)
|
||||
std = self.environment.coredata.optstore.get_value_for(stdkey)
|
||||
if std in {'vc++11', 'c++11'}:
|
||||
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_std_args(target, env, subproject)
|
||||
original_args = super().get_option_std_args(target, subproject)
|
||||
std_mapping = {'/std:c++11': '/std:c++14'}
|
||||
processed_args = [std_mapping.get(x, x) for x in original_args]
|
||||
return processed_args
|
||||
@@ -890,12 +890,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_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
def get_option_std_args(self, target: BuildTarget, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
std = self.get_compileropt_value('std', 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_std_args(target, env, subproject)
|
||||
args = super().get_option_std_args(target, subproject)
|
||||
|
||||
if version_compare(self.version, '<19.11'):
|
||||
try:
|
||||
@@ -967,7 +967,7 @@ class ArmCPPCompiler(ArmCompiler, CPPCompiler):
|
||||
std_opt.set_versions(['c++03', 'c++11'])
|
||||
return opts
|
||||
|
||||
def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
def get_option_std_args(self, target: BuildTarget, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
args: T.List[str] = []
|
||||
std = self.get_compileropt_value('std', target, subproject)
|
||||
assert isinstance(std, str)
|
||||
@@ -1024,7 +1024,7 @@ class TICPPCompiler(TICompiler, CPPCompiler):
|
||||
std_opt.set_versions(['c++03'])
|
||||
return opts
|
||||
|
||||
def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
def get_option_std_args(self, target: BuildTarget, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
args: T.List[str] = []
|
||||
std = self.get_compileropt_value('std', target, subproject)
|
||||
assert isinstance(std, str)
|
||||
@@ -1063,7 +1063,7 @@ class MetrowerksCPPCompilerARM(MetrowerksCompiler, CPPCompiler):
|
||||
self._update_language_stds(opts, [])
|
||||
return opts
|
||||
|
||||
def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
def get_option_std_args(self, target: BuildTarget, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
args: T.List[str] = []
|
||||
std = self.get_compileropt_value('std', target, subproject)
|
||||
assert isinstance(std, str)
|
||||
@@ -1090,7 +1090,7 @@ class MetrowerksCPPCompilerEmbeddedPowerPC(MetrowerksCompiler, CPPCompiler):
|
||||
self._update_language_stds(opts, [])
|
||||
return opts
|
||||
|
||||
def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
def get_option_std_args(self, target: BuildTarget, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
args: T.List[str] = []
|
||||
std = self.get_compileropt_value('std', target, subproject)
|
||||
assert isinstance(std, str)
|
||||
|
||||
@@ -657,7 +657,7 @@ class CudaCompiler(Compiler):
|
||||
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]:
|
||||
def get_option_std_args(self, target: BuildTarget, 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
|
||||
@@ -668,7 +668,7 @@ class CudaCompiler(Compiler):
|
||||
return ['--std=' + std]
|
||||
|
||||
try:
|
||||
host_compiler_args = self.host_compiler.get_option_std_args(target, env, subproject)
|
||||
host_compiler_args = self.host_compiler.get_option_std_args(target, subproject)
|
||||
except KeyError:
|
||||
host_compiler_args = []
|
||||
return self._to_host_flags(host_compiler_args)
|
||||
|
||||
@@ -281,7 +281,7 @@ class GnuFortranCompiler(GnuCompiler, FortranCompiler):
|
||||
self._update_language_stds(opts, fortran_stds)
|
||||
return opts
|
||||
|
||||
def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
def get_option_std_args(self, target: BuildTarget, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
args: T.List[str] = []
|
||||
std = self.get_compileropt_value('std', target, subproject)
|
||||
assert isinstance(std, str)
|
||||
@@ -411,7 +411,7 @@ class IntelFortranCompiler(IntelGnuLikeCompiler, FortranCompiler):
|
||||
self._update_language_stds(opts, ['none', 'legacy', 'f95', 'f2003', 'f2008', 'f2018'])
|
||||
return opts
|
||||
|
||||
def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
def get_option_std_args(self, target: BuildTarget, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
args: T.List[str] = []
|
||||
std = self.get_compileropt_value('std', target, subproject)
|
||||
stds = {'legacy': 'none', 'f95': 'f95', 'f2003': 'f03', 'f2008': 'f08', 'f2018': 'f18'}
|
||||
@@ -469,7 +469,7 @@ class IntelClFortranCompiler(IntelVisualStudioLikeCompiler, FortranCompiler):
|
||||
self._update_language_stds(opts, ['none', 'legacy', 'f95', 'f2003', 'f2008', 'f2018'])
|
||||
return opts
|
||||
|
||||
def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
def get_option_std_args(self, target: BuildTarget, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
args: T.List[str] = []
|
||||
std = self.get_compileropt_value('std', target, subproject)
|
||||
stds = {'legacy': 'none', 'f95': 'f95', 'f2003': 'f03', 'f2008': 'f08', 'f2018': 'f18'}
|
||||
|
||||
@@ -83,13 +83,13 @@ class ElbrusCompiler(GnuLikeCompiler):
|
||||
# Actually it's not supported for now, but probably will be supported in future
|
||||
return 'pch'
|
||||
|
||||
def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
def get_option_std_args(self, target: BuildTarget, 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:
|
||||
std = env.coredata.get_option_for_target(target, key)
|
||||
std = self.environment.coredata.get_option_for_target(target, key)
|
||||
else:
|
||||
std = env.coredata.optstore.get_value_for(key)
|
||||
std = self.environment.coredata.optstore.get_value_for(key)
|
||||
assert isinstance(std, str)
|
||||
if std != 'none':
|
||||
args.append('-std=' + std)
|
||||
|
||||
@@ -75,13 +75,13 @@ class GnuObjCCompiler(GnuCStds, GnuCompiler, ObjCCompiler):
|
||||
self.supported_warn_args(gnu_common_warning_args) +
|
||||
self.supported_warn_args(gnu_objc_warning_args))}
|
||||
|
||||
def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
def get_option_std_args(self, target: BuildTarget, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
args: T.List[str] = []
|
||||
key = OptionKey('c_std', subproject=subproject, machine=self.for_machine)
|
||||
if target:
|
||||
std = env.coredata.get_option_for_target(target, key)
|
||||
std = self.environment.coredata.get_option_for_target(target, key)
|
||||
else:
|
||||
std = env.coredata.optstore.get_value_for(key)
|
||||
std = self.environment.coredata.optstore.get_value_for(key)
|
||||
assert isinstance(std, str)
|
||||
if std != 'none':
|
||||
args.append('-std=' + std)
|
||||
@@ -113,7 +113,7 @@ class ClangObjCCompiler(ClangCStds, ClangCompiler, ObjCCompiler):
|
||||
return 'c_std'
|
||||
return super().make_option_name(key)
|
||||
|
||||
def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
def get_option_std_args(self, target: BuildTarget, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
args = []
|
||||
key = OptionKey('c_std', machine=self.for_machine)
|
||||
std = self.get_compileropt_value(key, target, subproject)
|
||||
|
||||
@@ -79,13 +79,13 @@ class GnuObjCPPCompiler(GnuCPPStds, GnuCompiler, ObjCPPCompiler):
|
||||
self.supported_warn_args(gnu_common_warning_args) +
|
||||
self.supported_warn_args(gnu_objc_warning_args))}
|
||||
|
||||
def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
def get_option_std_args(self, target: BuildTarget, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
args: T.List[str] = []
|
||||
key = OptionKey('cpp_std', subproject=subproject, machine=self.for_machine)
|
||||
if target:
|
||||
std = env.coredata.get_option_for_target(target, key)
|
||||
std = self.environment.coredata.get_option_for_target(target, key)
|
||||
else:
|
||||
std = env.coredata.optstore.get_value_for(key)
|
||||
std = self.environment.coredata.optstore.get_value_for(key)
|
||||
assert isinstance(std, str)
|
||||
if std != 'none':
|
||||
args.append('-std=' + std)
|
||||
@@ -108,7 +108,7 @@ class ClangObjCPPCompiler(ClangCPPStds, ClangCompiler, ObjCPPCompiler):
|
||||
'3': default_warn_args + ['-Wextra', '-Wpedantic'],
|
||||
'everything': ['-Weverything']}
|
||||
|
||||
def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
def get_option_std_args(self, target: BuildTarget, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
args = []
|
||||
key = OptionKey('cpp_std', machine=self.for_machine)
|
||||
std = self.get_compileropt_value(key, target, subproject)
|
||||
|
||||
@@ -329,7 +329,7 @@ class RustCompiler(Compiler):
|
||||
# provided by the linker flags.
|
||||
return []
|
||||
|
||||
def get_option_std_args(self, target: BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
def get_option_std_args(self, target: BuildTarget, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
args = []
|
||||
std = self.get_compileropt_value('std', target, subproject)
|
||||
assert isinstance(std, str)
|
||||
|
||||
@@ -128,7 +128,7 @@ class SwiftCompiler(Compiler):
|
||||
|
||||
return opts
|
||||
|
||||
def get_option_std_args(self, target: build.BuildTarget, env: Environment, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
def get_option_std_args(self, target: build.BuildTarget, subproject: T.Optional[str] = None) -> T.List[str]:
|
||||
args: T.List[str] = []
|
||||
|
||||
std = self.get_compileropt_value('std', target, subproject)
|
||||
@@ -145,7 +145,7 @@ class SwiftCompiler(Compiler):
|
||||
c_lang = first(c_langs, lambda x: x in target.compilers)
|
||||
if c_lang is not None:
|
||||
cc = target.compilers[c_lang]
|
||||
args.extend(arg for c_arg in cc.get_option_std_args(target, env, subproject) for arg in ['-Xcc', c_arg])
|
||||
args.extend(arg for c_arg in cc.get_option_std_args(target, subproject) for arg in ['-Xcc', c_arg])
|
||||
|
||||
return args
|
||||
|
||||
|
||||
@@ -231,7 +231,7 @@ class CompilerHolder(ObjectHolder['Compiler']):
|
||||
args.extend(self.compiler.get_include_args(idir, False))
|
||||
if not kwargs['no_builtin_args']:
|
||||
args += self.compiler.get_option_compile_args(None, self.interpreter.environment, self.subproject)
|
||||
args += self.compiler.get_option_std_args(None, self.interpreter.environment, self.subproject)
|
||||
args += self.compiler.get_option_std_args(None, self.subproject)
|
||||
if mode is CompileCheckMode.LINK:
|
||||
args.extend(self.compiler.get_option_link_args(None, self.subproject))
|
||||
if kwargs.get('werror', False):
|
||||
|
||||
Reference in New Issue
Block a user