[libcxx-commits] [libcxx] 7e6221d - [libc++] Remove unused functions and minor features of the test suite

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue May 5 06:59:09 PDT 2020


Author: Louis Dionne
Date: 2020-05-05T09:58:36-04:00
New Revision: 7e6221da104b3daa3e0fb57796f9d925a4215b4f

URL: https://github.com/llvm/llvm-project/commit/7e6221da104b3daa3e0fb57796f9d925a4215b4f
DIFF: https://github.com/llvm/llvm-project/commit/7e6221da104b3daa3e0fb57796f9d925a4215b4f.diff

LOG: [libc++] Remove unused functions and minor features of the test suite

This commit removes minor features of the test suite that I've never
seen used and that are basically just a maintenance burden:

- color_diagnostics: Diagnostics are colored by default when running
  from a terminal, and not colored otherwise. This is the right behavior.
  Being able to tweak this has minor value, and could be achieved by
  modifying the %{compile_flags} instead if absolutely needed.

- ccache: This can be achieved by using a wrapper for the %{cxx}
  substitution.

- _dump_macros_verbose is just a dead function now.

Added: 
    

Modified: 
    libcxx/docs/TestingLibcxx.rst
    libcxx/utils/libcxx/test/config.py

Removed: 
    


################################################################################
diff  --git a/libcxx/docs/TestingLibcxx.rst b/libcxx/docs/TestingLibcxx.rst
index 26dfefccdec8..78134bca8f84 100644
--- a/libcxx/docs/TestingLibcxx.rst
+++ b/libcxx/docs/TestingLibcxx.rst
@@ -188,12 +188,6 @@ default.
   Run the tests using the given sanitizer. If LLVM_USE_SANITIZER was given when
   building libc++ then that sanitizer will be used by default.
 
-.. option:: color_diagnostics
-
-  Enable the use of colorized compile diagnostics. If the color_diagnostics
-  option is specified or the environment variable LIBCXX_COLOR_DIAGNOSTICS is
-  present then color diagnostics will be enabled.
-
 .. option:: llvm_unwinder
 
   Enable the use of LLVM unwinder instead of libgcc.
@@ -211,12 +205,6 @@ Environment Variables
   Specify the site configuration to use when running the tests.
   Also see `libcxx_site_config`.
 
-.. envvar:: LIBCXX_COLOR_DIAGNOSTICS
-
-  If ``LIBCXX_COLOR_DIAGNOSTICS`` is defined then the test suite will attempt
-  to use color diagnostic outputs from the compiler.
-  Also see `color_diagnostics`.
-
 Writing Tests
 -------------
 

diff  --git a/libcxx/utils/libcxx/test/config.py b/libcxx/utils/libcxx/test/config.py
index 09a7a5f71ced..8369a94f1321 100644
--- a/libcxx/utils/libcxx/test/config.py
+++ b/libcxx/utils/libcxx/test/config.py
@@ -131,11 +131,9 @@ def configure(self):
         self.configure_obj_root()
         self.configure_cxx_stdlib_under_test()
         self.configure_cxx_library_root()
-        self.configure_ccache()
         self.configure_compile_flags()
         self.configure_link_flags()
         self.configure_env()
-        self.configure_color_diagnostics()
         self.configure_debug_mode()
         self.configure_warnings()
         self.configure_sanitizer()
@@ -222,10 +220,6 @@ def configure_cxx(self):
         self.cxx = CXXCompiler(self, cxx) if not self.cxx_is_clang_cl else \
                    self._configure_clang_cl(cxx)
         self.cxx.compile_env = dict(os.environ)
-        # 'CCACHE_CPP2' prevents ccache from stripping comments while
-        # preprocessing. This is required to prevent stripping of '-verify'
-        # comments.
-        self.cxx.compile_env['CCACHE_CPP2'] = '1'
 
     def _configure_clang_cl(self, clang_path):
         def _split_env_var(var):
@@ -245,17 +239,6 @@ def _prefixed_env_list(var, prefix):
                            compile_flags=compile_flags,
                            link_flags=link_flags)
 
-    def _dump_macros_verbose(self, *args, **kwargs):
-        macros_or_error = self.cxx.dumpMacros(*args, **kwargs)
-        if isinstance(macros_or_error, tuple):
-            cmd, out, err, rc = macros_or_error
-            report = libcxx.util.makeReport(cmd, out, err, rc)
-            report += "Compiler failed unexpectedly when dumping macros!"
-            self.lit_config.fatal(report)
-            return None
-        assert isinstance(macros_or_error, dict)
-        return macros_or_error
-
     def configure_src_root(self):
         self.libcxx_src_root = self.get_lit_conf(
             'libcxx_src_root', os.path.dirname(self.config.test_source_root))
@@ -315,13 +298,6 @@ def configure_cxx_stdlib_under_test(self):
             if self.get_lit_conf('enable_experimental') is None:
                 self.config.enable_experimental = 'true'
 
-    def configure_ccache(self):
-        use_ccache_default = os.environ.get('LIBCXX_USE_CCACHE') is not None
-        use_ccache = self.get_lit_bool('use_ccache', use_ccache_default)
-        if use_ccache:
-            self.cxx.use_ccache = True
-            self.lit_config.note('enabling ccache')
-
     def configure_features(self):
         additional_features = self.get_lit_conf('additional_features')
         if additional_features:
@@ -666,25 +642,6 @@ def configure_extra_library_flags(self):
             self.cxx.link_flags += ['-lc++external_threads']
         self.target_info.add_cxx_link_flags(self.cxx.link_flags)
 
-    def configure_color_diagnostics(self):
-        use_color = self.get_lit_conf('color_diagnostics')
-        if use_color is None:
-            use_color = os.environ.get('LIBCXX_COLOR_DIAGNOSTICS')
-        if use_color is None:
-            return
-        if use_color != '':
-            self.lit_config.fatal('Invalid value for color_diagnostics "%s".'
-                                  % use_color)
-        color_flag = '-fdiagnostics-color=always'
-        # Check if the compiler supports the color diagnostics flag. Issue a
-        # warning if it does not since color diagnostics have been requested.
-        if not self.cxx.hasCompileFlag(color_flag):
-            self.lit_config.warning(
-                'color diagnostics have been requested but are not supported '
-                'by the compiler')
-        else:
-            self.cxx.flags += [color_flag]
-
     def configure_debug_mode(self):
         debug_level = self.get_lit_conf('debug_level', None)
         if not debug_level:


        


More information about the libcxx-commits mailing list