[libcxx-commits] [libcxx] 1a68b5f - [libc++] Fix broken Lit features based on __config_site macros
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Fri May 15 09:26:17 PDT 2020
Author: Louis Dionne
Date: 2020-05-15T12:25:19-04:00
New Revision: 1a68b5f048c63f94b71e8aacb5507445c446c9d2
URL: https://github.com/llvm/llvm-project/commit/1a68b5f048c63f94b71e8aacb5507445c446c9d2
DIFF: https://github.com/llvm/llvm-project/commit/1a68b5f048c63f94b71e8aacb5507445c446c9d2.diff
LOG: [libc++] Fix broken Lit features based on __config_site macros
Because of Python's funny scoping rules with lambdas, we were always
using the value of `macro` as set in the last iteration of the loop.
This problem was introduced by e7bdfba4f00d.
Added:
Modified:
libcxx/utils/libcxx/test/features.py
Removed:
################################################################################
diff --git a/libcxx/utils/libcxx/test/features.py b/libcxx/utils/libcxx/test/features.py
index 969cce519fe3..b6c2ba7f9fa8 100644
--- a/libcxx/utils/libcxx/test/features.py
+++ b/libcxx/utils/libcxx/test/features.py
@@ -71,16 +71,16 @@
}
for macro, feature in macros.items():
features += [
- Feature(name=lambda cfg, feature=feature: feature + (
- '={}'.format(compilerMacros(cfg)[macro]) if compilerMacros(cfg)[macro] else ''
+ Feature(name=lambda cfg, m=macro, f=feature: f + (
+ '={}'.format(compilerMacros(cfg)[m]) if compilerMacros(cfg)[m] else ''
),
- when=lambda cfg, macro=macro: macro in compilerMacros(cfg),
+ when=lambda cfg, m=macro: m in compilerMacros(cfg),
# FIXME: This is a hack that should be fixed using module maps.
# If modules are enabled then we have to lift all of the definitions
# in <__config_site> onto the command line.
- compileFlag=lambda cfg, macro=macro: '-Wno-macro-redefined -D{}'.format(macro) + (
- '={}'.format(compilerMacros(cfg)[macro]) if compilerMacros(cfg)[macro] else ''
+ compileFlag=lambda cfg, m=macro: '-Wno-macro-redefined -D{}'.format(m) + (
+ '={}'.format(compilerMacros(cfg)[m]) if compilerMacros(cfg)[m] else ''
)
)
]
More information about the libcxx-commits
mailing list