On 2 April 2013 11:14, Jakub Jelinek <ja...@redhat.com> wrote: > > Yeah, IMHO we definitely want to support GCC_COLORS env var or similar, with > same syntax as e.g. GREP_COLORS, but with different names of the (two > letter?) color names.
The attached patch adds support for customization via GCC_COLORS following grep's implementation. Grep's manual page talks about terminfo capabilities, but the source code says that they don't use that in order to avoid adding a dependency on terminfo. So what they call capabilities is actually labels for whatever can be customized. There is no need to restrict the labels to two letters. My changes to invoke.texi explain the options in detail. The comments in diagnostics-color.c explain the choice for the default colors in detail. The comments are taken from grep's source code but they make sense in general, so I chose the same colors they use by default. An important difference from grep and ls is that setting GCC_COLORS="" disables colorization. >> This patch only allows two options enable/disable colors (and defaults >> to disabled), but grep has auto/never/always, and I can easily extend >> the patch in that way. > > IMO we also want that autodetection and default to auto. So following grep and ls, I added the following forms: -fdiagnostics-color == -fdiagnostics-color=always -fno-diagnostics-color == -fdiagnostics-color=never -fdiagnostics-color=auto In this patch the default is "never", because for some reason "auto" triggers colorization during regression testing. I have not found a way to avoid this. If we decide that we can live with it, I can simply use an explicit -fno-diagnostics-color in the testsuite like we currently do -fno-diagnostics-show-caret and set the default to auto. The auto setting disables colors for pipes/redirections and dumb terminals (like emacs). Is the patch starting to look like something that could be approved? If so, I will fix the formatting and write a changelog and submit a proper version. The testuite runs fine except for some strange errors that seem unrelated: unix//-m64: c-c++-common/asan/global-overflow-1.c -O0 output pattern test, is ==22835== ERROR: AddressSanitizer failed to allocate 0xdfff0001000 (15392894357504) bytes at address 0x02008fff7000 (12) unix//-m64: c-c++-common/asan/global-overflow-1.c -O0 output pattern test, is ==6702== ERROR: AddressSanitizer failed to allocate 0xdfff0001000 (15392894357504) bytes at address 0x02008fff7000 (12) unix//-m64: c-c++-common/asan/global-overflow-1.c -O1 output pattern test, is ==23050== ERROR: AddressSanitizer failed to allocate 0xdfff0001000 (15392894357504) bytes at address 0x02008fff7000 (12) Cheers, Manuel
color-markers-2.diff
Description: Binary data