aboutsummaryrefslogtreecommitdiff
path: root/libcpp/line-map.c
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2017-06-09 20:57:38 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2017-06-09 20:57:38 +0000
commitb09649fdc609c79ea5acb9668636c7d8a5f64a7c (patch)
tree8ee5ecb323a5f1d30224c7950f593ad2f112c2f9 /libcpp/line-map.c
parentc5d6c6d94e74dd2f72e323ff01ad2506115ffe05 (diff)
downloadgcc-b09649fdc609c79ea5acb9668636c7d8a5f64a7c.zip
gcc-b09649fdc609c79ea5acb9668636c7d8a5f64a7c.tar.gz
gcc-b09649fdc609c79ea5acb9668636c7d8a5f64a7c.tar.bz2
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. From-SVN: r249081
Diffstat (limited to 'libcpp/line-map.c')
-rw-r--r--libcpp/line-map.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libcpp/line-map.c b/libcpp/line-map.c
index c4b7cb2..5caaf6b 100644
--- a/libcpp/line-map.c
+++ b/libcpp/line-map.c
@@ -2012,7 +2012,8 @@ rich_location::rich_location (line_maps *set, source_location loc) :
m_column_override (0),
m_have_expanded_location (false),
m_fixit_hints (),
- m_seen_impossible_fixit (false)
+ m_seen_impossible_fixit (false),
+ m_fixits_cannot_be_auto_applied (false)
{
add_range (loc, true);
}