summaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/objcpp.py
diff options
context:
space:
mode:
authorCharles Brunet <charles.brunet@optelgroup.com>2024-01-11 15:20:44 -0500
committerDylan Baker <dylan@pnwbakers.com>2024-03-15 09:23:46 -0700
commitdacb25db101e7ede60b6ba3dd5a7d1935dc5ff73 (patch)
treeeef37958f0c54683829453d03d4e13bf5e02377f /mesonbuild/compilers/objcpp.py
parentd08ef2c08bb0120f0ba20dbc10575b7e15577349 (diff)
downloadmeson-dacb25db101e7ede60b6ba3dd5a7d1935dc5ff73.tar.gz
Improve error messages for invalid option values
By adding the option name to UserOption object, it is now possible to display the name of the affected option when the given option value is not valid. Fixes #12635
Diffstat (limited to 'mesonbuild/compilers/objcpp.py')
-rw-r--r--mesonbuild/compilers/objcpp.py23
1 files changed, 11 insertions, 12 deletions
diff --git a/mesonbuild/compilers/objcpp.py b/mesonbuild/compilers/objcpp.py
index baf4fb5ca..46eaa5049 100644
--- a/mesonbuild/compilers/objcpp.py
+++ b/mesonbuild/compilers/objcpp.py
@@ -77,18 +77,17 @@ class ClangObjCPPCompiler(ClangCompiler, ObjCPPCompiler):
'3': default_warn_args + ['-Wextra', '-Wpedantic'],
'everything': ['-Weverything']}
- def get_options(self) -> 'coredata.MutableKeyedOptionDictType':
- opts = super().get_options()
- opts.update({
- OptionKey('std', machine=self.for_machine, lang='cpp'): coredata.UserComboOption(
- 'C++ language standard to use',
- ['none', 'c++98', 'c++11', 'c++14', 'c++17', 'c++20', 'c++2b',
- 'gnu++98', 'gnu++11', 'gnu++14', 'gnu++17', 'gnu++20',
- 'gnu++2b'],
- 'none',
- )
- })
- return opts
+ def get_options(self) -> coredata.MutableKeyedOptionDictType:
+ return self.update_options(
+ super().get_options(),
+ self.create_option(coredata.UserComboOption,
+ OptionKey('std', machine=self.for_machine, lang='cpp'),
+ 'C++ language standard to use',
+ ['none', 'c++98', 'c++11', 'c++14', 'c++17', 'c++20', 'c++2b',
+ 'gnu++98', 'gnu++11', 'gnu++14', 'gnu++17', 'gnu++20',
+ 'gnu++2b'],
+ 'none'),
+ )
def get_option_compile_args(self, options: 'coredata.KeyedOptionDictType') -> T.List[str]:
args = []