https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80271

            Bug ID: 80271
           Summary: Support environment variable CLICOLOR_FORCE to enable
                    -fdiagnostics-color
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: driver
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jhasse at bixense dot com
  Target Milestone: ---

When piping gcc, colored output gets disabled because isatty returns false. But
for many people this is the normal way of running gcc, as most build systems
(e. g. ninja or Waf) and build servers (e. g. Drone or Jenkins) pipe it to
print its output delayed. In these cases ANSI colors would still work though
and therefore many people set -fdiagnostics-color=always (see
https://github.com/KDE/extra-cmake-modules/commit/dc525a42ae70a68d67aa49d6453d4b6de4ecb561
for example).

It would be nice, if there would be a better way to auto detect that case. An
environment variable would be a good choice, as build tools, build servers or
IDEs with ANSI escape code support can set it.

The name CLICOLOR_FORCE was chosen, because it is already used by some tools
and a unified naming for this would be nice. See https://bixense.com/clicolors/

(A flag like -fdiagnostics-color also has the disadvantage that changes trigger
a complete rebuild in most build system although the flag doesn't influence the
object code output.)

Reply via email to