mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-13 22:33:03 +00:00
diagnostics: support --color=html
Based on a message from Bruno Haible. https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=commitdiff;h=fe18e92743b7226791a5f28d7c786941a1bf8cc9 This does not generate proper HTML: special characters are not escaped for instance. This is a hidden feature meant for Bison developers, not end users. * src/complain.c (complain_init_color): Support --color=html.
This commit is contained in:
@@ -252,6 +252,7 @@ complain_init_color (void)
|
|||||||
{
|
{
|
||||||
#if HAVE_LIBTEXTSTYLE
|
#if HAVE_LIBTEXTSTYLE
|
||||||
if (color_mode == color_yes
|
if (color_mode == color_yes
|
||||||
|
|| color_mode == color_html
|
||||||
|| (color_mode == color_tty && isatty (STDERR_FILENO)))
|
|| (color_mode == color_tty && isatty (STDERR_FILENO)))
|
||||||
{
|
{
|
||||||
style_file_prepare ("BISON_DIAGNOSTICS_STYLE", NULL,
|
style_file_prepare ("BISON_DIAGNOSTICS_STYLE", NULL,
|
||||||
@@ -268,9 +269,25 @@ complain_init_color (void)
|
|||||||
style_file_name = NULL;
|
style_file_name = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Workaround clang's warning (starting at Clang 3.5) about the stub
|
||||||
|
code of html_styled_ostream_create:
|
||||||
|
|
||||||
|
| src/complain.c:274:7: error: code will never be executed [-Werror,-Wunreachable-code]
|
||||||
|
| ? html_styled_ostream_create (file_ostream_create (stderr),
|
||||||
|
| ^~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
||||||
|
#if defined __clang__
|
||||||
|
# pragma clang diagnostic push
|
||||||
|
# pragma clang diagnostic ignored "-Wunreachable-code"
|
||||||
|
#endif
|
||||||
errstream =
|
errstream =
|
||||||
styled_ostream_create (STDERR_FILENO, "(stderr)", TTYCTL_AUTO,
|
color_mode == color_html
|
||||||
style_file_name);
|
? html_styled_ostream_create (file_ostream_create (stderr),
|
||||||
|
style_file_name)
|
||||||
|
: styled_ostream_create (STDERR_FILENO, "(stderr)", TTYCTL_AUTO,
|
||||||
|
style_file_name);
|
||||||
|
#if defined __clang__
|
||||||
|
# pragma clang diagnostic pop
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
Reference in New Issue
Block a user