summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2017-06-15 02:54:15 +0000
committerEric Fiselier <eric@efcs.ca>2017-06-15 02:54:15 +0000
commit954bf04d1dd3a077d4abcb15bb3a1a6bd049916a (patch)
tree712c55169fc4fedf86263d9d5f4510a437a3d95e /utils
parent8c6e35cf2c55f0605b08bd8975f50d3dfea63e06 (diff)
Add hack to get --param=enable_modules=true working with a __config_site header
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305446 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/libcxx/test/config.py20
1 files changed, 17 insertions, 3 deletions
diff --git a/utils/libcxx/test/config.py b/utils/libcxx/test/config.py
index 0fbc2cf4e..02deb8777 100644
--- a/utils/libcxx/test/config.py
+++ b/utils/libcxx/test/config.py
@@ -108,6 +108,11 @@ class Configuration(object):
return check_value(val, env_var)
return check_value(conf_val, name)
+ def get_modules_enabled(self):
+ return self.get_lit_bool('enable_modules',
+ default=False,
+ env_var='LIBCXX_ENABLE_MODULES')
+
def make_static_lib_name(self, name):
"""Return the full filename for the specified library name"""
if self.is_windows:
@@ -602,6 +607,7 @@ class Configuration(object):
return
config_site_header = os.path.join(self.libcxx_obj_root, '__config_site')
if not os.path.isfile(config_site_header):
+ assert False
return
contained_macros = self.parse_config_site_and_add_features(
config_site_header)
@@ -631,9 +637,19 @@ class Configuration(object):
# 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)
+ # 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()
+ 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':
continue
if m == '_LIBCPP_ABI_VERSION':
@@ -976,9 +992,7 @@ class Configuration(object):
if platform.system() != 'Darwin':
modules_flags += ['-Xclang', '-fmodules-local-submodule-visibility']
supports_modules = self.cxx.hasCompileFlag(modules_flags)
- enable_modules = self.get_lit_bool('enable_modules',
- default=False,
- env_var='LIBCXX_ENABLE_MODULES')
+ enable_modules = self.get_modules_enabled()
if enable_modules and not supports_modules:
self.lit_config.fatal(
'-fmodules is enabled but not supported by the compiler')