From a935eeef5028dfc1999aab40577f97a455c091c7 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Fri, 6 Sep 2024 09:24:43 -0700 Subject: compilers/clang: split the Std handling for C++ out of the ClangCPPCompiler We'll want to use this for the ObjC++ compiler too. --- mesonbuild/compilers/cpp.py | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'mesonbuild/compilers/cpp.py') diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py index d2eca897b..31a1c93e0 100644 --- a/mesonbuild/compilers/cpp.py +++ b/mesonbuild/compilers/cpp.py @@ -27,7 +27,7 @@ from .mixins.arm import ArmCompiler, ArmclangCompiler from .mixins.visualstudio import MSVCCompiler, ClangClCompiler from .mixins.gnu import GnuCompiler, gnu_common_warning_args, gnu_cpp_warning_args from .mixins.intel import IntelGnuLikeCompiler, IntelVisualStudioLikeCompiler -from .mixins.clang import ClangCompiler +from .mixins.clang import ClangCompiler, ClangCPPStds from .mixins.elbrus import ElbrusCompiler from .mixins.pgi import PGICompiler from .mixins.emscripten import EmscriptenMixin @@ -218,10 +218,7 @@ class _StdCPPLibMixin(CompilerMixinBase): raise MesonException('Could not detect either libc++ or libstdc++ as your C++ stdlib implementation.') -class ClangCPPCompiler(_StdCPPLibMixin, ClangCompiler, CPPCompiler): - - _CPP23_VERSION = '>=12.0.0' - _CPP26_VERSION = '>=17.0.0' +class ClangCPPCompiler(_StdCPPLibMixin, ClangCPPStds, ClangCompiler, CPPCompiler): def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', @@ -239,7 +236,7 @@ class ClangCPPCompiler(_StdCPPLibMixin, ClangCompiler, CPPCompiler): 'everything': ['-Weverything']} def get_options(self) -> 'MutableKeyedOptionDictType': - opts = CPPCompiler.get_options(self) + opts = super().get_options() self.update_options( opts, self.create_option(options.UserComboOption, @@ -256,16 +253,6 @@ class ClangCPPCompiler(_StdCPPLibMixin, ClangCompiler, CPPCompiler): 'STL debug mode', False), ) - cppstd_choices = [ - 'c++98', 'c++03', 'c++11', 'c++14', 'c++17', 'c++1z', 'c++2a', 'c++20', - ] - if version_compare(self.version, self._CPP23_VERSION): - cppstd_choices.append('c++23') - if version_compare(self.version, self._CPP26_VERSION): - cppstd_choices.append('c++26') - std_opt = opts[self.form_compileropt_key('std')] - assert isinstance(std_opt, options.UserStdOption), 'for mypy' - std_opt.set_versions(cppstd_choices, gnu=True) if self.info.is_windows() or self.info.is_cygwin(): self.update_options( opts, -- cgit v1.2.3