Re: [PATCH] diagnostics: fix build on hosts where unsigned == size_t

2025-08-09 Thread David Malcolm
On Sat, 2025-08-09 at 00:39 +0100, Sam James wrote: > Sam James writes: > > > David Malcolm writes: > > > > > [...] > > > Test bootstrap on x86_64 in progress.  Is there an easy way to > > > force > > > the bootstrap to use 32-bit? >

[PATCH] diagnostics: fix build on hosts where unsigned == size_t

2025-08-08 Thread David Malcolm
Looks like I broke the build with r16-3091-gac4e7455a33237 on hosts where unsigned == size_t. ../../gcc/gcc/diagnostics/dumping.cc:98:1: error: redefinition of ‘void diagnostics::dumping::emit_field(FILE*, int, const char*, T) [with T = unsigned int; FILE = FILE]’ 98 | emit_field (FILE *outfi

[pushed: r16-3089] diagnostics: update signature of some callbacks

2025-08-08 Thread David Malcolm
No functional change intended. Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r16-3089-gd7d0ea918fad92. gcc/cp/ChangeLog: * error.cc (cp_adjust_diagnostic_info): Convert "context" arg from ptr to const &. gcc/ChangeLog: * diagnostics/con

[pushed: r16-3090] diagnostics: minor cleanups

2025-08-08 Thread David Malcolm
No functional change intended. Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r16-3090-gf14fee14d440cf. gcc/ChangeLog: * diagnostic.h (diagnostics::get_cwe_url): Move decl to diagnostics/metadata.h. (diagnostics::maybe_line_and_column): M

[pushed: r16-3091] diagnostics: revamp of dumping of "diagnostics" internal state

2025-08-08 Thread David Malcolm
ast (i)), m_count_for_kind[i]); none = false; } if (none) -fprintf (out, "%*s(none)\n", indent + 2, ""); +dumping::emit_none (out, indent + 2); } void diff --git a/gcc/diagnostics/dumping.cc b/gcc/diagnostics/dumping.cc new file mode 1

[pushed: r16-3092] diagnostics: enable nested diagnostics by default [PR116253]

2025-08-08 Thread David Malcolm
In GCC 15 I added an experimental nesting view in text sinks for hierarchical diagnostics, such as C++ template problems. This patch enables it for text sinks by default. The old behavior can be restored via -fno-diagnostics-show-nesting, which the patch also adds to -fdiagnostics-plain-output.

[pushed: r16-3088] diagnostics: introduce struct column_options

2025-08-08 Thread David Malcolm
Consolidate 3 fields in diagnostics::context and diagnostics::column_policy into a new struct diagnostics::column_options. No functional change intended; reduces the number of public fields in diagnostics::context. Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as

[pushed: r16-2766] diagnostics: improve support for nesting levels [PR116253]

2025-08-04 Thread David Malcolm
This patch adds support to sarif-replay for "nestingLevel" from "P3358R0 SARIF for Structured Diagnostics" https://wg21.link/P3358R0 Doing so revealed a bug where libgdiagnostics was always creating new location_t values (and thus also diagnostic_physical_location instances), rather than reusing e

[pushed: r16-2765] diagnostics: avoid stray trailing space in html sink in sarif-replay [PR116792]

2025-08-04 Thread David Malcolm
For the common case where a diagnostic has no metadata, sarif-replay's html output was adding a stray space followed by an empty for the metadata. Fixed thusly. Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r16-2765-g0fb30003867635. gcc/ChangeLog: PR

[pushed: r16-2767] optinfo: use enum class

2025-08-04 Thread David Malcolm
Modernization; no functional change intended. Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r16-2767-gb963237a903f73. gcc/ChangeLog: * dump-context.h: Convert "enum optinfo_item_kind" into "enum class kind" within class optinfo_item. * d

[pushed: r16-2763] diagnostics: split source_printing_options out into its own header

2025-08-04 Thread David Malcolm
No functional change intended. Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r16-2763-g7dea2582b3a5e4. gcc/ChangeLog: * diagnostics/context.h: Split struct source_printing_options out into "diagnostics/source-printing-options.h" and include it.

[pushed: r16-2762] diagnostics: rename option_manager to option_id_manager and split out from context.h

2025-08-04 Thread David Malcolm
This patch splits out class option_manager to its own header, and renames it to class option_id_manager to better describe its purpose. No functional change intended. Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r16-2762-g268ec60da01c67. gcc/ChangeLog:

[pushed: r16-2764] diagnostics: move diagnostics::counters to its own header

2025-08-04 Thread David Malcolm
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r16-2764-g74f59bf10dfef1. gcc/ChangeLog: * diagnostics/context.h: Move struct counters to its own header and include it. * diagnostics/counters.h: New file, from the above. --- gcc/diagnostic

[pushed: r16-2761] diagnostics: fix comment in buffering.h

2025-08-04 Thread David Malcolm
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r16-2761-g3cff171b243f4d. gcc/ChangeLog: * diagnostics/buffering.h: Update comment to refer to output sinks rather than output formats. Signed-off-by: David Malcolm --- gcc/diagnostics/bufferi

[pushed: r16-2760] gimple-warn-recursion.cc: add missing auto_diagnostic_group

2025-08-04 Thread David Malcolm
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r16-2760-gc125e86853a23b. gcc/ChangeLog: * gimple-warn-recursion.cc (pass_warn_recursion::execute): Add missing auto_diagnostic_group. Signed-off-by: David Malcolm --- gcc/gimple-warn-recursio

Re: [RFC] c++: Optimize out dynamic_cast call when target is final [PR63164]

2025-07-28 Thread David Malcolm
On Mon, 2025-07-28 at 16:50 +, Thomas de Bock wrote: > This patch optimizes out calls to __dynamic_cast when the type being > cast to is final (or its destructor), replacing them with a simple > comparison of the types' vtable addresses. This is already > implemented and done by default in clan

Re: [PATCH] restore bootstrap with --enable-checking=release (PR libgdiagnostics/121260)

2025-07-28 Thread David Malcolm
On Mon, 2025-07-28 at 13:44 +0200, Mikael Pettersson wrote: > Current trunk doesn't bootstrap with --enable-checking=release > due to improper nesting of namespaces and #if CHECKING_P blocks. Sorry about this. > This corrects that. Thanks for the fix; I've pushed it as r16-2586-g1f36aabfe81aa1.

Re: [PATCH v7] Provide new option -fdiagnostics-show-context=N for -Warray-bounds, -Wstringop-* warnings [PR109071,PR85788,PR88771,PR106762,PR108770,PR115274,PR117179]

2025-07-25 Thread David Malcolm
On Wed, 2025-07-23 at 20:01 +, Qing Zhao wrote: > Hi, > > This is the 7th version of the patches for fixing PR109071. I just pushed a big reorganization of GCC's diagnostics subsystem to trunk as r16-2520-g6d9152659f4f6a through r16-2553-gbae1f7e29816b9: [PATCH 00/34] Introduce "gcc/diagnos

[PATCH 33/34] diagnostics: avoid using "sink" for things that aren't a diagnostics::sink

2025-07-25 Thread David Malcolm
No functional change intended. gcc/ChangeLog: * diagnostic.h: Use TextOrHtml rather than Sink for template params. * diagnostics/context.h: Likewise. * diagnostics/selftest-context.cc: Use "html_or_text" rather than "sink". * diagnostics/source-print

[PATCH 28/34] diagnostics: eliminate some redundant includes

2025-07-25 Thread David Malcolm
No functional change intended. gcc/ChangeLog: * diagnostics/selftest-paths.cc: Don't include "demangle.h" and "backtrace.h". * diagnostics/source-printing.cc: Likewise. * diagnostics/state-graphs.cc: Don't include "graphviz.h", "xml.h", "xml-printer.h", or "

[PATCH 22/34] diagnostics: move diagnostics::edit_context -> diagnostics::changes::change_set

2025-07-25 Thread David Malcolm
No functional change intended. gcc/ChangeLog: * Makefile.in (OBJS-libcommon): Replace diagnostics/changes.o with diagnostics/edit-context.o. * diagnostic.cc: Update for move of diagnostics/edit-context.h to diagnostics/changes.h. (diagnostics::context::initi

[PATCH 34/34] Introduce lazily-created.h

2025-07-25 Thread David Malcolm
{ // no-op for text } diff --git a/gcc/lazily-created.h b/gcc/lazily-created.h new file mode 100644 index ..a6010cac8b57 --- /dev/null +++ b/gcc/lazily-created.h @@ -0,0 +1,51 @@ +/* Template for deferring object creation until the object is needed. + Copyright (C) 2024-2025 Free Sof

[PATCH 23/34] Rename diagnostic-spec.{cc, h} to gcc-diagnostic-spec.{cc, h}

2025-07-25 Thread David Malcolm
This has GCC-specific stuff in it (options and "GTY"), and so should not be in the "diagnostics/" subdir, and should avoid a "diagnostics" prefix in its name. No functional change intended. gcc/ChangeLog: * Makefile.in (OBJS-libcommon): Replace diagnostic-spec.o with gcc-diagnosti

[PATCH 31/34] diagnostics: eliminate ::diagnostic_info typedef

2025-07-25 Thread David Malcolm
No functional change intended. gcc/c-family/ChangeLog: * c-common.cc: Update usage of "diagnostic_info" to explicitly refer to "diagnostics::diagnostic_info". * c-opts.cc: Likewise. gcc/c/ChangeLog: * c-errors.cc: Update usage of "diagnostic_info" to explicitly

[PATCH 32/34] diagnostics: make context::m_source_printing private

2025-07-25 Thread David Malcolm
No functional change intended. gcc/ada/ChangeLog: * gcc-interface/misc.cc: Make diagnostics::context::m_source_printing private. gcc/analyzer/ChangeLog: * program-point.cc: Make diagnostics::context::m_source_printing private. gcc/c-family/ChangeLog: * c-c

[PATCH 29/34] diagnostics: move file_cache from input.{cc, h} to diagnostics/file-cache.{cc, h}

2025-07-25 Thread David Malcolm
No functional change intended. gcc/ChangeLog: * Makefile.in (OBJS-libcommon): Add diagnostics/file-cache.o. * diagnostics/changes.cc: Update for file_cache and char_span moving from input.h to diagnostics/file-cache.h and into the "diagnostics::" namespace.

[PATCH 24/34] diagnostics: rename diagnostic_option_id to diagnostics::option_id and move to its own header

2025-07-25 Thread David Malcolm
option_id, + option_id opt_id, diagnostic_t new_kind, location_t where); diff --git a/gcc/diagnostics/option-id.h b/gcc/diagnostics/option-id.h new file mode 100644 index ..4132775bb837 --- /dev/null +++ b/gcc/diagnostics/

[PATCH 19/34] diagnostics: move gcc/diagnostic-color.{h, cc} to gcc/diagnostics/color.{h, cc}

2025-07-25 Thread David Malcolm
No functional change intended. gcc/ChangeLog: * Makefile.in (OBJS-libcommon): Replace diagnostic-color.o with diagnostics/color.o. (PLUGIN_HEADERS): Remove diagnostic-color.h in favor of glob. * common.opt: Update for move of diagnostic-color.h to diagnostic

[PATCH 13/34] diagnostics: add m_ prefix to fields of diagnostic_info

2025-07-25 Thread David Malcolm
No functional change intended. gcc/c-family/ChangeLog: * c-opts.cc (c_diagnostic_text_finalizer): Add "m_" prefix to fields of diagnostic_info. gcc/c/ChangeLog: * c-errors.cc: Update to add "m_" prefix to fields of diagnostic_info throughout. gcc/cp/ChangeLog:

[PATCH 09/34] diagnostics: introduce namespace diagnostics::paths

2025-07-25 Thread David Malcolm
uot; to "gcc/diagnostics/paths/event/". * gcc.dg/sarif-output/include-chain-2.h: Update comment. libcpp/ChangeLog: * include/rich-location.h: Replace diagnostic_path with diagnostics::paths::path. Signed-off-by: David Malcolm --- contrib/filter-clang-w

[PATCH 11/34] diagnostics: introduce diagnostics/source-printing.cc

2025-07-25 Thread David Malcolm
Move diagnostic-show-locus.cc to diagnostics/source-printing.cc Move diagnostic-label-effects.h to diagnostics/source-printing-effects.h Move selftest-diagnostic-show-locus.h to diagnostics/selftest-source-printing.h No functional change intended. gcc/ChangeLog: * Makefile.in (OBJS):

[PATCH 14/34] diagnostics: move diagnostic_info to its own header

2025-07-25 Thread David Malcolm
No functional change intended. gcc/ChangeLog: * diagnostic.h (struct diagnostic_info): Move to diagnostics/diagnostic-info.h as diagnostics::diagnostic_info. Add typedef bringing it back into root namespace, for now. * diagnostics/diagnostic-info.h: New file, based

[PATCH 30/34] diagnostics: introduce context-options.h

2025-07-25 Thread David Malcolm
No functional change intended. gcc/ChangeLog: * diagnostic.h (enum diagnostics_column_unit): Move to diagnostics/context-options.h. (enum diagnostics_escape_format): Likewise. (enum diagnostics_output_format): Likewise. (enum diagnostic_path_format): Likewis

[PATCH 26/34] diagnostics: move diagnostic.c to diagnostics/context.cc

2025-07-25 Thread David Malcolm
No functional change intended. gcc/ChangeLog: * Makefile.in (OBJS-libcommon): Replace diagnostic.o with diagnostics/context.o. gcc/c-family/ChangeLog: * c-common.cc (c_family_tests): Add include of "diagnostics/diagnostics-selftests.h". Replace c_diagnosti

[PATCH 18/34] diagnostics: move gcc/selftest-diagnostic.{h, cc} -> gcc/diagnostics/selftest-context.{h, cc}

2025-07-25 Thread David Malcolm
No functional change intended. gcc/ChangeLog: * Makefile.in (OBJS-libcommon): Replace selftest-diagnostic.o with diagnostics/selftest-context.o. * diagnostic.cc: Update for move of selftest-diagnostic.h to diagnostics/selftest-context.h. * diagnostics/html-s

[PATCH 03/34] diagnostics: move diagnostic_metadata to diagnostics::metadata

2025-07-25 Thread David Malcolm
rnel_plugin.cc: Likewise. * gcc.dg/plugin/analyzer_known_fns_plugin.cc: Likewise. * gcc.dg/plugin/diagnostic_plugin_test_graphs.cc: Likewise. Also update for move of diagnostic_metadata to diagnostics::metadata. * gcc.dg/plugin/diagnostic_plugin_test_metadata.cc: Likewise. * gcc

[PATCH 27/34] diagnostics: simplify header files

2025-07-25 Thread David Malcolm
No functional change intended. gcc/ChangeLog: * diagnostic.h: Move include of "unique-argv.h" and various forward decls into... * diagnostics/context.h: ...here. --- gcc/diagnostic.h | 37 ++--- gcc/diagnostics/context.h | 35 ++

[PATCH 06/34] diagnostics: move client data hooks into namespace/dir "diagnostics"

2025-07-25 Thread David Malcolm
or move of diagnostic_client_version_info to diagnostics::client_version_info. * tree-diagnostic-client-data-hooks.cc: Likewise. * tree-diagnostic.cc: Likewise. Signed-off-by: David Malcolm --- gcc/diagnostic-format-html.cc | 2 +- gcc/diagnostic-forma

[PATCH 21/34] diagnostics: reorganize selftests

2025-07-25 Thread David Malcolm
nostics/diagnostics-selftests.cc @@ -0,0 +1,54 @@ +/* Selftest support for diagnostics. + Copyright (C) 2019-2025 Free Software Foundation, Inc. + Contributed by David Malcolm . + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it +under the terms of t

[PATCH 20/34] diagnostics: gcc/diagnostic-url.h -> gcc/diagnostics/url.h

2025-07-25 Thread David Malcolm
No functional change intended. gcc/ChangeLog: * common.opt: Update for move of diagnostic-url.h to diagnostics/url.h. * diagnostic.cc: Likewise. * diagnostics/color.cc: Likewise. * diagnostics/text-sink.cc: Likewise. * diagnostic-url.h: Move to...

[PATCH 17/34] diagnostics: move buffering code to its own .cc file

2025-07-25 Thread David Malcolm
s/buffering.cc @@ -0,0 +1,199 @@ +/* Support for buffering diagnostics before flushing them to output sinks. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + Contributed by David Malcolm . + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it

[PATCH 00/34] Introduce "gcc/diagnostics" subdirectory and "diagnostics::" namespace

2025-07-25 Thread David Malcolm
diagnostics::paths::selftest::test_event selftest::test_diagnostic_path diagnostics::paths::selftest::test_path selftest::test_diagnostic_threaddiagnostics::paths::selftest::test_thread selftest::test_html_diagnostic_context diagnostics::selftest::test_html_context selftest::test_logical_location_mana

[PATCH 16/34] diagnostics: move option_classifier to its own files

2025-07-25 Thread David Malcolm
No functional change intended. gcc/ChangeLog: * Makefile.in (OBJS-libcommon): Add diagnostics/option-classifier.o. * diagnostic.cc (diagnostics::option_classifier::init): Move to diagnostics/option-classifier.cc. (diagnostics::option_classifier::fini): Likew

[PATCH 07/34] diagnostics: rename diagnostic_output_file to diagnostics::output_file

2025-07-25 Thread David Malcolm
header guard. (class diagnostic_output_file): Move to... (class diagnostics::output_file): ...here. * libgdiagnostics.cc (sarif_sink::sarif_sink): Update for move of diagnostic_output_file to diagnostics::output_file. Signed-off-by: David Malcolm --- gcc

[PATCH 02/34] diagnostics: move logical locations into "diagnostics"

2025-07-25 Thread David Malcolm
l_location_kind to enum diagnostics::logical_locations::kind. gcc/analyzer/ChangeLog: * checker-event.h (checker_event::get_logical_location): Update for conversion of logical_location to diagnostics::logical_locations::key. (checker_event::m_logical_loc): Likewise.

[PATCH 12/34] diagnostics: move diagnostic-macro-unwinding.{cc, h} -> diagnostics/macro-unwinding.{cc, h}

2025-07-25 Thread David Malcolm
gcc/ChangeLog: * Makefile.in (OBJS): Replace diagnostic-macro-unwinding.o with diagnostics/macro-unwinding.o. * diagnostic-macro-unwinding.cc: Move to... * diagnostics/macro-unwinding.cc: ...here, moving content into namespace diagnostics. * diagnosti

[PATCH 08/34] diagnostics: move diagnostics_output_spec to diagnostics::output_spec

2025-07-25 Thread David Malcolm
diagnostics_output_spec_cc_tests. * selftest.h (diagnostic_output_spec_cc_tests): Rename decl to... (diagnostics_output_spec_cc_tests): ...this. Signed-off-by: David Malcolm --- gcc/Makefile.in | 2 +- .../output-spec.cc} | 56

[PATCH 05/34] diagnostics: move edit_context to namespace/dir "diagnostics"

2025-07-25 Thread David Malcolm
. Update for move of edit_context to diagnostics::edit_context. Signed-off-by: David Malcolm --- gcc/Makefile.in | 2 +- gcc/diagnostic-format-html.cc | 2 +- gcc/diagnostic.cc | 4

[PATCH 04/34] diagnostics: move diagnostic_diagram to diagnostics::diagram

2025-07-25 Thread David Malcolm
iagnostic_diagram): Convert to... (class diagnostics::diagram): ...this. gcc/testsuite/ChangeLog: * gcc.dg/plugin/diagnostic_plugin_test_text_art.cc: Update #include for move of "diagnostic-diagram.h" to "diagnostics/diagram.h". Update for m

[PATCH 01/34] diagnostics: introduce a "gcc/diagnostics" subdirectory

2025-07-25 Thread David Malcolm
checker-event.cc: Likewise. * checker-event.h: Update #include for move of "diagnostic-digraphs.h" to "diagnostics/digraphs.h". * program-state.cc: : Update #include for move of "diagnostic-state-graphs.h" to "diagnostics/state-gr

[pushed: r16-2308] diagnostics: remove redundant field

2025-07-16 Thread David Malcolm
ChangeLog: * diagnostic-state-to-dot.cc (state_diagram::m_show_tags): Drop unused field. Signed-off-by: David Malcolm --- gcc/diagnostic-state-to-dot.cc | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/gcc/diagnostic-state-to-dot.cc b/gcc/diagnostic-state-

[pushed: r16-2307] contrib: add gcc/text-art to Doxygen input

2025-07-16 Thread David Malcolm
Tested with "doxygen contrib/gcc.doxy" Pushed to trunk as r16-2307-g48b572ce868829. contrib/ChangeLog: * gcc.doxy (INPUT): Add directory "gcc/text-art". Signed-off-by: David Malcolm --- contrib/gcc.doxy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

Re: [pushed: r16-2211] diagnostics: add support for directed graphs; use them for state graphs

2025-07-16 Thread David Malcolm
On Wed, 2025-07-16 at 15:58 +0200, Martin Jambor wrote: > Hello David, > > On Fri, Jul 11 2025, David Malcolm wrote: > > In r16-1631-g2334d30cd8feac I added support for capturing state > > information from -fanalyzer in XML form, and adding a way to > > visualize >

[pushed: r16-2274] libgdiagnostics: add diagnostic_message_buffer [PR120792]

2025-07-15 Thread David Malcolm
eferring to other events by ID. * sarif-replay.dg/2.1.0-valid/3.11.6-embedded-links.sarif: Add HTML and SARIF output, and call out to Python scripts to verify the output. Add example of a result with a link in its message. * sarif-replay.dg/2.1.0-valid/embedded-links

[pushed: r16-2275] spellcheck.{cc,h}: modernization

2025-07-15 Thread David Malcolm
toff): Likewise. Use std::max. (selftest::assert_not_suggested_for): Use nullptr. (selftest::test_find_closest_string): Likewise. * spellcheck.h: Replace TYPE with StringLikeType in templates, and use CamelCase. Signed-off-by: David Malcolm --- gcc/spellcheck.cc |

[pushed: r16-2210] json: add json::value::clone

2025-07-11 Thread David Malcolm
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r16-2210-gd7c1e9b37caad5. gcc/ChangeLog: * json.cc (json::object::clone): New. (json::object::clone_as_object): New. (json::array::clone): New. (json::float_number::clone): New.

[pushed: r16-2209] json: fix null-termination of json::string

2025-07-11 Thread David Malcolm
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r16-2209-g1ea72a15031cd8. gcc/ChangeLog: * json.cc (string::string): When constructing from pointer and length, ensure the new buffer is null-terminated. (selftest::test_strcmp): New.

[pushed: r16-2208] libgdiagnostics: doc fixes

2025-07-11 Thread David Malcolm
tics/topics/logical-locations.rst: Markup fix. * doc/libgdiagnostics/tutorial/02-physical-locations.rst: Clarify wording of what "the source file" means, and that a range can't have multiple files. Signed-off-by: David Malcolm --- .../libgdiagnostics/topics/comp

Re: [pushed: r16-1830] diagnostics: remove "json" output format

2025-06-30 Thread David Malcolm
On Mon, 2025-06-30 at 15:24 -0400, David Malcolm wrote: > The "json" output format for diagnostics was deprecated in GCC 15, > with > advice to users seeking machine-readable diagnostics from GCC to use > SARIF instead. > > This patch eliminates it from GCC 16,

[pushed: r16-1831] diagnostics: convert diagnostic_event::meaning enums to enum class

2025-06-30 Thread David Malcolm
erty): Likewise. (diagnostic_event::meaning): Likewise. gcc/testsuite/ChangeLog: * gcc.dg/plugin/analyzer_gil_plugin.cc (gil_diagnostic::get_meaning_for_state_change): Convert diagnostic_event::meaning enums to enum class. Signed-off-by: David Malcolm --- gcc/anal

[pushed: r16-1832] diagnostics: use nullptr rather than NULL

2025-06-30 Thread David Malcolm
wise. * lazy-diagnostic-path.cc: Likewise. * simple-diagnostic-path.cc: Likewise. * tree-diagnostic-client-data-hooks.cc: Likewise. Signed-off-by: David Malcolm --- gcc/diagnostic-color.cc | 14 +++--- gcc/diagnostic-format-sarif.cc | 14 +++--- gcc/diagno

[pushed: r16-1830] diagnostics: remove "json" output format

2025-06-30 Thread David Malcolm
format-json-pr105916.F90: Deleted test. Signed-off-by: David Malcolm --- gcc/Makefile.in | 1 - gcc/common.opt| 11 +- gcc/diagnostic-format-json.cc | 605 -- gcc/diagnostic-for

Re: [PATCH v6 1/3][Middle-end] Provide more contexts for -Warray-bounds, -Wstringop-*warning messages due to code movements from compiler transformation (Part 1) [PR109071,PR85788,PR88771,PR106762,PR1

2025-06-30 Thread David Malcolm
On Mon, 2025-06-30 at 16:47 +, Qing Zhao wrote: [...snip...] > The output with -fdiagnostics-show-context=1 is: > > /home/opc/Work/GCC/latest-gcc- > write/gcc/testsuite/gcc.dg/pr109071_7.c: In function ‘foo’: > /home/opc/Work/GCC/latest-gcc- > write/gcc/testsuite/gcc.dg/pr109071_7.c:12:6: wa

Re: [PATCH] gcc: middle-end opt for trigonometric pi-based functions builtins

2025-06-26 Thread David Malcolm
On Thu, 2025-06-26 at 17:45 +, Yuao Ma wrote: > Hi all, > > This patch, a follow-up to r16-1652-g0606d2b979f401, implements > middle-end > optimizations (e.g., constant folding) for our trigonometric pi-based > function > built-ins. > > This patch is part of > https://gcc.gnu.org/pipermail/fo

[pushed: r16-1715] diagnostics, testsuite: don't assume host has "dot" [PR120809]

2025-06-26 Thread David Malcolm
this, adding dg-require-dot... * gcc.dg/analyzer/state-diagram-5-sarif.c: ...and this. Signed-off-by: David Malcolm --- gcc/diagnostic-format-html.cc | 3 +- ...ate-diagram-5.c => state-diagram-5-html.c} | 11 ++ .../gcc.dg/analyzer/state-diagram-5-sarif.c

[pushed: r16-1716] diagnostics: make 5 more fields of diagnostic_context private

2025-06-26 Thread David Malcolm
text::inhibit_notes. Signed-off-by: David Malcolm --- gcc/ada/gcc-interface/misc.cc | 2 +- gcc/c-family/c-opts.cc| 2 +- gcc/cp/error.cc | 2 +- gcc/diagnostic.h | 43 +++ gcc/opts.cc | 2 +- gcc/tople

[pushed: r16-1714] diagnostics: refactor sarif_scheme_handler::make_sink

2025-06-26 Thread David Malcolm
and sarif_serialization_format into... (sarif_scheme_handler::make_sarif_gen_opts): ...this... (sarif_scheme_handler::make_sarif_serialization_object): ...and this. Signed-off-by: David Malcolm --- gcc/diagnostic-output-spec.cc | 43 ++- 1

Re: [PATCH 03/17] Diagnostics: Mark path_label::get_effects as final override

2025-06-25 Thread David Malcolm
On Wed, 2025-06-25 at 16:04 +0200, Martin Jambor wrote: > Hi, > > When compiling diagnostic-path-output.cc with clang, it warns that > path_label::get_effects should be marked as override.  That looks > like > a good idea and from a brief look I also believe it should be marked > as final (the oth

Re: [PATCH] diagnostic: fix for older version of GCC

2025-06-24 Thread David Malcolm
On Tue, 2025-06-24 at 15:16 +0200, Marc Poulhiès wrote: > Having both an enum and a variable with the same name triggers an > error with > gcc 5. > > ChangeLog: > > * c/gcc/diagnostic-state-to-dot.cc > (get_color_for_dynalloc_state): > Rename argument dynalloc_state to dynalloc_st. >

[pushed: r16-1635] analyzer: fix missing "final override"

2025-06-23 Thread David Malcolm
No functional change intended. Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r16-1635-ge6406aefd1a25b. gcc/analyzer/ChangeLog: * region-model.cc (exception_thrown_from_unrecognized_call::print): Add "final override" to vfunc. --- gcc/an

[pushed: r16-1636] libgdiagnostics: sarif-replay: add extra sinks via -fdiagnostics-add-output= [PR116792, PR116163]

2025-06-23 Thread David Malcolm
This patch refactors the support for -fdiagnostics-add-output=SCHEME from GCC's options parsing so that it is also available to sarif-replay and to other clients of libgdiagnostics. With this users of sarif-replay and other such tools can generate HTML or SARIF as well as text output, using the sa

[pushed: r16-1630] diagnostics: handle pp_token::kind::event_id in experimental-html sink [PR116792]

2025-06-23 Thread David Malcolm
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Successful run of analyzer integration tests on x86_64-pc-linux-gnu. Pushed to trunk as r16-1630-g5a64c96cfe7a4d. gcc/ChangeLog: PR other/116792 * diagnostic-format-html.cc (html_token_printer::print_tokens): Ha

[pushed: r16-1567] analyzer: make checker_event::m_kind private

2025-06-18 Thread David Malcolm
No functional change intended. Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r16-1567-g4eb111363899a9. gcc/analyzer/ChangeLog: * checker-event.h (checker_event::get_kind): New accessor. (checker_event::m_kind): Make private. * checker-pa

Re: [PATCH RFA (diagnostic)] c++: modules and #pragma diagnostic

2025-06-16 Thread David Malcolm
On Wed, 2025-06-11 at 11:57 -0400, Jason Merrill wrote: > On 6/3/25 7:02 PM, David Malcolm wrote: > > On Sat, 2025-05-31 at 23:25 -0400, Jason Merrill wrote: > > > +  if (kind == DK_POP) > > > + opt += offset; > > > > I'm wondering why the

[pushed: r16-1422] diagnostics: add selftests for html_token_printer [PR116792]

2025-06-11 Thread David Malcolm
sing ASSERT_XML_PRINT_EQ. (selftest::test_printer): Likewise. (selftest::test_attribute_ordering): Likewise. Signed-off-by: David Malcolm --- gcc/diagnostic-format-html.cc | 219 -- gcc/selftest-xml.h| 50 gcc/xml.cc| 2

[pushed: r16-1406] diagnostics: make experimental-html sink prettier [PR116792]

2025-06-10 Thread David Malcolm
e to use search by id. (get_message_within_diag): Update to use search by class. libcpp/ChangeLog: PR other/116792 * include/line-map.h (typedef expanded_location): Convert to... (struct expanded_location): ...this. (operator==): New decl, for expanded_location

[pushed: r16-1403] gimple-ssa-warn-access: add missing auto_diagnostic_group

2025-06-10 Thread David Malcolm
Spotted whilst implementing nesting support in the experimental-html diagnostic sink. Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r16-1403-gb619b4d7e7a507. gcc/ChangeLog: * gimple-ssa-warn-access.cc (pass_waccess::maybe_check_dealloc_call): Ad

[pushed: r16-1404] diagnostics: fix tag nesting issues in experimental-html sink [PR120610]

2025-06-10 Thread David Malcolm
I've been seeing issues in the experimental-html sink where the nesting of tags goes wrong. The two issues I've seen are: * the pp_token_list from the diagnostic message that reaches the html_token_printer doesn't always have matching pairs of begin/end tokens (PR other/120610) * a bug in diag

[pushed: r16-1405] diagnostics: xml: add add_text_from_pp

2025-06-10 Thread David Malcolm
children::add_text_from_pp): New decl. Signed-off-by: David Malcolm --- gcc/diagnostic-path-output.cc | 6 +++--- gcc/diagnostic-show-locus.cc | 2 +- gcc/xml-printer.h | 1 + gcc/xml.cc| 12 gcc/xml.h | 1 + 5 files changed, 18 insertio

[pushed: r16-1348] diagnostics: convert enum logical_location_kind to enum class

2025-06-09 Thread David Malcolm
this. * selftest-logical-location.cc (test_logical_location_manager::item_from_funcname): Update for conversion of enum logical_location_kind to enum class. * tree-logical-location.cc (tree_logical_location_manager::get_kind): Likewise. Signed-off-by: David Malcolm ---

[pushed: r16-1344] diagnostics: fix of experimental-html output [PR116792]

2025-06-09 Thread David Malcolm
eLog: PR other/116792 * gcc.dg/html-output/missing-semicolon.py: Update expected text. Drop out-of-date comment. Signed-off-by: David Malcolm --- gcc/diagnostic-format-html.cc | 27 +- gcc/diagnostic-format-json.cc | 23 +++-- gcc/dia

[pushed: r16-1269] diagnostics: introduce xml::doctypedecl to avoid hardcoding html

2025-06-06 Thread David Malcolm
cc_tests): New. * xml.h (struct doctypedecl): New decl. Signed-off-by: David Malcolm --- gcc/diagnostic-format-html.cc | 19 +++ gcc/xml.cc| 19 ++- gcc/xml.h | 8 3 files changed, 41 insertions(+), 5 deletions(-) di

[pushed: r16-1268] diagnostics: move xml defs to a new xml.cc

2025-06-06 Thread David Malcolm
file, based on material from diagnostic-format-html.cc. Signed-off-by: David Malcolm --- gcc/Makefile.in | 1 + gcc/diagnostic-format-html.cc | 313 - gcc/selftest-run-tests.cc | 1 + gcc/selftest.h| 1 + gcc/xml.cc

[pushed: r16-1266] text-art: allow wrapper_widget to have no child

2025-06-06 Thread David Malcolm
dget::paint_to_canvas): Likewise. Signed-off-by: David Malcolm --- gcc/text-art/widget.cc | 10 ++ gcc/text-art/widget.h | 11 --- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/gcc/text-art/widget.cc b/gcc/text-art/widget.cc index 3c68018c3b54..5d3e5178484c 100644 --- a/gcc/

[pushed: r16-1267] selftest.h: fix sort order of decls

2025-06-06 Thread David Malcolm
No functional change intended. Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r16-1267-g0401957b86fa29. gcc/ChangeLog: * selftest.h: Fix the sorting of the various *_cc_tests decls. --- gcc/selftest.h | 14 +++--- 1 file changed, 7 insertions(+)

Re: [PATCH RFA (diagnostic)] c++: modules and #pragma diagnostic

2025-06-03 Thread David Malcolm
On Sat, 2025-05-31 at 23:25 -0400, Jason Merrill wrote: > From f57505c7c6fa05a14e285c14a81021655a43ccbc Mon Sep 17 00:00:00 > 2001 > From: Jason Merrill > Date: Wed, 20 Nov 2024 16:20:52 +0100 > Subject: [PATCH] c++: modules and #pragma diagnostic > To: gcc-patches@gcc.gnu.org > > To respect the

[pushed: r16-1024] diagnostics: implement highlight-a vs -b in HTML output [PR116792]

2025-05-30 Thread David Malcolm
t/diagnostic-ranges-html.py: New test script. * gcc.dg/format/diagnostic-ranges.c: Add HTML generation to options, and invoke the new script to check the HTML output. Signed-off-by: David Malcolm --- gcc/diagnostic-format-html.cc | 13 +- gcc/dia

[pushed: r16-1002] diagnostics: consolidate calls to colorizer::set_named_color

2025-05-30 Thread David Malcolm
per character. * g++.dg/diagnostic/long-short-colorization.C: Likewise. * g++.dg/plugin/show-template-tree-color-labels.C: Likewise. * gcc.dg/bad-binary-ops-highlight-colors.c: Likewise. * gcc.dg/format/colors.c: Likewise. Signed-off-by: David Malcolm --- gcc/diagno

[pushed: r16-975] diagnostics: fix PatternFly URL

2025-05-29 Thread David Malcolm
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r16-975-g8b3300fe2c2794. gcc/ChangeLog: * diagnostic-format-html.cc (HTML_STYLE): Fix PatternFly URL in comment. Signed-off-by: David Malcolm --- gcc/diagnostic-format-html.cc | 2 +- 1

[pushed: r16-974] diagnostics: reimplement html_token_printer in terms of xml::printer

2025-05-29 Thread David Malcolm
s of xml::printer. (html_builder::make_element_for_diagnostic): Create an xml::printer and use it with the html_token_printer. Signed-off-by: David Malcolm --- gcc/diagnostic-format-html.cc | 46 ++- 1 file changed, 13 insertions(+), 33 deletions(-)

[pushed: r16-973] diagnostics: bulletproof html_builder::make_metadata_element

2025-05-29 Thread David Malcolm
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r16-973-g554d2a2f0e2006. gcc/ChangeLog: * diagnostic-format-html.cc (html_builder::make_metadata_element): Gracefully handle the case where "url" is null. Signed-off-by: David Mal

[pushed: r16-972] diagnostics: use unique_ptr for m_format_postprocessor

2025-05-29 Thread David Malcolm
mat_postprocessor::clone): Use unique_ptr. (pretty_printer::set_format_postprocessor): New. (pretty_printer::m_format_postprocessor): Use unique_ptr. (pp_format_postprocessor): Update for use of unique_ptr, removing reference from return type. Signed-off-by: David Malco

Re: [PATCH RFA (diagnostic)] c++: modules and #pragma diagnostic

2025-05-29 Thread David Malcolm
On Thu, 2025-05-29 at 09:11 -0400, Jason Merrill wrote: > On 5/27/25 5:12 PM, Jason Merrill wrote: > > On 5/27/25 4:47 PM, Jason Merrill wrote: > > > On 5/27/25 1:33 PM, David Malcolm wrote: > > > > On Fri, 2025-05-23 at 16:58 -0400, Jason Merrill wrote: > > >

Re: [PATCH RFA (diagnostic)] c++: modules and #pragma diagnostic

2025-05-27 Thread David Malcolm
On Tue, 2025-05-27 at 17:21 -0400, Patrick Palka wrote: > > On Tue, 27 May 2025, Patrick Palka wrote: > > > On Tue, 27 May 2025, David Malcolm wrote: > > > > > On Fri, 2025-05-23 at 16:58 -0400, Jason Merrill wrote: > > > > On 4/14/25 9:57 AM, Jason M

Re: [PATCH RFA (diagnostic)] c++: modules and #pragma diagnostic

2025-05-27 Thread David Malcolm
On Fri, 2025-05-23 at 16:58 -0400, Jason Merrill wrote: > On 4/14/25 9:57 AM, Jason Merrill wrote: > > On 1/9/25 10:00 PM, Jason Merrill wrote: > > > Tested x86_64-pc-linux-gnu.  Is the diagnostic.h change OK for > > > trunk? > > > > Ping? > > Ping. Sorry for the delay in responding; comments be

Re: [PATCH RFC] diagnostics: use -Wformat-diag more consistently

2025-05-22 Thread David Malcolm
On Thu, 2025-05-22 at 17:01 -0400, Jason Merrill wrote: > Tested x86_64-pc-linux-gnu, any objection? LGTM Thanks Dave > > -- 8< -- > > r10-1211 added various -Wformat-diag warnings about quoting in GCC > diagnostic strings, but didn't change these two quoting warnings to > use that > flag as w

Re: [RFC PATCH] Implement -fdiag-prefix-map

2025-05-14 Thread David Malcolm
On Thu, 2025-04-03 at 13:58 +0200, Rasmus Villemoes wrote: > In many setups, especially when CI and/or some meta-build system like > Yocto or buildroot, is involved, gcc ends up being invoked using > absolute path names, which are often long and uninteresting. > > That amounts to a lot of noise bo

Re: [Stage 1][Middle-end][PATCH v5 2/3] Provide more contexts for -Warray-bounds, -Wstringop-*warning messages due to code movements from compiler transformation (Part 2) [PR109071,PR85788,PR88771,PR1

2025-05-14 Thread David Malcolm
On Mon, 2025-04-07 at 15:04 +, Qing Zhao wrote: [...snip...] > diff --git a/gcc/move-history-rich-location.cc b/gcc/move-history- > rich-location.cc > new file mode 100644 > index 000..120498d165e > --- /dev/null > +++ b/gcc/move-history-rich-location.cc [...snip...] > + > +/* Imple

[pushed: r16-579] diagnostics: improvements to experimental-html output [PR116792]

2025-05-12 Thread David Malcolm
Add barebones support for * diagnostic metadata rules * quoted source * generated patches * execution paths Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r16-579-ge4ccad8faf5266. gcc/ChangeLog: PR other/116792 * diagnostic-format-html.cc: Includ

Re: [PATCH] [testsuite] [vxworks] netinet includes atomic, reqs c++11

2025-05-12 Thread David Malcolm
On Thu, 2025-05-08 at 23:29 -0300, Alexandre Oliva wrote: > > On vxworks, the included netinet/in.h header indirectly includes > , that fails on C++ <11.  Skip the test. > > Tested with gcc-14 targeting ppc-vx7r2 and ppc64-vx7r2.  Also tested > with trunk on ppc64le-linux-gnu, and with gcc-14 tar

  1   2   3   4   5   6   7   8   9   10   >