C++: Disable cpp/implicit-function-declaration on build mode none databases#21553
C++: Disable cpp/implicit-function-declaration on build mode none databases#21553geoffw0 wants to merge 2 commits intogithub:mainfrom
Conversation
There was a problem hiding this comment.
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-declarationon 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 |
There was a problem hiding this comment.
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).
| not any(Compilation c).buildModeNone() and | |
| exists(Compilation c | not c.buildModeNone()) and |
| * This query is not compatible with build mode: none databases, and has | ||
| * no results on those databases. |
There was a problem hiding this comment.
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.
| * 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. |
|
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). |
Disable results from
cpp/implicit-function-declarationon 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).