Why Polyspace Code Prover does not consider 'memcpy' declaration in default way & for that I am getting MISRA C violations of Rule 17.3?
조회 수: 2 (최근 30일)
이전 댓글 표시
While performing static code analysis by using Polyspace Code Prover Tool, I am facing the below violation
'A function shall not be declared implicitly.
Function 'memcpy' has no visible prototype when called.
And the options compiler type is 'tasking' , C standard version is defined-by-compiler are configured in polyspace
Why polyspace does not consider memcpy declaraion as in default way and How to resolve the issue.
댓글 수: 0
답변 (1개)
Anirban
2022년 6월 28일
Is it possible that you have not #include-d the header string.h in the source file that has the memcpy usage?
For instance, this small code will show a violation of rule 17.3 if you remove the line #include <string.h> :
#include <stdio.h>
#include <string.h>
int main () {
const char src[50] = "Hello";
char dest[50];
memcpy(dest, src, strlen(src)+1);
return(0);
}
If this is the case, your analysis log should also contain a warning :
Warning: the prototype for function 'memcpy' is unknown
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Generate Report에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!