[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

Re: [PATCH] [testsuite] [analyzer] [vxworks] define __STDC_WANT_LIB_EXT1__ to 1

2025-05-12 Thread David Malcolm
On Thu, 2025-05-08 at 23:31 -0300, Alexandre Oliva wrote: > > vxworks' headers use #if instead of #ifdef to test for > __STDC_WANT_LIB_EXT1__, so the definition in the analyzer test > strotok-cppreference.c catches a bug there, but not something it's > meant to catch or that we could fix in GCC, s

[pushed: r16-487] diagnostics: convert HTML output test plugin to 'experimental-html' sink [PR116792]

2025-05-08 Thread David Malcolm
/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_xhtml_format.cc +++ b/gcc/diagnostic-format-html.cc @@ -1,6 +1,5 @@ -/* Verify that we can write a non-trivial diagnostic output format - as a plugin (XHTML). - Copyright (C) 2018-2024 Free Software Foundation, Inc. +/* HTML output for diagnostics. +

Re: [RFC PATCH 0/5] aarch64: Support for user-defined aarch64 tuning parameters in JSON

2025-05-07 Thread David Malcolm
On Tue, 2025-05-06 at 14:00 +0530, soum...@nvidia.com wrote: > From: Soumya AR > > Hi, > > This RFC and subsequent patch series introduces support for printing > and parsing > of aarch64 tuning parameters in the form of JSON. > > It is important to note that this mechanism is specifically inten

Re: [RFC PATCH 0/5] aarch64: Support for user-defined aarch64 tuning parameters in JSON

2025-05-07 Thread David Malcolm
On Tue, 2025-05-06 at 11:34 +0100, Richard Sandiford wrote: > writes: > > From: Soumya AR > > > > Hi, > > > > This RFC and subsequent patch series introduces support for > > printing and parsing > > of aarch64 tuning parameters in the form of JSON. > > Thanks for doing this.  It looks really u

[pushed: r16-417] diagnostics: use diagnostic_option_id in one more place

2025-05-06 Thread David Malcolm
No functional change intended. Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r16-417-gf4fa41cd5ccbcc. gcc/ChangeLog: * selftest-diagnostic.cc (test_diagnostic_context::report): Use diagnostic_option_id rather than plain int. * selftest-d

[pushed: r16-415] diagnostics: support XML and JSON kinds of logical locations

2025-05-06 Thread David Malcolm
arif: New test. Signed-off-by: David Malcolm --- gcc/diagnostic-format-sarif.cc| 27 +++ .../topics/logical-locations.rst | 28 +++ gcc/libgdiagnostics.cc| 117 +++-- gcc/libgdiagnostics.h | 18 +- gcc/lib

[pushed: r16-412] libgdiagnostics: add accessors for diagnostic_logical_location [LIBGDIAGNOSTICS_ABI_1]

2025-05-06 Thread David Malcolm
ndex ..4df685001e67 --- /dev/null +++ b/gcc/doc/libgdiagnostics/topics/compatibility.rst @@ -0,0 +1,179 @@ +.. Copyright (C) 2015-2025 Free Software Foundation, Inc. + Originally contributed by David Malcolm + + This is free software: you can redistribute it and/or modify it + under the t

[pushed: r16-416] json: implement JSON pointer; use it in sarif-replay [PR117988]

2025-05-06 Thread David Malcolm
replay.dg/2.1.0-unhandled/3.27.10-none-level.sarif: Likewise. Signed-off-by: David Malcolm --- gcc/json.cc | 49 gcc/json.h| 47 +++ gcc/libsarifreplay.cc | 79 +++

[pushed: r16-414] sarif output: capture nesting of logical locations [PR116176]

2025-05-06 Thread David Malcolm
-3.py: New test script. * g++.dg/sarif-output/sarif-output.exp: New script, adapted from gcc.dg/sarif-output/sarif-output.exp. * libgdiagnostics.dg/test-logical-location-c.py: Update for using theRun.logicalLocations. * libgdiagnostics.dg/test-warning-with-p

[pushed: r16-413] diagnostics: add logical_location_manager; reimplement logical_location

2025-05-06 Thread David Malcolm
Previously we used an abstract base class logical_location with concrete subclasses to separate the diagnostics subsystem from implementation details of "tree" and of libgdiagnostics. This approach required allocating implementation objects on the heap whenever working with logical locations, and

[pushed: r16-315] prime-paths.cc: remove redundant semicolons

2025-04-30 Thread David Malcolm
Fixes a couple of pedantic warnings. Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r16-315-g49d2c6ced2c894. gcc/ChangeLog: * prime-paths.cc (limit_checked_add): Remove redundant trailing ';'. (enters_through_p): Likewise. --- gcc/prime-

[pushed: r16-314] sarif output: introduce sarif_serialization_format

2025-04-30 Thread David Malcolm
The SARIF 2.1.0 spec says that although a "SARIF log file SHALL contain a serialization of the SARIF object model into the JSON format ... in the future, other serializations might be defined." (§3.1) I've been experimenting with alternative serializations of SARIF (CBOR and JSON5 for now). To he

[pushed: r16-313] analyzer: add more test coverage for sprintf

2025-04-30 Thread David Malcolm
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r16-313-g8c80fc106482dd. gcc/testsuite/ChangeLog: PR analyzer/107017 * c-c++-common/analyzer/sprintf-3.c: New test, covering use of sprintf with specific format strings. Doesn't yet find prob

[pushed: r16-312] analyzer: avoid saying "'0' is NULL"

2025-04-30 Thread David Malcolm
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r16-312-g039ba6580f5328. gcc/analyzer/ChangeLog: * sm-malloc.cc (malloc_diagnostic::describe_state_change): Tweak the "EXPR is NULL" message for the case where EXPR is a null pointer. gcc/tes

Re: [PATCH] Fix for older version of GCC

2025-04-29 Thread David Malcolm
On Tue, 2025-04-29 at 21:51 +0200, Marc Poulhiès wrote: > Having both an enum and a variable with the same name triggers an > error with > gcc 5. > >   exploded-graph.h:351:29: error: ‘status’ is not a class, namespace, > or enumeration > > gcc/analyzer/ChangeLog: > * exploded-graph.h (set_

[pushed: r16-266] analyzer: handle NRVO and DECL_BY_REFERENCE [PR111536]

2025-04-28 Thread David Malcolm
536-1.C: New test. * g++.dg/analyzer/nrvo-pr111536-1b.C: New test. * g++.dg/analyzer/nrvo-pr111536-2.C: New test. * g++.dg/analyzer/nrvo-pr111536-2b.C: New test. Signed-off-by: David Malcolm --- gcc/analyzer/engine.cc| 2 +- gcc/analyzer/program-stat

[pushed: r16-263] analyzer, c++: add placeholder implementation of ana::translation_unit for C++

2025-04-28 Thread David Malcolm
Implement ana::translation_unit for the C++ frontend with a no-op placeholder implementation, for now. No functional change intended; a follow-up may implement things further. Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r16-263-g13f4b12393fa98. gcc/cp/Change

[pushed: r16-258] analyzer: convert various enums to "enum class"

2025-04-28 Thread David Malcolm
ite/ChangeLog: * gcc.dg/plugin/analyzer_cpython_plugin.cc: Convert enum poison_kind to "enum class". Signed-off-by: David Malcolm --- gcc/analyzer/access-diagram.cc| 16 ++-- gcc/analyzer/bounds-checking.cc | 26 ++--- gcc/analyzer/

[pushed: r16-265] analyzer: fix null deref false negative on std::unique_ptr [PR109366]

2025-04-28 Thread David Malcolm
zero. gcc/testsuite/ChangeLog: PR analyzer/109366 * g++.dg/analyzer/unique_ptr-1.C: New test. * g++.dg/analyzer/unique_ptr-2.C: New test. Signed-off-by: David Malcolm --- gcc/analyzer/region-model-manager.cc | 6 ++ gcc/testsuite/g++.dg/analyzer/unique_ptr-1.C

[pushed: r16-261] analyzer: use unique_ptr for state_machine instances

2025-04-28 Thread David Malcolm
(make_signal_state_machine): Likewise. (make_pattern_test_state_machine): Likewise. (make_va_list_state_machine): Likewise. (make_fd_state_machine): Likewise. * varargs.cc (make_va_list_state_machine): Update to use std::unique_ptr. Signed-off-by: David Malcolm --- gcc/analyzer/engine.cc

[pushed: r16-256] analyzer: fail if we see unexpected gimple stmt codes

2025-04-28 Thread David Malcolm
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r16-256-g5ecea59621c63a. gcc/analyzer/ChangeLog: * region-model.cc (region_model::on_stmt_pre): Use internal_error if we see an unexpected gimple stmt code. Signed-off-by: David Malcolm ---

[pushed: r16-255] analyzer: add a call_details::dump (using text_art)

2025-04-28 Thread David Malcolm
ails::make_dump_widget): New. * call-details.h (call_details::dump): Declare new overload. (call_details::make_dump_widget): New decl. Signed-off-by: David Malcolm --- gcc/analyzer/call-details.cc | 59 gcc/analyzer/call-details.h | 4 +++ 2 f

[pushed: r16-257] analyzer: use analyzer/common.h as a common header

2025-04-28 Thread David Malcolm
c.dg/plugin/analyzer_gil_plugin.cc: Likewise. * gcc.dg/plugin/analyzer_kernel_plugin.cc: Likewise. * gcc.dg/plugin/analyzer_known_fns_plugin.cc: Likewise. Signed-off-by: David Malcolm --- gcc/analyzer/access-diagram.cc| 22 ++- gcc/analyzer/access-diagram.h

[pushed: r16-252] diagnostics: use diagnostic_option_id for m_opt_permissive

2025-04-28 Thread David Malcolm
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r16-252-gbc39b0072f5660. gcc/ChangeLog: * diagnostic.h (diagnostic_context::m_opt_permissive): Convert from int to diagnostic_option_id. Update comment. Signed-off-by: David Malcolm ---

gcc-patches@gcc.gnu.org

2025-04-28 Thread David Malcolm
No functional change intended. Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r16-260-g4e1f545df9da1d. gcc/analyzer/ChangeLog: * call-summary.cc (call_summary_replay::call_summary_replay): Convert "summary" from call_summary * to call_summary &.

[pushed: r16-259] analyzer: convert gcall * to gcall & in many places

2025-04-28 Thread David Malcolm
we know the pointer must be non-null. Signed-off-by: David Malcolm --- gcc/analyzer/analyzer.cc | 24 +-- gcc/analyzer/call-details.cc | 32 ++-- gcc/analyzer/call-details.h | 10 +- gcc/analyzer/call-info.cc | 2 +-

[pushed: r16-250] sarif output: introduce sarif_generation_options

2025-04-28 Thread David Malcolm
: Likewise. Pass "true" for "formatted" param. Signed-off-by: David Malcolm --- gcc/diagnostic-format-sarif.cc | 140 ++--- gcc/diagnostic-format-sarif.h | 36 ++--- gcc/diagnostic.cc | 4 +- gcc/libgdiagnostics.c

[pushed: r16-254] pass_manager: add m_ prefix to pass fields accessed via passes.def

2025-04-28 Thread David Malcolm
ass_manager::finish_optimization_passes): Likewise. (pass_manager::pass_manager): Likewise. (pass_manager::dump_profile_report): Likewise. Signed-off-by: David Malcolm --- gcc/pass_manager.h | 20 ++-- gcc/passes.cc | 34 +-

[pushed: r16-253] c, c++: use unique_ptr in name_hint to reduce naked 'new'

2025-04-28 Thread David Malcolm
(cp_parser_error_1): Use ::make_unique rather than "new" when making suggest_missing_header. Signed-off-by: David Malcolm --- gcc/c-family/name-hint.h | 6 +++-- gcc/c/c-decl.cc | 19 +--- gcc/c/c-parser.cc| 8 --- gcc/cp/name-lookup.cc| 49 +++

[pushed: r16-251] diagnostics: make diagnostic_context::m_abort_on_error private

2025-04-28 Thread David Malcolm
vate. (diagnostic_abort_on_error): Delete. * opts.cc (setup_core_dumping): Update for above changes. Signed-off-by: David Malcolm --- gcc/diagnostic.h | 16 gcc/opts.cc | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/gcc/diagnostic.h b/gcc/diagnost

[pushed] wwwdocs: my GCC 15 changes

2025-04-25 Thread David Malcolm
I forgot to push this before going on vacation; sorry. Pushed to trunk. --- htdocs/gcc-15/changes.html | 260 +++- htdocs/gcc-15/diag-color-screenshot.png | Bin 0 -> 33062 bytes 2 files changed, 257 insertions(+), 3 deletions(-) create mode 100644 htdocs/gcc-15

[pushed: r15-8994-g1ee9caf2f84832] libstdc++-v3 testsuite: fix malformed dg-require-static-libstdcxx directives

2025-03-27 Thread David Malcolm
I believe these don't get detected by DejaGnu's regexp. Found by dg-lint. Pushed to trunk as r15-8994-g1ee9caf2f84832. libstdc++-v3/ChangeLog: * testsuite/17_intro/shared_with_static_deps.cc: Fix malformed dg-require-static-libstdcxx directive. * testsuite/17_intro/static

[pushed: r15-8993] testsuite: fix some malformed dg-require-* directives

2025-03-27 Thread David Malcolm
Pushed to trunk as r15-8993-gc88abca94a6abb. gcc/testsuite/ChangeLog: * g++.dg/abi/pure-virtual1.C: Fix dg-require-weak directive. * g++.target/i386/mangling-alias1.C: Fix dg-require-ifunc directive. --- gcc/testsuite/g++.dg/abi/pure-virtual1.C| 2 +- gcc/testsuite

[pushed: r15-8992] v2: contrib: add dg-lint and libgdiagnostics.py [PR116163]

2025-03-27 Thread David Malcolm
ntrib/dg-lint/dg-lint create mode 100644 contrib/dg-lint/libgdiagnostics.py create mode 100644 contrib/dg-lint/test-1.c create mode 100644 contrib/dg-lint/test-2.c diff --git a/contrib/dg-lint/dg-lint b/contrib/dg-lint/dg-lint new file mode 100755 index ..01d58d7a3e95 --- /dev/null +++ b/cont

[PATCH 04/12] testsuite, aarch64: fix broken dg directives

2025-03-26 Thread David Malcolm
Found by dg-lint. gcc/testsuite/ChangeLog: * gcc.target/aarch64/atomic-inst-ldlogic.c: Add missing trailing " }" for 2 dg-final directives. * gcc.target/aarch64/saturating_arithmetic_1.c: Fix dg-do compile. * gcc.target/aarch64/saturating_arithmetic_2.c: Likewise. -

Re: [PATCH 01/12] contrib: add dg-lint and libgdiagnostics.py [PR116163]

2025-03-26 Thread David Malcolm
On Wed, 2025-03-26 at 19:59 +0100, Jakub Jelinek wrote: > On Wed, Mar 26, 2025 at 02:34:43PM -0400, David Malcolm wrote: > > Thanks for working on this. > My python is very limited, so just adding some comments rather > than doing patch review. > > > +COMMON_MISSPELL

[PATCH 06/12] testsuite, arm: fix broken dg directives

2025-03-26 Thread David Malcolm
Found by dg-lint. gcc/testsuite/ChangeLog: * gcc.target/arm/cmse/cmse-17.c: Fix missing space before trailing "}" in dg-options. * gcc.target/arm/short-vfp-1.c: Likewise for dg-final; also after leading "{", in 5 places. --- gcc/testsuite/gcc.target/arm/cmse/cmse-1

[PATCH 11/12] testsuite, riscv: fix broken dg directives

2025-03-26 Thread David Malcolm
Found by dg-lint. gcc/testsuite/ChangeLog: * gcc.target/riscv/cmo-zicbop-1.c: Fix missing space before trailing } in dg-do directive. * gcc.target/riscv/cmo-zicbop-2.c: Likewise. * gcc.target/riscv/prefetch-zicbop.c: Likewise. * gcc.target/riscv/prefetch-zih

[PATCH 01/12] contrib: add dg-lint and libgdiagnostics.py [PR116163]

2025-03-26 Thread David Malcolm
bgdiagnostics.py create mode 100644 contrib/dg-lint/test-1.c create mode 100644 contrib/dg-lint/test-2.c diff --git a/contrib/dg-lint/dg-lint b/contrib/dg-lint/dg-lint new file mode 100755 index ..20157c304137 --- /dev/null +++ b/contrib/dg-lint/dg-lint @@ -0,0 +1,210 @@ +#!/usr/bin/env pyt

[PATCH 12/12] testsuite, s390: fix broken dg directives

2025-03-26 Thread David Malcolm
Found by dg-lint. gcc/testsuite/ChangeLog: * gcc.target/s390/target-attribute/tattr-1.c: Fix missing trailing close brace on dg-do directive. * gcc.target/s390/target-attribute/tattr-2.c: Likewise. --- gcc/testsuite/gcc.target/s390/target-attribute/tattr-1.c | 2 +- gcc/te

[PATCH 10/12] testsuite, powerpc: fix broken dg directives

2025-03-26 Thread David Malcolm
Found by dg-lint. gcc/testsuite/ChangeLog: * gcc.target/powerpc/pr70243.c: Fix missing trailing " }" in dg-do directive. * gcc.target/powerpc/pr91903.c: Likewise. --- gcc/testsuite/gcc.target/powerpc/pr70243.c | 2 +- gcc/testsuite/gcc.target/powerpc/pr91903.c | 2 +- 2 fi

[PATCH 07/12] testsuite, bfin: fix broken dg directive

2025-03-26 Thread David Malcolm
Found by dg-lint. gcc/testsuite/ChangeLog: * gcc.target/bfin/l2.c: Fix missing space before trailing "}" in dg-bfin-processors directive. --- gcc/testsuite/gcc.target/bfin/l2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/testsuite/gcc.target/bfin/l2.c

[PATCH 09/12] testsuite, ia64: fix broken dg directives

2025-03-26 Thread David Malcolm
Found by dg-lint. gcc/testsuite/ChangeLog: * gcc.target/ia64/mfused-madd-vect.c: Fix missing trailing " }" in dg-do directive. * gcc.target/ia64/mfused-madd.c: Likewise. * gcc.target/ia64/mno-fused-madd.c: Likewise. --- gcc/testsuite/gcc.target/ia64/mfused-madd-vec

[PATCH 08/12] testsuite, i386: fix broken dg directives

2025-03-26 Thread David Malcolm
Found by dg-lint. gcc/testsuite/ChangeLog: * gcc.target/i386/addr-space-1.c: Add missing trailing } to dg-do directive. * gcc.target/i386/strub-pr118006.c: Fix ordering of dg-do and dg-require- directive so that dg-do is first. --- gcc/testsuite/gcc.target/i386/add

[PATCH 02/12] testsuite: fix broken dg directives

2025-03-26 Thread David Malcolm
Found by dg-lint. gcc/testsuite/ChangeLog: * gcc.dg/ipa/pr110377.c: Fix missing trailing " }" in dg-do directive. * gcc.dg/plugin/infoleak-1.c: Fix dg-bogus directive. * gcc.dg/pr101364-1.c: Fix missing trailing " }" in dg-options directive. * gcc.dg

[PATCH 05/12] testsuite, arc: fix broken dg directives

2025-03-26 Thread David Malcolm
Found by dg-lint. gcc/testsuite/ChangeLog: * gcc.target/arc/taux-1.c: Fix missing trailing '" }' from dg-options. * gcc.target/arc/taux-2.c: Likewise. --- gcc/testsuite/gcc.target/arc/taux-1.c | 2 +- gcc/testsuite/gcc.target/arc/taux-2.c | 2 +- 2 files changed, 2 inserti

[PATCH 03/12] testsuite, gomp: fix broken dg directives

2025-03-26 Thread David Malcolm
gcc/testsuite/ChangeLog: * c-c++-common/gomp/metadirective-target-device-2.c: Fix missing trailing " }" on dg-do directive. * gcc.dg/gomp/attrs-21.c: Likewise for dg-options. * gcc.dg/gomp/parallel-2.c: Drop ":" from dg-message. --- gcc/testsuite/c-c++-common/gomp/m

[PATCH 00/12] Implement a new dg-lint tool and use on our testsuite

2025-03-26 Thread David Malcolm
only tested the testsuite fixes on x86_64-pc-linux-gnu; there were some new PASSes and no regressions, but I haven't tested the tests on non-x86 archs. Thoughts? David Malcolm (12): contrib: add dg-lint and libgdiagnostics.py [PR116163] testsuite: fix broken dg directives testsuite, gomp:

[pushed: r15-8447] diagnostics: fix crash in urlifier with -Wfatal-errors [PR119366]

2025-03-19 Thread David Malcolm
diagnostic_context's dtor assumed that it owned the m_urlifier pointer and would delete it. As of r15-5988-g5a022062d22e0b this isn't always the case - auto_urlify_attributes is used in various places in the C/C++ frontends and in the middle-end to temporarily override the urlifier with an on-stac

Re: [PATCH]cobol: create new gcc/testsuite/cobol.dg/group1/check_88.cob test

2025-03-16 Thread David Malcolm
On Sat, 2025-03-15 at 16:14 -0500, Robert Dubner wrote: > This works on a x86_64-linux machine, although I had to do a complete > rebuild to make it take. > > If this meets with the approval of the global reviewers, please apply > it, > with a suitable commit message. > > The main characteristic

  1   2   3   4   5   6   7   8   9   10   >