https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116603

--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by David Malcolm <dmalc...@gcc.gnu.org>:

https://gcc.gnu.org/g:38dc2c64710aa0e6a03c0c1201477e3e75b1a0b0

commit r15-3553-g38dc2c64710aa0e6a03c0c1201477e3e75b1a0b0
Author: David Malcolm <dmalc...@redhat.com>
Date:   Mon Sep 9 19:38:11 2024 -0400

    SARIF output: fix schema URL [§3.13.3, PR116603]

    We were using
     
https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json
    as the URL for the SARIF 2.1 schema, but this is now a 404.

    Update it to the URL listed in the spec (§3.13.3 "$schema property"),
    which is:
     
https://docs.oasis-open.org/sarif/sarif/v2.1.0/errata01/os/schemas/sarif-schema-2.1.0.json
    and update the copy in
      gcc/testsuite/lib/sarif-schema-2.1.0.json
    used by the "verify-sarif-file" DejaGnu directive to the version found at
    that latter URL; the sha256 sum changes
    from: 2b19d2358baef0251d7d24e208d05ffabf1b2a3ab5e1b3a816066fc57fd4a7e8
      to: c3b4bb2d6093897483348925aaa73af03b3e3f4bd4ca38cef26dcb4212a2682e

    Doing so added a validation error on
      c-c++-common/diagnostic-format-sarif-file-pr111700.c
    for which we emit this textual output:
      this-file-does-not-exist.c: warning: #warning message [-Wcpp]
    with no line number, and these invalid SARIF regions within the
    physical location of the warning:
      "region": {"startColumn": 2,
                 "endColumn": 9},
      "contextRegion": {}

    This is due to this directive:
      # 0 "this-file-does-not-exist.c"
    with line number 0.

    The patch fixes this by not creating regions that have startLine <= 0.

    gcc/ChangeLog:
            PR other/116603
            * diagnostic-format-sarif.cc (SARIF_SCHEMA): Update URL.
            (sarif_builder::maybe_make_region_object): Don't create regions
            with startLine <= 0.
            (sarif_builder::maybe_make_region_object_for_context): Likewise.

    gcc/testsuite/ChangeLog:
            PR other/116603
            * gcc.dg/plugin/diagnostic-test-metadata-sarif.py (test_basics):
            Update expected schema URL.
            * gcc.dg/plugin/diagnostic-test-paths-multithreaded-sarif.py:
            Likewise.
            * gcc.dg/sarif-output/test-include-chain-1.py: Likewise.
            * gcc.dg/sarif-output/test-include-chain-2.py: Likewise.
            * gcc.dg/sarif-output/test-missing-semicolon.py: Likewise.
            * gcc.dg/sarif-output/test-no-diagnostics.py: Likewise.
            * gcc.dg/sarif-output/test-werror.py: Likewise.
            * lib/sarif-schema-2.1.0.json: Update with copy downloaded from
           
https://docs.oasis-open.org/sarif/sarif/v2.1.0/errata01/os/schemas/sarif-schema-2.1.0.json

    Signed-off-by: David Malcolm <dmalc...@redhat.com>

Reply via email to