Skip to content

C++: Silence ExtractionRecoverableWarnings when BMN is active#21588

Merged
jketema merged 2 commits intogithub:mainfrom
jketema:jketema/compiler-error-bmn
Mar 30, 2026
Merged

C++: Silence ExtractionRecoverableWarnings when BMN is active#21588
jketema merged 2 commits intogithub:mainfrom
jketema:jketema/compiler-error-bmn

Conversation

@jketema
Copy link
Copy Markdown
Contributor

@jketema jketema commented Mar 26, 2026

Some context: all warnings/errors produced by the extractor are output to the SARIF by means of this query. This is mostly done to allow for initial debugging when we receive a SARIF file from a customer. In BMN the expectation is that there will always be warnings/errors coming from the extractor, and they are likely not very helpful for further debugging.

This PR silences the warnigs/errors in the case of BMN. The ExtractionUnknownProblem are kept, because they indicate more serious problems that we may want to track.

With these changes I'm able to successfully run BMN DCA with the code-scanning and security extended query suites.

I also ran a QA experiment (27/3/2026) which shows a few projects we can now handle, which we could not handle before. The set of projects is identical to the set found when completely turning off off warnings and errors emitted from the extractor (QA experiment from 24/3/2026).

@github-actions github-actions bot added the C++ label Mar 26, 2026
@jketema jketema force-pushed the jketema/compiler-error-bmn branch from 07b2165 to 0f8e39a Compare March 27, 2026 12:43
@jketema jketema marked this pull request as ready for review March 30, 2026 09:51
@jketema jketema requested a review from a team as a code owner March 30, 2026 09:51
Copilot AI review requested due to automatic review settings March 30, 2026 09:51
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reduces SARIF output noise for C++ build-mode: none (BMN) databases by filtering out ExtractionRecoverableWarning diagnostics from the extractor, while keeping ExtractionUnknownProblem results to retain signal for more serious/opaque extraction failures.

Changes:

  • Update the cpp/diagnostics/extraction-warnings diagnostic query to suppress ExtractionRecoverableWarnings when BMN is active.
  • Extend the extraction-problem hierarchy with a getCompilation() accessor to support build-mode-based filtering.
  • Add a change note documenting the diagnostics behavior change and its SARIF-size impact.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
cpp/ql/src/change-notes/2026-03-30-warning-diagnostics.md Documents the BMN-specific change to extraction warning diagnostics and SARIF size impact.
cpp/ql/src/Diagnostics/ExtractionWarnings.ql Filters out recoverable extraction warnings when build-mode: none is used.
cpp/ql/src/Diagnostics/ExtractionProblems.qll Adds compilation association plumbing to extraction problems to enable BMN filtering.

---
category: minorAnalysis
---
* The "Extraction warnings" (`cpp/diagnostics/extraction-warnings`) diagnostics query no longer yields `ExtractionRecoverableWarning`s for `build-mode: none` databases. The results were found to significantly increase the sizes of the produced SARIF files, making them unprocessable in some cases.
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change note sentence is a bit awkward/grammatically off ("increase the sizes of the produced SARIF files"). Consider rephrasing to something like "increase the size of the produced SARIF files" for clarity.

Suggested change
* The "Extraction warnings" (`cpp/diagnostics/extraction-warnings`) diagnostics query no longer yields `ExtractionRecoverableWarning`s for `build-mode: none` databases. The results were found to significantly increase the sizes of the produced SARIF files, making them unprocessable in some cases.
* The "Extraction warnings" (`cpp/diagnostics/extraction-warnings`) diagnostics query no longer yields `ExtractionRecoverableWarning`s for `build-mode: none` databases. The results were found to significantly increase the size of the produced SARIF files, making them unprocessable in some cases.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

@IdrissRio IdrissRio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@jketema jketema merged commit 095a9cb into github:main Mar 30, 2026
24 checks passed
@jketema jketema deleted the jketema/compiler-error-bmn branch March 30, 2026 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants