Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ticket 6306: Added regression test and mention suppression in comment #5835

Merged
merged 2 commits into from
Jan 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions test/cfg/std.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4290,6 +4290,28 @@ void nullPointer_istream_read(std::istream &f)
f.read(NULL, 10);
}

std::size_t nullPointer_strxfrm(char *dest, const char *src, std::size_t count)
{
(void)strxfrm(dest, src, count);
// In case the 3rd argument is 0, the 1st argument is permitted to be a null pointer. (#6306)
(void)strxfrm(nullptr, src, 0);
(void)strxfrm(nullptr, src, 1);
(void)strxfrm(nullptr, src, count);
// cppcheck-suppress nullPointer
return strxfrm(dest, nullptr, count);
}

std::size_t nullPointer_wcsxfrm(wchar_t *dest, const wchar_t *src, std::size_t count)
{
(void)wcsxfrm(dest, src, count);
// In case the 3rd argument is 0, the 1st argument is permitted to be a null pointer. (#6306)
(void)wcsxfrm(nullptr, src, 0);
(void)wcsxfrm(nullptr, src, 1);
(void)wcsxfrm(nullptr, src, count);
// cppcheck-suppress nullPointer
return wcsxfrm(dest, nullptr, count);
}

void nullPointer_asctime(void)
{
const struct tm *tm = 0;
Expand Down
Loading