Skip to content

C++: Disable cpp/implicit-function-declaration on build mode none databases#21553

Open
geoffw0 wants to merge 2 commits intogithub:mainfrom
geoffw0:implicitfn
Open

C++: Disable cpp/implicit-function-declaration on build mode none databases#21553
geoffw0 wants to merge 2 commits intogithub:mainfrom
geoffw0:implicitfn

Conversation

@geoffw0
Copy link
Contributor

@geoffw0 geoffw0 commented Mar 23, 2026

Disable results from cpp/implicit-function-declaration on build mode: none (buildless) databases. This query is very noisy with false positive results on many of these databases, and I believe the cause is fundamental to what BMN is (i.e. not fixable for BMN).

@geoffw0 geoffw0 requested a review from a team as a code owner March 23, 2026 14:59
Copilot AI review requested due to automatic review settings March 23, 2026 14:59
@geoffw0 geoffw0 added the C++ label Mar 23, 2026
Copy link
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

Disables cpp/implicit-function-declaration findings on build mode: none (buildless) databases to avoid fundamentally imprecise / noisy results.

Changes:

  • Added a build-mode guard to suppress results for cpp/implicit-function-declaration on build mode: none databases.
  • Added a change note documenting the analysis behavior change.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
cpp/ql/src/change-notes/2026-03-23-implicit-function-declaration.md Documents that the query is now suppressed on build mode: none databases.
cpp/ql/src/Likely Bugs/Underspecified Functions/ImplicitFunctionDeclaration.ql Adds a build-mode check intended to prevent results on build mode: none databases.

from FunctionDeclarationEntry fdeIm, FunctionCall fc
where
isCompiledAsC(fdeIm.getFile()) and
not any(Compilation c).buildModeNone() and
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

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

any(Compilation c).buildModeNone()is an aggregation that can be ill-defined if there are noCompilationrows (which may be the case in build mode: none / buildless databases). In that scenario, this guard may not evaluate as intended, potentially failing to suppress results (or suppressing everything unexpectedly depending on QL semantics). Prefer a quantifier-based check that behaves correctly on empty sets, e.g.not exists(Compilation c | c.buildModeNone())` (or the project’s canonical “is build mode none” predicate if one exists).

Suggested change
not any(Compilation c).buildModeNone() and
exists(Compilation c | not c.buildModeNone()) and

Copilot uses AI. Check for mistakes.
Comment on lines +21 to +22
* This query is not compatible with build mode: none databases, and has
* no results on those databases.
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

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

The comment states unconditionally that the query “has no results” on build mode: none databases, but that guarantee depends on the correctness of the build-mode detection logic in the where clause. After switching to an exists(...)-style guard (see other comment), consider updating the wording slightly to describe the mechanism (e.g., “Results are suppressed on build mode: none databases”) to avoid overstating the behavior if the guard changes again later.

Suggested change
* This query is not compatible with build mode: none databases, and has
* no results on those databases.
* This query is not compatible with build mode: none databases; results
* are suppressed on such databases by the build-mode guard in the `where` clause.

Copilot uses AI. Check for mistakes.
@jketema
Copy link
Contributor

jketema commented Mar 23, 2026

I think we need some internal discussion on this. We're now flip-flopping between lowing the accuracy and explicitly disabling the query in BMN (which we did before we lowered the accuracy).

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