From 0e11b90d6f2f9c3e18cb8ff84b1622640666e826 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Thu, 29 Aug 2024 09:47:39 -0700 Subject: options: use dataclasses for UserOption This reduces code, makes this clearer, and will be a nice step toward the goal of getting everything typesafe. For `UserIntegerOption` this makes a fairly nice, but substantial change in that the old method used a tuple of `(min, value, max)` to pass to the initializer, while all other types just passed `value`. The new `UserIntegerOption` does the same, with keyword arguments for the min and max values. --- mesonbuild/compilers/cpp.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'mesonbuild/compilers/cpp.py') diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py index b17e18b3e..7fa9aa833 100644 --- a/mesonbuild/compilers/cpp.py +++ b/mesonbuild/compilers/cpp.py @@ -242,8 +242,8 @@ class ClangCPPCompiler(_StdCPPLibMixin, ClangCPPStds, ClangCompiler, CPPCompiler opts[key] = options.UserComboOption( self.make_option_name(key), 'C++ exception handling type.', - ['none', 'default', 'a', 's', 'sc'], - 'default') + 'default', + ['none', 'default', 'a', 's', 'sc']) key = self.form_compileropt_key('rtti') opts[key] = options.UserBooleanOption( @@ -398,8 +398,8 @@ class ArmclangCPPCompiler(ArmclangCompiler, CPPCompiler): opts[key] = options.UserComboOption( self.make_option_name(key), 'C++ exception handling type.', - ['none', 'default', 'a', 's', 'sc'], - 'default') + 'default', + ['none', 'default', 'a', 's', 'sc']) key = self.form_compileropt_key('std') std_opt = opts[key] @@ -448,8 +448,8 @@ class GnuCPPCompiler(_StdCPPLibMixin, GnuCPPStds, GnuCompiler, CPPCompiler): opts[key] = options.UserComboOption( self.make_option_name(key), 'C++ exception handling type.', - ['none', 'default', 'a', 's', 'sc'], - 'default') + 'default', + ['none', 'default', 'a', 's', 'sc']) key = self.form_compileropt_key('rtti') opts[key] = options.UserBooleanOption( @@ -577,8 +577,8 @@ class ElbrusCPPCompiler(ElbrusCompiler, CPPCompiler): opts[key] = options.UserComboOption( self.make_option_name(key), 'C++ exception handling type.', - ['none', 'default', 'a', 's', 'sc'], - 'default') + 'default', + ['none', 'default', 'a', 's', 'sc']) key = self.form_compileropt_key('debugstl') opts[key] = options.UserBooleanOption( @@ -660,8 +660,8 @@ class IntelCPPCompiler(IntelGnuLikeCompiler, CPPCompiler): opts[key] = options.UserComboOption( self.make_option_name(key), 'C++ exception handling type.', - ['none', 'default', 'a', 's', 'sc'], - 'default') + 'default', + ['none', 'default', 'a', 's', 'sc']) key = self.form_compileropt_key('rtti') opts[key] = options.UserBooleanOption( @@ -753,8 +753,8 @@ class VisualStudioLikeCPPCompilerMixin(CompilerMixinBase): opts[key] = options.UserComboOption( self.make_option_name(key), 'C++ exception handling type.', - ['none', 'default', 'a', 's', 'sc'], - 'default') + 'default', + ['none', 'default', 'a', 's', 'sc']) key = self.form_compileropt_key('rtti') opts[key] = options.UserBooleanOption( -- cgit v1.2.3