summaryrefslogtreecommitdiff
path: root/gcc/common.opt
diff options
context:
space:
mode:
authordmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>2016-06-22 14:42:30 +0000
committerdmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>2016-06-22 14:42:30 +0000
commit6628b04dc8d15c0e3b9b20c5ba87e976896826f1 (patch)
tree8d46c6412fd67294b9c6633443b3ccd90df9a278 /gcc/common.opt
parentd870a45eb30ff9b0c8044cf7ae2abe7965c9b66b (diff)
downloadgcc-6628b04dc8d15c0e3b9b20c5ba87e976896826f1.tar.gz
Implement -fdiagnostics-parseable-fixits
gcc/ChangeLog: * common.opt (fdiagnostics-parseable-fixits): New option. * diagnostic.c: Include "selftest.h". (print_escaped_string): New function. (print_parseable_fixits): New function. (diagnostic_report_diagnostic): Call print_parseable_fixits. (selftest::assert_print_escaped_string): New function. (ASSERT_PRINT_ESCAPED_STRING_STREQ): New macro. (selftest::test_print_escaped_string): New function. (selftest::test_print_parseable_fixits_none): New function. (selftest::test_print_parseable_fixits_insert): New function. (selftest::test_print_parseable_fixits_remove): New function. (selftest::test_print_parseable_fixits_replace): New function. (selftest::diagnostic_c_tests): New function. * diagnostic.h (struct diagnostic_context): Add field "parseable_fixits_p". * doc/invoke.texi (Diagnostic Message Formatting Options): Add -fdiagnostics-parseable-fixits. (-fdiagnostics-parseable-fixits): New option. * opts.c (common_handle_option): Handle -fdiagnostics-parseable-fixits. * selftest-run-tests.c (selftest::run_tests): Call selftest::diagnostic_c_tests. * selftest.h (selftest::diagnostic_c_tests): New prototype. gcc/testsuite/ChangeLog: * gcc.dg/plugin/diagnostic-test-show-locus-parseable-fixits.c: New file. * gcc.dg/plugin/plugin.exp (plugin_test_list): Add diagnostic-test-show-locus-parseable-fixits.c to sources for diagnostic_plugin_test_show_locus.c. * lib/gcc-defs.exp (freeform_regexps): New global. (dg-regexp): New function. (handle-dg-regexps): New function. * lib/gcc-dg.exp (cleanup-after-saved-dg-test): Reset freeform_regexps to the empty list. * lib/prune.exp (prune_gcc_output): Call handle-dg-regexps. libcpp/ChangeLog: * include/line-map.h (fixit_hint::get_start_loc): New pure virtual function. (fixit_hint::maybe_get_end_loc): Likewise. (fixit_insert::get_start_loc): New function, implementing fixit_hint::get_start_loc. (fixit_insert::maybe_get_end_loc): New function, implementing fixit_hint::maybe_get_end_loc. (fixit_remove::get_start_loc): New function, implementing fixit_hint::get_start_loc. (fixit_remove::maybe_get_end_loc): New function, implementing fixit_hint::maybe_get_end_loc. (fixit_replace::get_start_loc): New function, implementing fixit_hint::get_start_loc. (fixit_replace::maybe_get_end_loc): New function, implementing fixit_hint::maybe_get_end_loc. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@237712 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/common.opt')
-rw-r--r--gcc/common.opt4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/common.opt b/gcc/common.opt
index f0d71966cdf..5d90385eaea 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -1185,6 +1185,10 @@ Enum(diagnostic_color_rule) String(always) Value(DIAGNOSTICS_COLOR_YES)
EnumValue
Enum(diagnostic_color_rule) String(auto) Value(DIAGNOSTICS_COLOR_AUTO)
+fdiagnostics-parseable-fixits
+Common Var(flag_diagnostics_parseable_fixits)
+Print fixit hints in machine-readable form.
+
fdiagnostics-show-option
Common Var(flag_diagnostics_show_option) Init(1)
Amend appropriate diagnostic messages with the command line option that controls them.