aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2023-06-29 21:03:07 +0200
committerEli Schwartz <eschwartz93@gmail.com>2023-07-04 16:29:15 -0400
commit9dd5f0ae69dd663e3ac994f5808087a65934ac29 (patch)
tree6f5feceaf960a91261720671dc36d2d2562c7d7c
parent73b3b60436addbca4233073ae5e12945576bf2d4 (diff)
downloadmeson-9dd5f0ae69dd663e3ac994f5808087a65934ac29.zip
meson-9dd5f0ae69dd663e3ac994f5808087a65934ac29.tar.gz
meson-9dd5f0ae69dd663e3ac994f5808087a65934ac29.tar.bz2
compilers: strip get_define output
Fixes get_define() for MSVC. cl with /std:c11 and newer add a trailing space character when substituting, even if macro is empty. This breaks parsing preprocessed output to extract value. Since they cannot contain spaces it is safe to simply strip parsed value. Fixes: #10179
-rw-r--r--mesonbuild/compilers/mixins/clike.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/mesonbuild/compilers/mixins/clike.py b/mesonbuild/compilers/mixins/clike.py
index 2649cae..cec6b75 100644
--- a/mesonbuild/compilers/mixins/clike.py
+++ b/mesonbuild/compilers/mixins/clike.py
@@ -688,7 +688,7 @@ class CLikeCompiler(Compiler):
# Get the preprocessed value after the delimiter,
# minus the extra newline at the end and
# merge string literals.
- return self._concatenate_string_literals(p.stdout.split(delim + '\n')[-1][:-1]), cached
+ return self._concatenate_string_literals(p.stdout.split(delim + '\n')[-1][:-1]).strip(), cached
def get_return_value(self, fname: str, rtype: str, prefix: str,
env: 'Environment', extra_args: T.Optional[T.List[str]],