On Mon, 13 Dec 2021 at 19:22, Martin Sebor <mse...@gmail.com> wrote:

> On 12/11/21 10:39 PM, Jason Merrill via Gcc-patches wrote:
> > In reading C++ diagnostics, it's often hard to find the name of the
> function
> > in the middle of the template header, return type, parameters, and
> template
> > arguments.  So let's colorize it, and maybe the template argument
> bindings
> > while we're at it.
> >
> > I've somewhat arbitrarily chosen bold green for the function name, and
> > non-bold magenta for the template arguments.  I'm not at all attached to
> > these choices.
> >
> > A side-effect is that when this happens in a quote (i.e. %qD), the
> > rest of the quote after the function name is no longer bold.  I think
> that's
> > acceptable; returning to the bold would require maintaining a colorize
> stack
> > instead of the on/off controls we have now.
> >
> > Any thoughts?
>
> I appreciate the problem but I can't say I find this solution
> much of an improvement.  We end up with the same name in up to
> four colors: cyan, magenta, green, and black, plus bold versions
> of each, depending on where in the text the name appears.  It's
> not apparent to me what the different colors mean or how they
> help.
>

They break up the wall of text. You don't have to know what they mean to be
able to see where one chunk of text ends and another begins (in a different
colour). The colours don't *mean* anything, they're just a way to
distinguish different logical parts of the output.



> IMO, the underlying root cause for why relevant details are so
> hard to find in G++ messages is that there's so much redundancy
> and irrelevant context in the output.  For instance, for this
> test case:
>
> #include <map>
>
> std::map<const char*, const char*> m ("123", "456");
>
>
For this example, I think putting the [with T = ...; U = ...] template
arguments in a different colours helps a lot. It delineates the end of the
signature and the start of the template args, which helps navigate the wall
of text.

I don't think anybody can argue that it's easier when the [with T = ...]
part is just a continuation of the text before it. Making it a different
colour doesn't necessarily make the errors easier to understand if you're
not familiar with the code or GCC's diagnostic format, but I definitely
think it makes it easier to navigate. And that should make it easier to
figure out what the error is saying.

Reply via email to