diff options
author | Jakub Jelinek <jakub@gcc.gnu.org> | 2013-04-12 08:19:58 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2013-04-12 08:19:58 +0200 |
commit | 4b84d650e82e29bd3ff901a1e34b08435ee99871 (patch) | |
tree | 6c0949bd9c81eb35e9a104c1b13c71602bef3a0c /gcc/doc | |
parent | 067a1e719b28b7a62d0a4c4a0732938fe45a812b (diff) | |
download | gcc-4b84d650e82e29bd3ff901a1e34b08435ee99871.zip gcc-4b84d650e82e29bd3ff901a1e34b08435ee99871.tar.gz gcc-4b84d650e82e29bd3ff901a1e34b08435ee99871.tar.bz2 |
opts.c: Include diagnostic-color.h.
* opts.c: Include diagnostic-color.h.
(common_handle_option): Handle OPT_fdiagnostics_color_.
* Makefile.in (OBJS-libcommon): Add diagnostic-color.o.
(diagnostic.o, opts.o, pretty-print.o): Depend on diagnostic-color.h.
(diagnostic-color.o): New.
* common.opt (fdiagnostics-color, fdiagnostics-color=): New options.
(diagnostic_color_rule): New enum.
* dwarf2out.c (gen_producer_string): Don't print -fdiagnostics-color*.
* langhooks.c (lhd_print_error_function): Add %r "locus" and %R around
the location string.
* diagnostic.def: Add 3rd argument to DEFINE_DIAGNOSTIC_KIND macros,
either NULL, or color kind.
* diagnostic-color.c: New file.
* diagnostic-color.h: New file.
* diagnostic-core.h (DEFINE_DIAGNOSTIC_KIND): Adjust macro for 3
arguments.
* doc/invoke.texi (-fdiagnostics-color): Document.
* pretty-print.h (pp_show_color): Define.
(struct pretty_print_info): Add show_color field.
* diagnostic.c: Include diagnostic-color.h.
(diagnostic_build_prefix): Adjust for 3 argument DEFINE_DIAGNOSTIC_KIND
macros. Colorize error:, warning: etc. strings and also the location
string.
(diagnostic_show_locus): Colorize the caret line.
* pretty-print.c: Include diagnostic-color.h.
(pp_base_format): Handle %r and %R format specifiers. Colorize strings
inside of %< %> quotes or quoted through q format modifier.
c-family/
* c-format.c (gcc_diag_char_table, gcc_tdiag_char_table,
gcc_cdiag_char_table, gcc_cxxdiag_char_table): Add %r and %R format
specifiers.
cp/
* error.c (cp_print_error_function,
print_instantiation_partial_context_line,
maybe_print_constexpr_context): Colorize locus strings.
From-SVN: r197841
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/invoke.texi | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 1652ebc..30445ec 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -226,6 +226,7 @@ Objective-C and Objective-C++ Dialects}. @xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}. @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 -fno-diagnostics-show-option -fno-diagnostics-show-caret} @item Warning Options @@ -2956,6 +2957,76 @@ messages reporter to emit the same source location information (as prefix) for physical lines that result from the process of breaking a message which is too long to fit on a single line. +@item -fdiagnostics-color[=@var{WHEN}] +@itemx -fno-diagnostics-color +@opindex fdiagnostics-color +@cindex highlight, color, colour +@vindex GCC_COLORS @r{environment variable} +Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always}, +or @samp{auto}. The default is @samp{never}, @samp{auto} means to use color +only when the standard error is a terminal. The forms +@option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are +aliases for @option{-fdiagnostics-color=always} and +@option{-fdiagnostics-color=never}, respectively. + +The colors are defined by the environment variable @env{GCC_COLORS}. +Its value is a colon-separated list of capabilities and Select Graphic +Rendition (SGR) substrings. SGR commands are interpreted by the +terminal or terminal emulator. (See the section in the documentation +of your text terminal for permitted values and their meanings as +character attributes.) These substring values are integers in decimal +representation and can be concatenated with semicolons. +Common values to concatenate include +@samp{1} for bold, +@samp{4} for underline, +@samp{5} for blink, +@samp{7} for inverse, +@samp{39} for default foreground color, +@samp{30} to @samp{37} for foreground colors, +@samp{90} to @samp{97} for 16-color mode foreground colors, +@samp{38;5;0} to @samp{38;5;255} +for 88-color and 256-color modes foreground colors, +@samp{49} for default background color, +@samp{40} to @samp{47} for background colors, +@samp{100} to @samp{107} for 16-color mode background colors, +and @samp{48;5;0} to @samp{48;5;255} +for 88-color and 256-color modes background colors. + +The default @env{GCC_COLORS} is +@samp{error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01} +where @samp{01;31} is bold red, @samp{01;35} is bold magenta, +@samp{01;36} is bold cyan, @samp{01;32} is bold green and +@samp{01} is bold. Setting @env{GCC_COLORS} to the empty +string disables colors. +Supported capabilities are as follows. + +@table @code +@item error= +@vindex error GCC_COLORS @r{capability} +SGR substring for error: markers. + +@item warning= +@vindex warning GCC_COLORS @r{capability} +SGR substring for warning: markers. + +@item note= +@vindex note GCC_COLORS @r{capability} +SGR substring for note: markers. + +@item caret= +@vindex caret GCC_COLORS @r{capability} +SGR substring for caret line. + +@item locus= +@vindex locus GCC_COLORS @r{capability} +SGR substring for location information, @samp{file:line} or +@samp{file:line:column} etc. + +@item quote= +@vindex quote GCC_COLORS @r{capability} +SGR substring for information printed within quotes. +@end table + @item -fno-diagnostics-show-option @opindex fno-diagnostics-show-option @opindex fdiagnostics-show-option |