[libcxx-commits] [PATCH] D65004: [libc++] Unconditionally enable module tests when they're supported

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jul 19 11:11:04 PDT 2019


ldionne created this revision.
ldionne added a reviewer: EricWF.
Herald added subscribers: libcxx-commits, dexonsmith, jkorous, christof.
Herald added a project: libc++.

I don't see the point in allowing the modules tests to be disabled when
the compiler supports them, and in enabling the modules tests when the
compiler doesn't support them (which is currently an error in lit anyway).

This commit solves the problem that if the compiler supports modules but
enable_modules=True is not passed explicitly to lit, the command-line
defines from __config_site won't be populated properly and the tests
will fail.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D65004

Files:
  libcxx/utils/libcxx/test/config.py


Index: libcxx/utils/libcxx/test/config.py
===================================================================
--- libcxx/utils/libcxx/test/config.py
+++ libcxx/utils/libcxx/test/config.py
@@ -112,11 +112,6 @@
             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:
@@ -666,16 +661,14 @@
         # 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]
+            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
@@ -1007,10 +1000,6 @@
         if platform.system() != 'Darwin':
             modules_flags += ['-Xclang', '-fmodules-local-submodule-visibility']
         supports_modules = self.cxx.hasCompileFlag(modules_flags)
-        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')
         if not supports_modules:
             return
         self.config.available_features.add('modules-support')
@@ -1022,9 +1011,8 @@
         os.makedirs(module_cache)
         self.cxx.modules_flags = modules_flags + \
             ['-fmodules-cache-path=' + module_cache]
-        if enable_modules:
-            self.config.available_features.add('-fmodules')
-            self.cxx.useModules()
+        self.config.available_features.add('-fmodules')
+        self.cxx.useModules()
 
     def configure_substitutions(self):
         sub = self.config.substitutions


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65004.210869.patch
Type: text/x-patch
Size: 2730 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190719/e1f7015d/attachment.bin>


More information about the libcxx-commits mailing list