diff options
author | John Ericson <git@JohnEricson.me> | 2019-05-12 12:38:11 -0400 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2019-05-15 14:21:47 +0300 |
commit | 4030e7cb7ad54dd2df0686f41459fc6293c8284f (patch) | |
tree | e7366f78785419ad7d301fb68bc4b508fba9079e /mesonbuild/compilers/compilers.py | |
parent | 7b8ef78bc0002d0327626c6218b793f87c2a5eb8 (diff) | |
download | meson-4030e7cb7ad54dd2df0686f41459fc6293c8284f.zip meson-4030e7cb7ad54dd2df0686f41459fc6293c8284f.tar.gz meson-4030e7cb7ad54dd2df0686f41459fc6293c8284f.tar.bz2 |
UserOption no longer has a name field.
This avoids the duplication where the option is stored in a dict at its
name, and also contains its own name. In general, the maxim in
programming is things shouldn't know their own name, so removed the name
field just leaving the option's position in the dictionary as its name.
Diffstat (limited to 'mesonbuild/compilers/compilers.py')
-rw-r--r-- | mesonbuild/compilers/compilers.py | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index dacf75d..3ad80fe 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -381,35 +381,30 @@ msvc_debug_args = {False: [], ccrx_debug_args = {False: [], True: ['-debug']} -base_options = {'b_pch': coredata.UserBooleanOption('b_pch', 'Use precompiled headers', True), - 'b_lto': coredata.UserBooleanOption('b_lto', 'Use link time optimization', False), - 'b_sanitize': coredata.UserComboOption('b_sanitize', - 'Code sanitizer to use', +base_options = {'b_pch': coredata.UserBooleanOption('Use precompiled headers', True), + 'b_lto': coredata.UserBooleanOption('Use link time optimization', False), + 'b_sanitize': coredata.UserComboOption('Code sanitizer to use', ['none', 'address', 'thread', 'undefined', 'memory', 'address,undefined'], 'none'), - 'b_lundef': coredata.UserBooleanOption('b_lundef', 'Use -Wl,--no-undefined when linking', True), - 'b_asneeded': coredata.UserBooleanOption('b_asneeded', 'Use -Wl,--as-needed when linking', True), - 'b_pgo': coredata.UserComboOption('b_pgo', 'Use profile guided optimization', + 'b_lundef': coredata.UserBooleanOption('Use -Wl,--no-undefined when linking', True), + 'b_asneeded': coredata.UserBooleanOption('Use -Wl,--as-needed when linking', True), + 'b_pgo': coredata.UserComboOption('Use profile guided optimization', ['off', 'generate', 'use'], 'off'), - 'b_coverage': coredata.UserBooleanOption('b_coverage', - 'Enable coverage tracking.', + 'b_coverage': coredata.UserBooleanOption('Enable coverage tracking.', False), - 'b_colorout': coredata.UserComboOption('b_colorout', 'Use colored output', + 'b_colorout': coredata.UserComboOption('Use colored output', ['auto', 'always', 'never'], 'always'), - 'b_ndebug': coredata.UserComboOption('b_ndebug', 'Disable asserts', + 'b_ndebug': coredata.UserComboOption('Disable asserts', ['true', 'false', 'if-release'], 'false'), - 'b_staticpic': coredata.UserBooleanOption('b_staticpic', - 'Build static libraries as position independent', + 'b_staticpic': coredata.UserBooleanOption('Build static libraries as position independent', True), - 'b_pie': coredata.UserBooleanOption('b_pie', - 'Build executables as position independent', + 'b_pie': coredata.UserBooleanOption('Build executables as position independent', False), - 'b_bitcode': coredata.UserBooleanOption('b_bitcode', - 'Generate and embed bitcode (only macOS and iOS)', + 'b_bitcode': coredata.UserBooleanOption('Generate and embed bitcode (only macOS and iOS)', False), - 'b_vscrt': coredata.UserComboOption('b_vscrt', 'VS run-time library type to use.', + 'b_vscrt': coredata.UserComboOption('VS run-time library type to use.', ['none', 'md', 'mdd', 'mt', 'mtd', 'from_buildtype'], 'from_buildtype'), } @@ -1044,11 +1039,9 @@ class Compiler: description = 'Extra arguments passed to the {}'.format(self.get_display_language()) opts.update({ self.language + '_args': coredata.UserArrayOption( - self.language + '_args', description + ' compiler', [], shlex_split=True, user_input=True, allow_dups=True), self.language + '_link_args': coredata.UserArrayOption( - self.language + '_link_args', description + ' linker', [], shlex_split=True, user_input=True, allow_dups=True), }) |