posix.cfg: Fixed FP bufferOverlap-warning of bcopy() and added more tests.
This commit is contained in:
parent
1fb1b22bae
commit
dad1a68e51
|
@ -3935,11 +3935,11 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s
|
||||||
</arg>
|
</arg>
|
||||||
<warn severity="style" reason="Obsolescent" alternatives="scalbln,scalblnf,scalbln,scalbn,scalbnf,scalbnl"/>
|
<warn severity="style" reason="Obsolescent" alternatives="scalbln,scalblnf,scalbln,scalbn,scalbnf,scalbnl"/>
|
||||||
</function>
|
</function>
|
||||||
|
<!-- https://man7.org/linux/man-pages/man3/bcopy.3.html -->
|
||||||
<!-- void bcopy(const void *s1, void *s2, size_t n); -->
|
<!-- void bcopy(const void *s1, void *s2, size_t n); -->
|
||||||
<function name="bcopy">
|
<function name="bcopy">
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<leak-ignore/>
|
<leak-ignore/>
|
||||||
<not-overlapping-data ptr1-arg="1" ptr2-arg="2" size-arg="3"/>
|
|
||||||
<arg nr="1" direction="in">
|
<arg nr="1" direction="in">
|
||||||
<not-null/>
|
<not-null/>
|
||||||
<not-uninit/>
|
<not-uninit/>
|
||||||
|
|
|
@ -300,8 +300,20 @@ void overlappingWriteFunction_bcopy(char *buf, const size_t count)
|
||||||
// cppcheck-suppress bcopyCalled
|
// cppcheck-suppress bcopyCalled
|
||||||
bcopy(&buf[0], &buf[3], 3U); // no-overlap
|
bcopy(&buf[0], &buf[3], 3U); // no-overlap
|
||||||
// cppcheck-suppress bcopyCalled
|
// cppcheck-suppress bcopyCalled
|
||||||
// cppcheck-suppress overlappingWriteFunction
|
bcopy(&buf[0], &buf[3], 4U); // The result is correct, even when both areas overlap.
|
||||||
bcopy(&buf[0], &buf[3], 4U);
|
}
|
||||||
|
|
||||||
|
void nullPointer_bcopy(const void *src, void *dest, size_t n)
|
||||||
|
{
|
||||||
|
// No warning shall be shown:
|
||||||
|
// cppcheck-suppress bcopyCalled
|
||||||
|
bcopy(src, dest, n);
|
||||||
|
// cppcheck-suppress bcopyCalled
|
||||||
|
// cppcheck-suppress nullPointer
|
||||||
|
bcopy(NULL, dest, n);
|
||||||
|
// cppcheck-suppress bcopyCalled
|
||||||
|
// cppcheck-suppress nullPointer
|
||||||
|
bcopy(src, NULL, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
void overlappingWriteFunction_memccpy(unsigned char *src, unsigned char *dest, int c, size_t count)
|
void overlappingWriteFunction_memccpy(unsigned char *src, unsigned char *dest, int c, size_t count)
|
||||||
|
|
Loading…
Reference in New Issue