Skip to content

Fix #15092: False positive: uninitvar with Microsoft CRT localtime_s. - #8924

Merged
ludviggunne merged 3 commits into
cppcheck-opensource:mainfrom
ludviggunne:15092-localtime_s
Nov 24, 2026
Merged

ludviggunne merged 3 commits into
cppcheck-opensource:mainfrom
ludviggunne:15092-localtime_s

Conversation

@ludviggunne

Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread cfg/std.cfg Resolved
@danmar

danmar commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

@claude review

@claude

claude Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Reviewed the cfg changes and tests. I found no correctness issues.

  • Library::loadFunction merges entries with the same name, so when both std.cfg and windows.cfg are loaded, the per-argument settings combine as intended. std.cfg sets only not-null on both arguments and no direction, and windows.cfg adds the MSVC argument order: direction, not-uninit and errno_t return type. The order-independent baseline is a sound way to fix the uninitvar false positive.
  • Trade-off: with std.cfg alone (C11 Annex K, non-Windows), uninitvar is no longer reported for an uninitialized time argument. This false negative is acceptable given the conflicting signatures. The removed std.c/std.cpp tests were inside #ifdef __STDC_LIB_EXT1__, which is effectively never defined, so they were not giving real coverage anyway.
  • Dropping std::localtime_s is fine because it is not part of the C++ standard library.
  • The new windows.cpp tests cover uninitvar (positive and negative), nullPointer and the #9258 memleak case.

LGTM.

🤖 Generated with Claude Code

@ludviggunne
ludviggunne merged commit 58ee583 into cppcheck-opensource:main Nov 24, 2026
71 of 72 checks passed
@ludviggunne
ludviggunne deleted the 15092-localtime_s branch November 24, 2026 09:47
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.

4 participants