From f23111d6104de9102b4aab15675e1cbf5b781260 Mon Sep 17 00:00:00 2001 From: orbitcowboy Date: Tue, 10 May 2022 19:21:07 +0200 Subject: [PATCH] std.cfg: Improved configuration of some (since C11) functions. --- cfg/std.cfg | 1 + test/cfg/std.c | 10 ++++++++++ test/cfg/std.cpp | 31 +++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+) diff --git a/cfg/std.cfg b/cfg/std.cfg index f93c5e0ed..cd024c437 100644 --- a/cfg/std.cfg +++ b/cfg/std.cfg @@ -8004,6 +8004,7 @@ initializer list (7) string& replace (const_iterator i1, const_iterator i2, init + diff --git a/test/cfg/std.c b/test/cfg/std.c index d5f5adc66..9637f322f 100644 --- a/test/cfg/std.c +++ b/test/cfg/std.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -4363,6 +4364,15 @@ void nullPointer_system(char *c) (void)system(c); } +int nullPointer_mtx_timedlock( mtx_t *restrict mutex, const struct timespec *restrict time_point ) +{ + // cppcheck-suppress nullPointer + (void) mtx_timedlock(NULL, time_point); + // cppcheck-suppress nullPointer + (void) mtx_timedlock(mutex, NULL); + return mtx_timedlock(mutex, time_point); +} + void uninitvar_zonetime(void) { time_t *tp; diff --git a/test/cfg/std.cpp b/test/cfg/std.cpp index 56ea2bddc..5f10bdeb1 100644 --- a/test/cfg/std.cpp +++ b/test/cfg/std.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -3660,6 +3661,36 @@ void uninitvar_system(void) (void)std::system(c); } +void nullPointer_mtx_destroy( mtx_t *mutex ) +{ + // cppcheck-suppress nullPointer + mtx_destroy(nullptr); + mtx_destroy(mutex); +} + +void nullPointer_mtx_lock( mtx_t *mutex ) +{ + // cppcheck-suppress nullPointer + mtx_lock(nullptr); + mtx_lock(mutex); +} + +void nullPointer_mtx_trylock( mtx_t *mutex ) +{ + // cppcheck-suppress nullPointer + mtx_trylock(nullptr); + mtx_trylock(mutex); +} + +int nullPointer_mtx_timedlock( mtx_t *mutex, const struct timespec *time_point ) +{ + // cppcheck-suppress nullPointer + (void) mtx_timedlock(nullptr, time_point); + // cppcheck-suppress nullPointer + (void) mtx_timedlock(mutex, nullptr); + return mtx_timedlock(mutex, time_point); +} + void nullPointer_system(char *c) { // If a null pointer is given, command processor is checked for existence