diff --git a/cfg/std.cfg b/cfg/std.cfg index a050cba96..033f595b3 100644 --- a/cfg/std.cfg +++ b/cfg/std.cfg @@ -288,7 +288,7 @@ - + false diff --git a/test/cfg/std.c b/test/cfg/std.c index 98d3093a5..810020c94 100644 --- a/test/cfg/std.c +++ b/test/cfg/std.c @@ -3386,3 +3386,62 @@ void ignoredReturnValue_abs(int i) // cppcheck-suppress constStatement abs(-100); } + +void nullPointer_asctime(void) +{ + struct tm *tm = 0; + // cppcheck-suppress obsoleteFunctionsasctime + // cppcheck-suppress nullPointer + (void)asctime(tm); + // cppcheck-suppress obsoleteFunctionsasctime + // cppcheck-suppress nullPointer + (void)asctime(0); +} + +void nullPointer_wcsftime(size_t maxsize) +{ + wchar_t* ptr = 0; + wchar_t* format = 0; + struct tm* timeptr = 0; + // cppcheck-suppress nullPointer + (void)wcsftime(ptr,maxsize,format,timeptr); + // cppcheck-suppress nullPointer + (void)wcsftime(0,maxsize,0,0); +} + +void nullPointer_fegetenv(void) +{ + fenv_t* envp = 0; + // cppcheck-suppress nullPointer + (void)fegetenv(envp); + // cppcheck-suppress nullPointer + (void)fegetenv(0); +} + +void nullPointer_fegetexceptflag(int excepts) +{ + fexcept_t* flagp = 0; + // cppcheck-suppress nullPointer + (void)fegetexceptflag(flagp,excepts); + // cppcheck-suppress nullPointer + (void)fegetexceptflag(0,excepts); +} + +void nullPointer_feholdexcept(void) +{ + fenv_t* envp = 0; + // cppcheck-suppress nullPointer + (void)feholdexcept(envp); + // cppcheck-suppress nullPointer + (void)feholdexcept(0); +} + +void nullPointer_fesetenv(void) +{ + fenv_t* envp = 0; + // cppcheck-suppress nullPointer + (void)fesetenv(envp); + // cppcheck-suppress nullPointer + (void)fesetenv(0); +} + diff --git a/test/cfg/std.cpp b/test/cfg/std.cpp index e86394363..677260b59 100644 --- a/test/cfg/std.cpp +++ b/test/cfg/std.cpp @@ -2741,3 +2741,61 @@ void ignoredReturnValue_abs(int i) // cppcheck-suppress constStatement std::abs(-199); } + +void nullPointer_asctime(void) +{ + struct tm *tm = 0; + // cppcheck-suppress obsoleteFunctionsasctime + // cppcheck-suppress nullPointer + (void)std::asctime(tm); + // cppcheck-suppress obsoleteFunctionsasctime + // cppcheck-suppress nullPointer + (void)std::asctime(0); +} + +void nullPointer_wcsftime(size_t maxsize) +{ + wchar_t* ptr = 0; + wchar_t* format = 0; + struct tm* timeptr = 0; + // cppcheck-suppress nullPointer + (void)std::wcsftime(ptr,maxsize,format,timeptr); + // cppcheck-suppress nullPointer + (void)std::wcsftime(0,maxsize,0,0); +} + +void nullPointer_fegetenv(void) +{ + fenv_t* envp = 0; + // cppcheck-suppress nullPointer + (void)std::fegetenv(envp); + // cppcheck-suppress nullPointer + (void)std::fegetenv(0); +} + +void nullPointer_fegetexceptflag(int excepts) +{ + fexcept_t* flagp = 0; + // cppcheck-suppress nullPointer + (void)std::fegetexceptflag(flagp,excepts); + // cppcheck-suppress nullPointer + (void)std::fegetexceptflag(0,excepts); +} + +void nullPointer_feholdexcept(void) +{ + fenv_t* envp = 0; + // cppcheck-suppress nullPointer + (void)std::feholdexcept(envp); + // cppcheck-suppress nullPointer + (void)std::feholdexcept(0); +} + +void nullPointer_fesetenv(void) +{ + fenv_t* envp = 0; + // cppcheck-suppress nullPointer + (void)std::fesetenv(envp); + // cppcheck-suppress nullPointer + (void)std::fesetenv(0); +}