std.cfg: Ensure warnings are issued for passing null pointer to bsearch().

This commit is contained in:
orbitcowboy 2022-04-19 21:21:35 +02:00
parent b7bffaa1a7
commit e0942c1bb4
1 changed files with 10 additions and 0 deletions

View File

@ -2854,6 +2854,16 @@ void uninitvar_vwprintf(wchar_t *Format, va_list Arg)
(void)vwprintf(Format,arg); (void)vwprintf(Format,arg);
} }
void nullPointer_bsearch(void* key, void* base, size_t num, size_t size)
{
// cppcheck-suppress nullPointer
(void)bsearch(NULL,base,num,size,(int (*)(const void*,const void*))strcmp);
// cppcheck-suppress nullPointer
(void)bsearch(key,NULL,num,size,(int (*)(const void*,const void*))strcmp);
// No warning is expected
(void)bsearch(key,base,num,size,(int (*)(const void*,const void*))strcmp);
}
void uninitvar_bsearch(void) void uninitvar_bsearch(void)
{ {
void* key; void* key;