diff options
author | David Malcolm <dmalcolm@redhat.com> | 2016-09-02 19:41:17 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2016-09-02 19:41:17 +0000 |
commit | 717ebe91c97c37f92ffb5a80a68eb1f6a965fce0 (patch) | |
tree | 1c48b3da48c0d917939aeb557e3ff941f07bf978 /gcc/doc/invoke.texi | |
parent | 9dc5773f4b529dd0fefffaf2a2bf9b9ff0195edd (diff) | |
download | gcc-717ebe91c97c37f92ffb5a80a68eb1f6a965fce0.zip gcc-717ebe91c97c37f92ffb5a80a68eb1f6a965fce0.tar.gz gcc-717ebe91c97c37f92ffb5a80a68eb1f6a965fce0.tar.bz2 |
Add -fdiagnostics-generate-patch
gcc/ChangeLog:
* common.opt (fdiagnostics-generate-patch): New option.
* diagnostic.c: Include "edit-context.h".
(diagnostic_initialize): Initialize context->edit_context_ptr.
(diagnostic_finish): Delete context->edit_context_ptr.
(diagnostic_report_diagnostic): Add fix-it hints from the
diagnostic to context->edit_context_ptr, if any.
* diagnostic.h (class edit_context): Add forward decl.
(struct diagnostic_context): Add field "edit_context_ptr".
* doc/invoke.texi (Diagnostic Message Formatting Options): Add
-fdiagnostics-generate-patch.
(-fdiagnostics-generate-patch): New item.
* toplev.c: Include "edit-context.h".
(process_options): Set global_dc->edit_context_ptr to a new
edit_context if the options need one.
(toplev::main): Handle -fdiagnostics-generate-patch by using
global_dc->edit_context_ptr.
gcc/testsuite/ChangeLog:
* gcc.dg/plugin/diagnostic-test-show-locus-generate-patch.c: New
test case.
* gcc.dg/plugin/plugin.exp (plugin_test_list): Add
diagnostic-test-show-locus-generate-patch.c to the sources
for diagnostic_plugin_test_show_locus.c.
From-SVN: r239965
Diffstat (limited to 'gcc/doc/invoke.texi')
-rw-r--r-- | gcc/doc/invoke.texi | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 986ab43..73aab7c 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -248,7 +248,7 @@ Objective-C and Objective-C++ Dialects}. -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol --fdiagnostics-parseable-fixits} +-fdiagnostics-parseable-fixits -fdiagnostics-generate-patch} @item Warning Options @xref{Warning Options,,Options to Request or Suppress Warnings}. @@ -3460,6 +3460,27 @@ An empty replacement string indicates that the given range is to be removed. An empty range (e.g. ``45:3-45:3'') indicates that the string is to be inserted at the given position. +@item -fdiagnostics-generate-patch +@opindex fdiagnostics-generate-patch +Print fix-it hints to stderr in unified diff format, after any diagnostics +are printed. For example: + +@smallexample +--- test.c ++++ test.c +@@ -42,5 +42,5 @@ + + void show_cb(GtkDialog *dlg) + @{ +- gtk_widget_showall(dlg); ++ gtk_widget_show_all(dlg); + @} + +@end smallexample + +The diff may or may not be colorized, following the same rules +as for diagnostics (see @option{-fdiagnostics-color}). + @end table @node Warning Options |