r249081 - in /trunk: gcc/ChangeLog gcc/diagnost...

dmalcolm@gcc.gnu.org dmalcolm@gcc.gnu.org
Fri Jun 9 20:57:00 GMT 2017


Author: dmalcolm
Date: Fri Jun  9 20:57:38 2017
New Revision: 249081

URL: https://gcc.gnu.org/viewcvs?rev=249081&root=gcc&view=rev
Log:
Add support for mutually-incompatible fix-it hints

This patch adds a method:
  rich_location::fixits_cannot_be_auto_applied
for ensuring that mutually-incompatible fix-its hints don't
lead to insane output from -fdiagnostics-generate-patch.

Fix-it hints within such rich_location instances are printed
as normal by diagnostic_show_locus, but don't affect the output
of -fdiagnostics-generate-patch.

gcc/ChangeLog:
	* diagnostic.c (diagnostic_report_diagnostic): Only add fixits
	to the edit_context if they can be auto-applied.

gcc/testsuite/ChangeLog:
	* gcc.dg/plugin/diagnostic-test-show-locus-bw.c
	(test_mutually_exclusive_suggestions): New test function.
	* gcc.dg/plugin/diagnostic-test-show-locus-generate-patch.c
	(test_mutually_exclusive_suggestions): New test function.
	* gcc.dg/plugin/diagnostic-test-show-locus-parseable-fixits.c
	(test_mutually_exclusive_suggestions): New test function.
	* gcc.dg/plugin/diagnostic_plugin_test_show_locus.c
	(test_show_locus): Add special-case for
	"test_mutually_exclusive_suggestions".

libcpp/ChangeLog:
	* include/line-map.h
	(rich_location::fixits_cannot_be_auto_applied): New method.
	(rich_location::fixits_can_be_auto_applied_p): New accessor.
	(rich_location::m_fixits_cannot_be_auto_applied): New field.
	* line-map.c (rich_location::rich_location): Initialize new field.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/diagnostic.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus-bw.c
    trunk/gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus-generate-patch.c
    trunk/gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus-parseable-fixits.c
    trunk/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_show_locus.c
    trunk/libcpp/ChangeLog
    trunk/libcpp/include/line-map.h
    trunk/libcpp/line-map.c



More information about the Gcc-cvs mailing list