c++: add color to function decl printing
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.
A side-effect of this 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.
gcc/cp/ChangeLog:
* error.cc (decl_to_string): Add show_color parameter.
(subst_to_string): Likewise.
(cp_printer): Pass it.
(type_to_string): Set pp_show_color.
(dump_function_name): Use "fnname" color.
(dump_template_bindings): Use "targs" color.
(struct colorize_guard): New.
(reinit_cxx_pp): Clear pp_show_color.
gcc/ChangeLog:
* diagnostic-color.cc: Add fnname and targs color entries.
* doc/invoke.texi: Document them.
gcc/testsuite/ChangeLog:
* g++.dg/diagnostic/function-color1.C: New test.