[all-commits] [llvm/llvm-project] da0a7d: Add support for the NO_COLOR environment variable

Aaron Ballman via All-commits all-commits at lists.llvm.org
Wed Jun 7 08:55:35 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: da0a7d5cfb0c65bcb54a1ba5ed6c93bb906648e4
      https://github.com/llvm/llvm-project/commit/da0a7d5cfb0c65bcb54a1ba5ed6c93bb906648e4
  Author: Aaron Ballman <aaron at aaronballman.com>
  Date:   2023-06-07 (Wed, 07 Jun 2023)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/docs/UsersManual.rst
    M clang/lib/Frontend/CompilerInvocation.cpp
    A clang/test/Driver/no-color.c

  Log Message:
  -----------
  Add support for the NO_COLOR environment variable

Clang currently supports disabling color diagnostic output via
-fno-color-diagnostics. However, there is a somewhat long-standing push
to support use of an environment variable to override color output so
that users can set up their terminal such that most color output is
disabled (largely for accessibility reasons).

There are two competing de facto standards to accomplish this:
  NO_COLOR (https://no-color.org/) and
  CLICOLOR/CLICOLOR_FORCE (http://bixense.com/clicolors/).

This patch adds support for NO_COLOR as that appears to be the more
commonly supported feature, at least when comparing issues and pull
requests:
https://github.com/search?q=NO_COLOR&type=issues (2.2k issues, 35k pull requests)
https://github.com/search?q=CLICOLOR&type=issues (1k issues, 3k pull requests)

It's also the more straightforward and thoroughly-specified of the two
options. If NO_COLOR is present as an environment variable (regardless
of value), color output is suppressed unless the command line specifies
use of color output (command line takes precedence over the environment
variable).

Differential Revision: https://reviews.llvm.org/D152285




More information about the All-commits mailing list