This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFC: color diagnostics markers
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Manuel López-Ibáñez <lopezibanez at gmail dot com>
- Cc: Gabriel Dos Reis <gdr at integrable-solutions dot net>, "Joseph S. Myers" <joseph at codesourcery dot com>, Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 8 Apr 2013 16:43:59 +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>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Mon, Apr 08, 2013 at 04:29:02PM +0200, Manuel López-Ibáñez wrote:
> In fact, I would be fine with something like:
>
> pp_start_color()
> pp_stop_color()
> pp_wrap_in_color("")
>
> It is a bit more verbose, but also clearer when reading the code. And
> no need for %[colorname] or %r or -Wformat support.
But you then need to break the code into multiple function calls, which
decreases readability.
pp_verbatim (context->printer,
_("%s:%d:%d: [ skipping %d instantiation contexts, "
"use -ftemplate-backtrace-limit=0 to disable ]\n"),
xloc.file, xloc.line, xloc.column, skip);
can be right now a single call, while you would need several. Also, if you
eventually want to colorize something in say error_at, warning_at and
similar format strings. For those you really don't have the printer at
hand, and can't easily break it into multiple calls. The reason for %r/%R
instead of the %[ in the patch is that I think it will be easier to teach
-Wformat and gettext about it that way, rather than if the argument is
embedded in between [ and ]. With %r/%R it would be:
pp_verbatim (context->printer,
_("%r%s:%d:%d:%R [ skipping %d instantiation contexts, "
"use -ftemplate-backtrace-limit=0 to disable ]\n"),
"locus", xloc.file, xloc.line, xloc.column, skip);
Jakub