aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/compilers.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2021-02-17 11:44:17 -0800
committerJussi Pakkanen <jpakkane@gmail.com>2021-02-19 17:16:42 +0200
commit90a7de3f2ba4b0510c2341346645eb7989376b62 (patch)
tree2d68d2e78fc89d8eef3a517c936e67676436242d /mesonbuild/compilers/compilers.py
parent91e56c7d59650445ad2f868dfb552cfbeed53796 (diff)
downloadmeson-90a7de3f2ba4b0510c2341346645eb7989376b62.zip
meson-90a7de3f2ba4b0510c2341346645eb7989376b62.tar.gz
meson-90a7de3f2ba4b0510c2341346645eb7989376b62.tar.bz2
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
Diffstat (limited to 'mesonbuild/compilers/compilers.py')
-rw-r--r--mesonbuild/compilers/compilers.py28
1 files changed, 12 insertions, 16 deletions
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