This is the mail archive of the
mailing list for the GCC project.
Re: RFC: color diagnostics markers
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- Cc: Manuel López-Ibáñez <lopezibanez at gmail dot com>, "Joseph S. Myers" <joseph at codesourcery dot com>, Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 11 Apr 2013 07:55:57 +0200
- Subject: Re: RFC: color diagnostics markers
- References: <CAESRpQCG6VX4JTEXLhrV2LDCLENYB7i8ad-3jj=K6FGeuK5+Ug at mail dot gmail dot com> <20130402091449 dot GE20616 at tucnak dot redhat dot com> <CAESRpQAiDrn-9T7Zxvs2ZQVT9hE9_X=gnEyDkS7Y4b-vOiz3Cg at mail dot gmail dot com> <20130408132301 dot GO20334 at tucnak dot redhat dot com> <CAESRpQAz45k2SYVcEDn_oVkUuLVtGqChHRdgS0NQW5dVgrveLw at mail dot gmail dot com> <20130408144359 dot GP20334 at tucnak dot redhat dot com> <CAESRpQBXecse09cZ55_EhDzQno4K5Tid+N5beMG0JdOBLmLGJQ at mail dot gmail dot com> <20130408190620 dot GQ20334 at tucnak dot redhat dot com> <CAESRpQBKcq+7UmPN-TXWwQfz6WG-R+M1X-41fWjYfzgLUUOW2Q at mail dot gmail dot com> <CAAiZkiCFaoiZrMoC=SjF27PORt=XvKA9-JUkume5M5a36H9bAA at mail dot gmail dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Wed, Apr 10, 2013 at 09:04:06PM -0500, Gabriel Dos Reis wrote:
> We might be saying the same thing using different languages.
> I was the %r/%R markers are ways of implementing the IL language
> I suggested in that message. So, as such I do not object to it.
> Having an explicit call makes the FE makes a "colorful" formatting
> decision way too early -- a FE shouldn't be concerned about color matters.
> That decision should be left to the device doing the formatting. Separation
> of concerns here isn't just taste; it is good engineering practice.
But the decision is left to the device doing the formatting.
The %r/%R only says, this text in between is of this kind (locus, quote
(well, that is automatically done by the patch also for %</%> and %qs etc.),
etc.), and we either color that using GCC_COLORS (or default) defined color
if requested through command line option and terminal supports it, or we
As discussed earlier, alternative to the current uses of %r/%R in the
sources would be %U (first and only letter from locus that is still available)
which would take location_t and would perform on it:
expanded_location el = expand_location (va_arg (ap, location_t));
pp_string (pp, colorize_start (pp_show_color (pp), "locus"));
pp_string (pp, el.file);
pp_decimal_int (pp, el.line);
if (context->show_column && el.column)
pp_decimal_int (pp, el.column);
pp_string (pp, colorize_stop (pp_show_color (pp)));
or so. But I wonder if we won't need %r/%R in the future, or add more and
more formatting codes, say if we wanted to highlight something that isn't
to be quoted around, or some substring inside quotes. With %r/%R we have
the flexibility to do so easily, with just %U we don't.