[Bug c/85433] -fdiagnostics-color=auto doesn't work properly with LTO
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Apr 17 13:40:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85433
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
If you use -save-temps -v and rerun the lto1 invocation printed in there, it is
colored.
The way -fdiagnostics-color=auto works is it verifies TERM is not dumb and that
isatty (2).
The problem with LTO is that the latter is not the case, collect2 creates a
file
instead lderrout = make_temp_file (".le"); and uses that as stderr of the
linker which is what becomes stderr of lto1 too.
Dunno why we need to use files for there, if that is the case, perhaps either
collect2 or gcc driver should for -flto linking and -fdiagnostics-color=auto
(or if that is the default, for lack of -fdiagnostics-color too) check whether
the stderr is a terminal and if yes, pass -fdiagnostics-color=always instead.
More information about the Gcc-bugs
mailing list