aboutsummaryrefslogtreecommitdiff
path: root/gcc/doc
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2019-10-10 16:57:30 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2019-10-10 16:57:30 +0000
commitd26082357676a3c3843595dfe88a6c682b56e334 (patch)
tree2e7dd9497cc9cb72adfaa573f0772f25b9e0b92a /gcc/doc
parent9cfc400f3f84fb9b9cb9c3a5d4714fbea5686b62 (diff)
downloadgcc-d26082357676a3c3843595dfe88a6c682b56e334.zip
gcc-d26082357676a3c3843595dfe88a6c682b56e334.tar.gz
gcc-d26082357676a3c3843595dfe88a6c682b56e334.tar.bz2
pretty-print: support URL escape sequences (PR 87488)
https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda describes an emerging standard for embedding URLs in escape sequences for marking up text output. This is supported e.g. by recent releases of GNOME Terminal. This patch adds support to our pretty-printing framework for emitting URLs. A followup patch uses this to add URLs to the pertinent documentation for the output of -fdiagnostics-show-option. gcc/ChangeLog: PR 87488 * common.opt (fdiagnostics-urls=): New option. (diagnostic-url.h): Add SourceInclude. (diagnostic_url_rule): New enum. * diagnostic-color.c: Include "diagnostic-url.h". (diagnostic_urls_enabled_p): New function. * diagnostic-url.h: New file. * diagnostic.c: Include "diagnostic-url.h". (diagnostic_urls_init): New function. * diagnostic.h (diagnostic_urls_init): New decl. * doc/invoke.texi (Diagnostic Message Formatting Options): Add -fdiagnostics-urls to the list. (-fdiagnostics-urls): New option. * gcc.c (driver_handle_option): Handle OPT_fdiagnostics_urls_. (driver::global_initializations): Call diagnostic_urls_init. * opts-global.c (init_options_once): Likewise. * opts.c (common_handle_option): Handle OPT_fdiagnostics_urls_. * pretty-print.c (pretty_printer::pretty_printer): Initialize show_urls. (pp_begin_url): New function. (pp_end_url): New function. (selftest::test_urls): New selftest. (selftest::pretty_print_c_tests): Call it. * pretty-print.h (pretty_printer::show_urls): New field. (pp_begin_url): New decl. (pp_end_url): New decl. gcc/testsuite/ChangeLog: PR 87488 * lib/prune.exp (TEST_ALWAYS_FLAGS): Add -fdiagnostics-urls=never. From-SVN: r276841
Diffstat (limited to 'gcc/doc')
-rw-r--r--gcc/doc/invoke.texi13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 9247603..bdbcd95 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -273,6 +273,7 @@ Objective-C and Objective-C++ Dialects}.
@gccoptlist{-fmessage-length=@var{n} @gol
-fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
-fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
+-fdiagnostics-urls=@r{[}auto@r{|}never@r{|}always@r{]} @gol
-fdiagnostics-format=@r{[}text@r{|}json@r{]} @gol
-fno-diagnostics-show-option -fno-diagnostics-show-caret @gol
-fno-diagnostics-show-labels -fno-diagnostics-show-line-numbers @gol
@@ -3908,6 +3909,18 @@ SGR substring for highlighting mismatching types within template
arguments in the C++ frontend.
@end table
+@item -fdiagnostics-urls[=@var{WHEN}]
+@opindex fdiagnostics-urls
+@cindex urls
+Use escape sequences to embed URLs in diagnostics. For example, when
+@option{-fdiagnostics-show-option} emits text showing the command-line
+option controlling a diagnostic, embed a URL for documentation of that
+option.
+
+@var{WHEN} is @samp{never}, @samp{always}, or @samp{auto}.
+The default is @samp{auto}, which means to use URL escape sequences only
+when the standard error is a terminal.
+
@item -fno-diagnostics-show-option
@opindex fno-diagnostics-show-option
@opindex fdiagnostics-show-option