From 5991c33b0e280ecdf07c5b91303f27307305766c Mon Sep 17 00:00:00 2001 From: orbitcowboy Date: Thu, 22 Dec 2022 10:07:50 +0100 Subject: [PATCH] posix.cfg: Added support for pthread_attr_getstack() and pthread_attr_setstack(). --- cfg/posix.cfg | 58 +++++++++++++++++++++++++++++++++++++++--------- test/cfg/posix.c | 25 +++++++++++++++++++++ 2 files changed, 72 insertions(+), 11 deletions(-) diff --git a/cfg/posix.cfg b/cfg/posix.cfg index cce1045b3..fdda32e01 100644 --- a/cfg/posix.cfg +++ b/cfg/posix.cfg @@ -2045,8 +2045,8 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s false - @@ -2324,7 +2324,7 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s - + @@ -4672,6 +4672,23 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s + + + + + false + + + + + + + + + + + + false @@ -4703,6 +4720,25 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s 0: + + + + + false + + + + + + + + + + + + + + @@ -5016,7 +5052,7 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s - + @@ -5043,8 +5079,8 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s - - + + @@ -5158,8 +5194,8 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s - - + + @@ -5168,7 +5204,7 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s - @@ -5240,7 +5276,7 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s - @@ -6230,7 +6266,7 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s - diff --git a/test/cfg/posix.c b/test/cfg/posix.c index 303a81cad..293248aab 100644 --- a/test/cfg/posix.c +++ b/test/cfg/posix.c @@ -36,6 +36,31 @@ #include #include +void nullPointer_pthread_attr_getstack(const pthread_attr_t *attr, void *stackaddr, size_t stacksize) { + // cppcheck-suppress nullPointer + (void) pthread_attr_getstack(NULL, &stackaddr, &stacksize); + // cppcheck-suppress nullPointer + (void) pthread_attr_getstack(attr, NULL, &stacksize); + // cppcheck-suppress nullPointer + (void) pthread_attr_getstack(attr, &stackaddr, NULL); + // cppcheck-suppress nullPointer + (void) pthread_attr_getstack(NULL, NULL, &stacksize); + // cppcheck-suppress nullPointer + (void) pthread_attr_getstack(NULL, &stackaddr, NULL); + // cppcheck-suppress nullPointer + (void) pthread_attr_getstack(attr, NULL, NULL); + // cppcheck-suppress nullPointer + (void) pthread_attr_getstack(NULL, NULL, NULL); +} + +void nullPointer_pthread_attr_setstack(pthread_attr_t *attr) { + // cppcheck-suppress nullPointer + (void) pthread_attr_setstack(NULL, NULL, 0); + (void) pthread_attr_setstack(attr, NULL, 0); + // cppcheck-suppress nullPointer + (void) pthread_attr_setstack(NULL, (void*) 1, 0); +} + void nullPointer_setkey(const char *key) { // cppcheck-suppress nullPointer