gcc/gcc/testsuite/g++.dg/diagnostic
Jason Merrill 69dd5ca348 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.
2022-05-06 16:34:51 -04:00
..
aka1.C
aka2.C
aka3.C
aka4.C
aka5.h
aka5a.C
aka5b.C
alignof1.C
alignof2.C
alignof3.C
array-init1.C
auto-storage-1.C
auto1.C c++: DR2397 - auto specifier for * and & to arrays [PR100975] 2021-06-30 12:11:17 -04:00
bad-binary-ops.C
base-operand-non-pointer-1.C
bindings1.C
bitfld1.C
bitfld2.C
bitfld3.C
bitfld4.C
complex-invalid-1.C
conflicting-specifiers-1.C
constexpr1.C c++: extern thread_local declarations in constexpr [PR104994] 2022-03-24 10:12:25 +01:00
constexpr2.C
delete1.C
disable.C
duplicate1.C
enum1.C
enum2.C
enum3.C c++: remove redundant warning [PR100879] 2021-06-08 20:42:31 -04:00
expr1.C
extern-initialized.C
friend1.C
friend2.C
friend3.C
function-color1.C c++: add color to function decl printing 2022-05-06 16:34:51 -04:00
functional-cast-to-array-type-1.C
incomplete-type-1.C
inconsistent-deduction-1.C
inhibit-warn-1.C
inhibit-warn-2.C
integral-array-size-1.C
local1.C c++: Fix pretty printing the context of local class [PR99213] 2021-02-25 16:44:34 -05:00
long-short.C
main1.C
main2.C
maybe_unused1.C c-family: don't warn for [[maybe_unused]] on data member 2021-06-12 12:46:28 -04:00
mem-init1.C
member-decl-1.C
member-fn-1.C
method1.C
missing-default-args.C
missing-typename.C
nested-name-1.C
no-type-1.C
no-type-2.C
not-a-function-template-1.C
nullptr.C c++: Fix printing of decltype(nullptr) [PR97517] 2020-12-09 09:28:07 -05:00
out-of-class-redeclaration.C
param-type-mismatch-2.C
param-type-mismatch-3.C
param-type-mismatch.C
parm1.C
pr13981.C
pr58979.C
pr59838.C
pr60862.C
pr61004.C
pr65923.C
pr67960-2.C
pr67960.C
pr70105.C
pr71075.C
pr72803.C preprocessor/100142 - revert unwanted change in last commit 2021-04-19 14:43:39 +02:00
pr77777.C
pr77949.C
pr79300.C
pr79304.C
pr80473.C
pr84138.C
pr85464.C
pr86201.C
pr86993.C
pr87386.C
pr89390.C
pr90243.C
pr90767-1.C
pr90767-2.C
pr96045-1.C c++: EOF location [PR 96045] 2020-12-23 14:26:50 -08:00
pr96045-2.C c++: EOF location [PR 96045] 2020-12-23 14:26:50 -08:00
pr96045-3.C c++: EOF location [PR 96045] 2020-12-23 14:26:50 -08:00
pr96328.C
pr100716-1.C c++: Output less irrelevant info for function template decl [PR100716] 2021-05-27 17:00:38 -04:00
pr100716.C c++: Output less irrelevant info for function template decl [PR100716] 2021-05-27 17:00:38 -04:00
ptrtomem1.C testsuite/100272 - fix some malformed dg directives 2021-04-27 10:45:32 +02:00
ptrtomem2.C
ptrtomem3.C c++: remember pointer-to-member location 2021-11-22 17:43:10 -05:00
recur-align.C Fix diagnostic recursion ICE 2022-01-05 04:04:01 -08:00
redeclaration-1.C
redeclaration-2.C c++: Improve diagnostic for class tmpl/class redecl [PR103749] 2021-12-17 13:08:17 -05:00
ref1.C
ref2.C
ref3.C
return-type-invalid-1.C
returning-a-value-1.C
scope1.C c++: avoid redundant scope in diagnostics 2021-12-03 17:21:12 -05:00
signed-unsigned.C
static-cdtor-1.C
static_assert1.C
static_assert2.C
static_assert3.C
static_assert4.C c++: Improve error recovery with constexpr [PR92193] 2021-08-31 12:17:19 -04:00
string-literal-concat.C c++: update diagnostic messages 2021-06-08 17:54:21 -04:00
thread-thread_local.C
thread1.C
top-level-auto-1.C
trailing1.C
two-or-more-data-types-1.C
typedef-initialized.C
unclosed-extern-c.C c++: EOF location [PR 96045] 2020-12-23 14:26:50 -08:00
unclosed-function.C c++: EOF location [PR 96045] 2020-12-23 14:26:50 -08:00
unclosed-namespace.C c++: EOF location [PR 96045] 2020-12-23 14:26:50 -08:00
unclosed-struct.C c++: EOF location [PR 96045] 2020-12-23 14:26:50 -08:00
undeclared1.C c++: Add new test [PR79493] 2022-02-23 12:47:24 -05:00
using1.C c++: using in diagnostics [PR102987] 2022-04-29 09:21:32 -04:00
variably-modified-type-1.C
variadic1.C
virtual-constexpr.C
virtual-friend.C
virtual-static.C
wrong-tag-1.C