From 90a7de3f2ba4b0510c2341346645eb7989376b62 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Wed, 17 Feb 2021 11:44:17 -0800 Subject: Ensure that $lang_args and $lang_link_args are properly parsed Currently we don't handle things correctly if we get a string we should split, and the linker and needs compiler arguments. It would result in two unsplit strings in a list, instead of the split arguments in a list Fixes: #8348 --- mesonbuild/compilers/compilers.py | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'mesonbuild/compilers/compilers.py') diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index a4823e2..a37e4da 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -1227,22 +1227,18 @@ def get_global_options(lang: str, argkey = OptionKey('args', lang=lang, machine=for_machine) largkey = argkey.evolve('link_args') - # We shouldn't need listify here, but until we have a separate - # linker-driver representation and can have that do the combine we have to - # do it this way. - compile_args = mesonlib.listify(env.options.get(argkey, [])) - link_args = mesonlib.listify(env.options.get(largkey, [])) - + cargs = coredata.UserArrayOption( + description + ' compiler', + env.options.get(argkey, []), split_args=True, user_input=True, allow_dups=True) + largs = coredata.UserArrayOption( + description + ' linker', + env.options.get(largkey, []), split_args=True, user_input=True, allow_dups=True) + + # This needs to be done here, so that if we have string values in the env + # options that we can safely combine them *after* they've been split if comp.INVOKES_LINKER: - link_args = compile_args + link_args - - opts: 'KeyedOptionDictType' = { - argkey: coredata.UserArrayOption( - description + ' compiler', - compile_args, split_args=True, user_input=True, allow_dups=True), - largkey: coredata.UserArrayOption( - description + ' linker', - link_args, split_args=True, user_input=True, allow_dups=True), - } + largs.set_value(largs.value + cargs.value) + + opts: 'KeyedOptionDictType' = {argkey: cargs, largkey: largs} return opts -- cgit v1.1