posix.cfg: Added support for pthread_attr_getstack() and pthread_attr_setstack().

This commit is contained in:
orbitcowboy 2022-12-22 10:07:50 +01:00
parent ccbc6a3b72
commit 5991c33b0e
2 changed files with 72 additions and 11 deletions

View File

@ -4672,6 +4672,23 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s
</arg>
<warn severity="style" reason="Obsolescent" alternatives="pthread_attr_setstack"/>
</function>
<!-- https://man7.org/linux/man-pages/man3/pthread_attr_setstack.3.html -->
<!-- int pthread_attr_setstack(pthread_attr_t *attr, void *stackaddr, size_t stacksize); -->
<function name="pthread_attr_setstack">
<returnValue type="int"/>
<noreturn>false</noreturn>
<use-retval/>
<arg nr="1" direction="in">
<not-uninit/>
<not-null/>
</arg>
<arg nr="2" direction="in">
<not-uninit/>
</arg>
<arg nr="3" direction="in">
<not-uninit/>
</arg>
</function>
<!-- int pthread_attr_getstackaddr(const pthread_attr_t *attr, void **stackaddr); -->
<function name="pthread_attr_getstackaddr">
<noreturn>false</noreturn>
@ -4703,6 +4720,25 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s
<valid>0:</valid>
</arg>
</function>
<!-- https://man7.org/linux/man-pages/man3/pthread_attr_getstack.3.html -->
<!-- int pthread_attr_getstack(const pthread_attr_t *restrict attr, void **restrict stackaddr, size_t *restrict stacksize); -->
<function name="pthread_attr_getstack">
<returnValue type="int"/>
<noreturn>false</noreturn>
<use-retval/>
<arg nr="1" direction="in">
<not-uninit/>
<not-null/>
</arg>
<arg nr="2" direction="out">
<not-null/>
<not-uninit/>
</arg>
<arg nr="3" direction="out">
<not-null/>
<not-uninit/>
</arg>
</function>
<!-- int pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *stacksize); -->
<!-- int pthread_attr_getguardsize(const pthread_attr_t *attr, size_t *guardsize); -->
<function name="pthread_attr_getstacksize,pthread_attr_getguardsize">

View File

@ -36,6 +36,31 @@
#include <string.h>
#include <strings.h>
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