summaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/objcpp.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2024-08-29 10:22:53 -0700
committerJussi Pakkanen <jpakkane@gmail.com>2025-02-05 17:45:38 +0200
commitfe9f8de1ab52af0a6f4c3a1ce054ee3e2eb7a74c (patch)
treefe25957a1db43513a0b61183d431b498dea40013 /mesonbuild/compilers/objcpp.py
parentf0a6ba380989c68ecc5af61087157557b329f808 (diff)
downloadmeson-fe9f8de1ab52af0a6f4c3a1ce054ee3e2eb7a74c.tar.gz
compilers: remove Compiler.create_option
This saves a *tiny* bit of typing, but at the cost of requiring either the current solution of throwing up our hands and saying "typing is too hard, better to have bugs!" or an extensive amount of `TypedDict`s, `overloads`, and a very new version of mypy. Let's get our type safety back, even if it means writing a little bit more code.
Diffstat (limited to 'mesonbuild/compilers/objcpp.py')
-rw-r--r--mesonbuild/compilers/objcpp.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/mesonbuild/compilers/objcpp.py b/mesonbuild/compilers/objcpp.py
index de968be42..104d0cb82 100644
--- a/mesonbuild/compilers/objcpp.py
+++ b/mesonbuild/compilers/objcpp.py
@@ -35,6 +35,16 @@ class ObjCPPCompiler(CLikeCompiler, Compiler):
linker=linker)
CLikeCompiler.__init__(self)
+ def form_compileropt_key(self, basename: str) -> OptionKey:
+ if basename == 'std':
+ return OptionKey('cpp_std', machine=self.for_machine)
+ return super().form_compileropt_key(basename)
+
+ def make_option_name(self, key: OptionKey) -> str:
+ if key.name == 'std':
+ return 'cpp_std'
+ return super().make_option_name(key)
+
@staticmethod
def get_display_language() -> str:
return 'Objective-C++'
@@ -43,11 +53,6 @@ class ObjCPPCompiler(CLikeCompiler, Compiler):
code = '#import<stdio.h>\nclass MyClass;int main(void) { return 0; }\n'
return self._sanity_check_impl(work_dir, environment, 'sanitycheckobjcpp.mm', code)
- def form_compileropt_key(self, basename: str) -> OptionKey:
- if basename == 'std':
- return OptionKey(f'cpp_{basename}', machine=self.for_machine)
- return super().form_compileropt_key(basename)
-
def get_options(self) -> coredata.MutableKeyedOptionDictType:
opts = super().get_options()
key = self.form_compileropt_key('std')