]> git.ipfire.org Git - thirdparty/gcc.git/commit
diagnostics: improvements to experimental-html output [PR116792]
authorDavid Malcolm <dmalcolm@redhat.com>
Tue, 13 May 2025 01:45:36 +0000 (21:45 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Tue, 13 May 2025 01:45:36 +0000 (21:45 -0400)
commite4ccad8faf5266248993f7896b000ccf871ded30
treefd0ae4dffa0e0c47d20ffb806344c1a8798a2220
parentb566167b0e413d82c4f3845d0b39e382f92bc32e
diagnostics: improvements to experimental-html output [PR116792]

Add barebones support for
* diagnostic metadata rules
* quoted source
* generated patches
* execution paths

gcc/ChangeLog:
PR other/116792
* diagnostic-format-html.cc: Include "diagnostic-format-text.h",
"pretty-print-urlifier.h" and "edit-context.h".
(html_builder::html_builder): Fix indentation in decl.
(html_builder::make_element_for_diagnostic): Split out metadata
code into make_element_for_metadata.  Call
make_element_for_source, make_element_for_path, and
make_element_for_patch.
(html_builder::make_element_for_source): New.
(html_builder::make_element_for_path): New.
(html_builder::make_element_for_patch): New.
(html_builder::make_metadata_element): New.
(html_builder::make_element_for_metadata): New.
(html_output_format::get_builder): New.
(selftest::test_html_diagnostic_context::get_builder): New.
(selftest::test_simple_log): Update test to print a quoted string,
and verify that it uses a "gcc-quoted-text" span.
(selftest::test_metadata): New.
(selftest::diagnostic_format_html_cc_tests): Call it.

gcc/testsuite/ChangeLog:
PR other/116792
* gcc.dg/html-output/missing-semicolon.py: Verify that we don't
have an empty "gcc-annotated-source" and we do have a
"gcc-generated-patch".
* gcc.dg/plugin/diagnostic-test-metadata-html.c: New test.
* gcc.dg/plugin/diagnostic-test-metadata-html.py: New test script.
* gcc.dg/plugin/diagnostic-test-paths-2.c: Add
"-fdiagnostics-add-output=experimental-html" to options. Add
invocation of diagnostic-test-paths-2.py.
* gcc.dg/plugin/diagnostic-test-paths-2.py: New test script.
* gcc.dg/plugin/plugin.exp (plugin_test_list): Add
diagnostic-test-metadata-html.c.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/diagnostic-format-html.cc
gcc/testsuite/gcc.dg/html-output/missing-semicolon.py
gcc/testsuite/gcc.dg/plugin/diagnostic-test-metadata-html.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/plugin/diagnostic-test-metadata-html.py [new file with mode: 0644]
gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-2.c
gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-2.py [new file with mode: 0644]
gcc/testsuite/gcc.dg/plugin/plugin.exp