summaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/cpp.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2024-09-06 09:24:43 -0700
committerDylan Baker <dylan@pnwbakers.com>2025-01-27 09:37:59 -0800
commita935eeef5028dfc1999aab40577f97a455c091c7 (patch)
tree535b17529a8fc550f9b2280bbee6c12954a2af05 /mesonbuild/compilers/cpp.py
parentd309e8d5f7ef4503bc493f498cae46129323f93b (diff)
downloadmeson-a935eeef5028dfc1999aab40577f97a455c091c7.tar.gz
compilers/clang: split the Std handling for C++ out of the ClangCPPCompiler
We'll want to use this for the ObjC++ compiler too.
Diffstat (limited to 'mesonbuild/compilers/cpp.py')
-rw-r--r--mesonbuild/compilers/cpp.py19
1 files changed, 3 insertions, 16 deletions
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,