gnu/bsd.cfg: Cleanup redundant configuration for timercmp() and add more tests.
This commit is contained in:
parent
afe05d019c
commit
da29a1f56b
18
cfg/bsd.cfg
18
cfg/bsd.cfg
|
@ -39,24 +39,6 @@
|
||||||
</arg>
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
<!-- int timercmp(struct timeval *a, struct timeval *b, CMP)-->
|
<!-- int timercmp(struct timeval *a, struct timeval *b, CMP)-->
|
||||||
<function name="timercmp">
|
|
||||||
<noreturn>false</noreturn>
|
|
||||||
<leak-ignore/>
|
|
||||||
<use-retval/>
|
|
||||||
<returnValue type="int"/>
|
|
||||||
<arg nr="1" direction="in">
|
|
||||||
<not-uninit/>
|
|
||||||
<not-null/>
|
|
||||||
</arg>
|
|
||||||
<arg nr="2" direction="in">
|
|
||||||
<not-uninit/>
|
|
||||||
<not-null/>
|
|
||||||
</arg>
|
|
||||||
<arg nr="3" direction="in">
|
|
||||||
<not-uninit/>
|
|
||||||
</arg>
|
|
||||||
</function>
|
|
||||||
<!-- int timercmp(struct timeval *a, struct timeval *b, CMP)-->
|
|
||||||
<define name="timercmp(a,b,CMP)" value="(((a)->tv_sec == (b)->tv_sec) ? ((a)->tv_usec CMP (b)->tv_usec) : ((a)->tv_sec CMP (b)->tv_sec))"/>
|
<define name="timercmp(a,b,CMP)" value="(((a)->tv_sec == (b)->tv_sec) ? ((a)->tv_usec CMP (b)->tv_usec) : ((a)->tv_sec CMP (b)->tv_sec))"/>
|
||||||
<!-- https://www.freebsd.org/cgi/man.cgi?query=fts&sektion=3 -->
|
<!-- https://www.freebsd.org/cgi/man.cgi?query=fts&sektion=3 -->
|
||||||
<!-- FTS * fts_open(char * const *path_argv, int options, int (*compar)(const FTSENT * const *, const FTSENT * const *)); -->
|
<!-- FTS * fts_open(char * const *path_argv, int options, int (*compar)(const FTSENT * const *, const FTSENT * const *)); -->
|
||||||
|
|
18
cfg/gnu.cfg
18
cfg/gnu.cfg
|
@ -128,24 +128,6 @@
|
||||||
</arg>
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
<!-- int timercmp(struct timeval *a, struct timeval *b, CMP)-->
|
<!-- int timercmp(struct timeval *a, struct timeval *b, CMP)-->
|
||||||
<function name="timercmp">
|
|
||||||
<noreturn>false</noreturn>
|
|
||||||
<leak-ignore/>
|
|
||||||
<use-retval/>
|
|
||||||
<returnValue type="int"/>
|
|
||||||
<arg nr="1" direction="in">
|
|
||||||
<not-uninit/>
|
|
||||||
<not-null/>
|
|
||||||
</arg>
|
|
||||||
<arg nr="2" direction="in">
|
|
||||||
<not-uninit/>
|
|
||||||
<not-null/>
|
|
||||||
</arg>
|
|
||||||
<arg nr="3" direction="in">
|
|
||||||
<not-uninit/>
|
|
||||||
</arg>
|
|
||||||
</function>
|
|
||||||
<!-- int timercmp(struct timeval *a, struct timeval *b, CMP)-->
|
|
||||||
<define name="timercmp(a,b,CMP)" value="(((a)->tv_sec == (b)->tv_sec) ? ((a)->tv_usec CMP (b)->tv_usec) : ((a)->tv_sec CMP (b)->tv_sec))"/>
|
<define name="timercmp(a,b,CMP)" value="(((a)->tv_sec == (b)->tv_sec) ? ((a)->tv_usec CMP (b)->tv_usec) : ((a)->tv_sec CMP (b)->tv_sec))"/>
|
||||||
<!-- int __builtin_types_compatible_p (type1, type2) -->
|
<!-- int __builtin_types_compatible_p (type1, type2) -->
|
||||||
<function name="__builtin_types_compatible_p">
|
<function name="__builtin_types_compatible_p">
|
||||||
|
|
|
@ -22,6 +22,26 @@ void verify_timercmp(struct timeval t)
|
||||||
(void)timercmp(&t, &t, >);
|
(void)timercmp(&t, &t, >);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// False negative: #9346
|
||||||
|
void uninitvar_timercmp(struct timeval t)
|
||||||
|
{
|
||||||
|
struct timeval uninit;
|
||||||
|
(void)timercmp(&t, &uninit, <);
|
||||||
|
(void)timercmp(&uninit, &t, <=);
|
||||||
|
(void)timercmp(&uninit, &uninit, ==);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nullPointer_timercmp(struct timeval t)
|
||||||
|
{
|
||||||
|
struct timeval *p=0;
|
||||||
|
// cppcheck-suppress nullPointer
|
||||||
|
(void)timercmp(&t, p, <);
|
||||||
|
// cppcheck-suppress nullPointer
|
||||||
|
(void)timercmp(p, &t, <=);
|
||||||
|
// cppcheck-suppress nullPointer
|
||||||
|
(void)timercmp(p, p, ==);
|
||||||
|
}
|
||||||
|
|
||||||
// size_t strlcat(char *dst, const char *src, size_t size);
|
// size_t strlcat(char *dst, const char *src, size_t size);
|
||||||
void uninitvar_strlcat(char *Ct, const char *S, size_t N)
|
void uninitvar_strlcat(char *Ct, const char *S, size_t N)
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// #9323, #9331
|
// #9323, #9331
|
||||||
void verify_timercmp(struct timeval t)
|
void syntaxError_timercmp(struct timeval t)
|
||||||
{
|
{
|
||||||
(void)timercmp(&t, &t, <);
|
(void)timercmp(&t, &t, <);
|
||||||
(void)timercmp(&t, &t, <=);
|
(void)timercmp(&t, &t, <=);
|
||||||
|
@ -28,6 +28,26 @@ void verify_timercmp(struct timeval t)
|
||||||
(void)timercmp(&t, &t, >);
|
(void)timercmp(&t, &t, >);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// False negative: #9346
|
||||||
|
void uninitvar_timercmp(struct timeval t)
|
||||||
|
{
|
||||||
|
struct timeval uninit;
|
||||||
|
(void)timercmp(&t, &uninit, <);
|
||||||
|
(void)timercmp(&uninit, &t, <=);
|
||||||
|
(void)timercmp(&uninit, &uninit, ==);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nullPointer_timercmp(struct timeval t)
|
||||||
|
{
|
||||||
|
struct timeval *p=0;
|
||||||
|
// cppcheck-suppress nullPointer
|
||||||
|
(void)timercmp(&t, p, <);
|
||||||
|
// cppcheck-suppress nullPointer
|
||||||
|
(void)timercmp(p, &t, <=);
|
||||||
|
// cppcheck-suppress nullPointer
|
||||||
|
(void)timercmp(p, p, ==);
|
||||||
|
}
|
||||||
|
|
||||||
// Declaration necessary because there is no specific / portable header.
|
// Declaration necessary because there is no specific / portable header.
|
||||||
extern void *xcalloc(size_t nmemb, size_t size);
|
extern void *xcalloc(size_t nmemb, size_t size);
|
||||||
extern void *xmalloc(size_t size);
|
extern void *xmalloc(size_t size);
|
||||||
|
|
Loading…
Reference in New Issue