Skip to content

Explain skipped error-directive configurations in --check-config - #8889

Open
KiritoYG wants to merge 3 commits into
cppcheck-opensource:mainfrom
KiritoYG:codex/report-invalid-configurations
Open

KiritoYG wants to merge 3 commits into
cppcheck-opensource:mainfrom
KiritoYG:codex/report-invalid-configurations

Conversation

@KiritoYG

@KiritoYG KiritoYG commented Sep 24, 2026

Copy link
Copy Markdown

When configuration discovery considers an optional macro without a required platform macro, an active #error can skip that configuration. --check-config currently gives no explanation, making the resulting unused-function warning difficult to diagnose. This addresses the requested diagnostic in Trac #6672 comment 5.

Report a suppressible invalidConfiguration information message in --check-config for the #error failures otherwise hidden by existing error handling. Include the configuration's user/automatic defines, the original error text, and source/header location. Preserve the existing error for explicit defines without --force, avoiding a duplicate message. Normal analysis and configuration enumeration remain unchanged; this does not automatically infer the required macro or remove the ordinary unused-function diagnostic.

Validation on Windows with Clang 22.1.8 and CMake/Ninja:

  • New regression fails on unchanged production code, then passes with the fix.
  • All 5,301 native unit tests pass, with 351 existing TODO assertions. Seven new cases cover valid/inactive configurations, suppression, explicit errors, combined defines, normal analysis and headers; the new ID is present in the error list.
  • Six CLI edge cases pass, including relative paths. Four ordinary-analysis invocations produce byte-identical output to the exact-main baseline.
  • The latest test-only cleanup binds the combined-defines message by const reference. The prior copy triggered redundantCopyLocalConst in upstream self-check. That diagnostic was reproduced with the original analyzer and is now absent on the changed test file; all 24 TestCppcheck tests pass after rebuilding, and Uncrustify 0.80.1 matches. The full-suite/CLI results above cover the unchanged production implementation; upstream checks for the updated head are pending.
  • git diff --check passes. Local build used Debug with PCH disabled and serial compilation after Clang crashed on unchanged code in Release/parallel builds. GUI and non-Windows CI were not run locally.

Please assign this work to KiritoYG if needed. I would like this diagnostic fix considered under the published $10 bounty schedule, subject to acceptance and the required ticket closure. Please confirm its eligibility and the supported settlement route; GitHub Sponsors is available if accepted. No award or payment is being claimed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant