aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2016-08-26 17:59:08 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2016-08-26 17:59:08 +0000
commitd41e76cf758505ba1bc22ca88cf6d1f626298def (patch)
tree02630a9ec5362c89f24cf23ab93aa7cc50a1f297 /gcc/testsuite/gcc.dg
parent524a4c966c0e8f719887e7b84b5e1c7686e8872d (diff)
downloadgcc-d41e76cf758505ba1bc22ca88cf6d1f626298def.zip
gcc-d41e76cf758505ba1bc22ca88cf6d1f626298def.tar.gz
gcc-d41e76cf758505ba1bc22ca88cf6d1f626298def.tar.bz2
Tweak to colors of fix-it hints
Previous, fix-it hints were printed using the color of the severity of the diagnostic (magenta for warnings, red for errors, cyan for notes). This patch updates fix-it hints so that replacement text is printed in green, to better distinguish the suggested improvement from the current code. For example: spellcheck-fields.cc:52:13: error: 'struct s' has no member named 'colour'; did you mean 'color'? return ptr->colour; <<< RED ^~~~~~ <<< RED color <<< GREEN It makes sense for the underlinings that indicate deletions to be printed in red, so the patch changes that also. For example: diagnostic-test-show-locus-color.c:179:9: warning: example of a removal hint int a;; <<< MAGENTA ^ <<< MAGENTA - <<< RED gcc/ChangeLog: * diagnostic-color.c (color_dict): Add "fixit-insert" and "fixit-delete". (parse_gcc_colors): Update description of default GCC_COLORS. * diagnostic-show-locus.c (colorizer::set_fixit_hint): Delete. (colorizer::set_fixit_insert): New method. (colorizer::set_fixit_delete): New method. (colorizer::get_color_by_name): New method. (colorizer::STATE_FIXIT_INSERT): New constant. (colorizer::STATE_FIXIT_DELETE): New constant. (class colorizer): Drop "_cs" suffix from fields. Delete "_ce" fields in favor of new field "m_stop_color". Add fields "m_fixit_insert" and "m_fixit_delete". (colorizer::colorizer): Update for above changes. Replace colorize_start calls with calls to get_color_by_name. (colorizer::begin_state): Handle STATE_FIXIT_INSERT and STATE_FIXIT_DELETE. Update for field renamings. (colorizer::finish_state): Simplify by using m_stop_color, rather than multiple identical "*_ce" fields. (colorizer::get_color_by_name): New method. (layout::print_any_fixits): Print insertions and replacements using the "fixit-insert" color, and deletions using the "fixit-delete" color. * doc/invoke.texi (-fdiagnostics-color): Update description of default GCC_COLORS, and of the supported capabilities. gcc/testsuite/ChangeLog: * gcc.dg/plugin/diagnostic-test-show-locus-color.c (test_fixit_insert): Update expected output. (test_fixit_remove): Likewise. (test_fixit_replace): Likewise. From-SVN: r239787
Diffstat (limited to 'gcc/testsuite/gcc.dg')
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus-color.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus-color.c b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus-color.c
index ff2f4d4..712375e 100644
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus-color.c
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus-color.c
@@ -161,7 +161,7 @@ void test_fixit_insert (void)
/* { dg-begin-multiline-output "" }
int a[2][2] = { 0, 1 , 2, 3 };
^~~~
- { }
+ { }
{ dg-end-multiline-output "" } */
#endif
}
@@ -175,7 +175,7 @@ void test_fixit_remove (void)
/* { dg-begin-multiline-output "" }
int a;;
^
- -
+ -
{ dg-end-multiline-output "" } */
#endif
}
@@ -189,7 +189,7 @@ void test_fixit_replace (void)
/* { dg-begin-multiline-output "" }
gtk_widget_showall (dlg);
^~~~~~~~~~~~~~~~~~
- gtk_widget_show_all
+ gtk_widget_show_all
{ dg-end-multiline-output "" } */
#endif
}