[ccache] Support for color diagnostics
interfasys at gmail.com
Mon Feb 17 17:25:08 MST 2014
I've just tested the patch with a patched gcc48 with -fdiagnostics-color support
on FreeBSD 9 and it works with one exception.
GCC's documentations says:
"‘auto’ means to use color only when the standard error is a terminal"
So, if my understanding is correct, this means that, when using
-fdiagnostics-color=auto , I should be seeing colours when using the
terminal and indeed, that's the normal behaviour when ccache falls back to
the compiler (I see colours).
With that patch, I don't see the colours in auto mode. It only works in
On Friday, November 29, 2013 12:39:25 PM UTC+1, Lubos Lunak wrote:
> the attached patch adds ccache support for compiler color diagnostics
> reported by somebody as #10075).
> Clang automatically uses colors for output automatically if used in
> Ccache's redirecting to a file disables this. GCC 4.8 has got a similar
> support, except that it apparently requires also $GCC_COLORS or an
> The patch detects if the compiler would use colors if used without ccache
> explicitly forces an option to achieve this. Note that I do not have GCC
> here, so I tested with Clang's alias and the GCC_COLORS support is done
> on documentation.
> - GCC developers decided to roll their own name for the option when
> introducing it. Clang has an alias for the GCC way, but versions predating
> that obviously can't support it, so it's necessary to detect the compiler.
> ccache doesn't do that (and I don't find it worth much effort, as it can't
> 100% reliable anyway), the code merely guesses from the binary name. If
> compiler used will be e.g. the 'cc' symlink, there'll be no colors. No big
> - Since the stderr is different, obviously compiling with and without
> has different results as well. That means that such a compile
> is "duplicated". It's hopefully not such a common case, although it's
> perfectly possible. I don't know if it's worth the effort to try to be
> here. A possibly simple improvement could be to search the cache with and
> without the option set and if stderr is empty, reuse the result regardless
> the option. I'm not quite sure where exactly this should happen in the
> I expect it'd make sense to add $CCACHE_NOCOLORS to disable this support?
> I can also create manpage section for this color support, but I first
> to check here with the code.
> Lubos Lunak
More information about the ccache