This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: color diagnostics markers


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]