3.7 Options to Control Diagnostic Messages Formatting
Traditionally, diagnostic messages have been formatted irrespective of the output device's aspect (e.g. its width, ...
). You can use the options described below to control the formatting algorithm for diagnostic messages, e.g. how many characters per line, how often source location information should be reported. Note that some language front ends may not honor these options.
Try to format error messages so that they fit on lines of about n
characters. If n
is zero, then no line-wrapping is done; each error message appears on a single line. This is the default for all front ends.
Only meaningful in line-wrapping mode. Instructs the diagnostic messages reporter to emit source location information once
; that is, in case the message is too long to fit on a single physical line and has to be wrapped, the source location won't be emitted (as prefix) again, over and over, in subsequent continuation lines. This is the default behavior.
- Only meaningful in line-wrapping mode. Instructs the diagnostic 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.
Use color in diagnostics. WHEN
’, or ‘
’. The default depends on how the compiler has been configured, it can be any of the above WHEN
options or also ‘
environment variable isn't present in the environment, and ‘
’ otherwise. ‘
’ means to use color only when the standard error is a terminal.
are aliases for
The colors are defined by the environment variable
. 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 ‘
’ for bold, ‘
’ for underline, ‘
’ for blink, ‘
’ for inverse, ‘
’ for default foreground color, ‘
’ to ‘
foreground colors, ‘
’ to ‘
’ for 16-color mode foreground colors, ‘
’ to ‘
’ for 88-color and 256-color modes foreground colors, ‘
’ for default background color, ‘
’ to ‘
’ for background colors, ‘
’ to ‘
’ for 16-color mode background colors, and ‘
’ to ‘
’ for 88-color and 256-color modes background colors.
’ is bold red, ‘
’ is bold magenta, ‘
’ is bold cyan, ‘
’ is bold green and ‘
’ is bold. Setting
to the empty string disables colors. Supported capabilities are as follows.
SGR substring for error: markers.
SGR substring for warning: markers.
SGR substring for note: markers.
SGR substring for caret line.
SGR substring for location information, ‘
’ or ‘
SGR substring for information printed within quotes.
By default, each diagnostic emitted includes text indicating the command-line option that directly controls the diagnostic (if such an option is known to the diagnostic machinery). Specifying the
flag suppresses that behavior.
By default, each diagnostic emitted includes the original source line and a caret ‘
’ indicating the column. This option suppresses this information. The source line is truncated to n
characters, if the
option is given. When the output is done to the terminal, the width is limited to the width given by the
environment variable or, if not set, to the terminal width.