Ensure __config_site definitions are passed to modules tests.
The test configuration contained a bug where we only raised
the __config_site commands to the command line if modules were
enabled for all of the libc++ tests. However there are special
modules-only tests, and these tests weren't getting the correct
defines.
This patch corrects that issue.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@367267 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/utils/libcxx/test/config.py b/utils/libcxx/test/config.py
index 47b8e8a..82951b7 100644
--- a/utils/libcxx/test/config.py
+++ b/utils/libcxx/test/config.py
@@ -657,19 +657,18 @@
# The __config_site header should be non-empty. Otherwise it should
# have never been emitted by CMake.
assert len(feature_macros) > 0
- # FIXME: This is a hack that should be fixed using module maps (or something)
+ # 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.
- modules_enabled = self.get_modules_enabled()
+ for m in feature_macros:
+ define = '-D%s' % m
+ if feature_macros[m]:
+ define += '=%s' % (feature_macros[m])
+ self.cxx.modules_flags += [define]
self.cxx.compile_flags += ['-Wno-macro-redefined']
# Transform each macro name into the feature name used in the tests.
# Ex. _LIBCPP_HAS_NO_THREADS -> libcpp-has-no-threads
for m in feature_macros:
- if modules_enabled:
- define = '-D%s' % m
- if feature_macros[m]:
- define += '=%s' % (feature_macros[m])
- self.cxx.compile_flags += [define]
if m == '_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS' or \
m == '_LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT':
continue
@@ -1014,7 +1013,7 @@
if os.path.isdir(module_cache):
shutil.rmtree(module_cache)
os.makedirs(module_cache)
- self.cxx.modules_flags = modules_flags + \
+ self.cxx.modules_flags += modules_flags + \
['-fmodules-cache-path=' + module_cache]
if enable_modules:
self.config.available_features.add('-fmodules')