From dacb25db101e7ede60b6ba3dd5a7d1935dc5ff73 Mon Sep 17 00:00:00 2001 From: Charles Brunet Date: Thu, 11 Jan 2024 15:20:44 -0500 Subject: 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 --- mesonbuild/compilers/objc.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'mesonbuild/compilers/objc.py') diff --git a/mesonbuild/compilers/objc.py b/mesonbuild/compilers/objc.py index f805bd6be..7c19c1b7d 100644 --- a/mesonbuild/compilers/objc.py +++ b/mesonbuild/compilers/objc.py @@ -78,15 +78,14 @@ class ClangObjCCompiler(ClangCompiler, ObjCCompiler): 'everything': ['-Weverything']} def get_options(self) -> 'coredata.MutableKeyedOptionDictType': - opts = super().get_options() - opts.update({ - OptionKey('std', machine=self.for_machine, lang='c'): coredata.UserComboOption( - 'C language standard to use', - ['none', 'c89', 'c99', 'c11', 'c17', 'gnu89', 'gnu99', 'gnu11', 'gnu17'], - 'none', - ) - }) - return opts + return self.update_options( + super().get_options(), + self.create_option(coredata.UserComboOption, + OptionKey('std', machine=self.for_machine, lang='c'), + 'C language standard to use', + ['none', 'c89', 'c99', 'c11', 'c17', 'gnu89', 'gnu99', 'gnu11', 'gnu17'], + 'none'), + ) def get_option_compile_args(self, options: 'coredata.KeyedOptionDictType') -> T.List[str]: args = [] -- cgit v1.2.3