Getting MISRA 10.1 in Polyspace 2012a for Pointer to Structures.
조회 수: 1 (최근 30일)
이전 댓글 표시
I am getting the following MISRA(10.1) warning: Implicit conversion of the expression of underlying type'unsigned char' to the type 'signed int' that is not a wider integer type of the same signedness.
The code is as below:
#define ETH_BUFF_NOTUSED ((uint8)0U)
typedef struct Eth_BuffTableType
{
uint8* Eth_BuffPtr; /* Pointer to the Transmit Buffer*/
uint8 Eth_BuffStatus; /* Buffer status free or used */
uint8 Eth_StTxCnfn; /* Tx confirmation requested */
uint8 Eth_FrameTxReq; /* Request for frame transmission */
}Eth_BuffTableType;
static Eth_BuffTableType *Eth_TxBuffTablePtr;
uint8 TempVar;
(Eth_TxBuffTablePtr + TempVar)->Eth_BuffStatus = ETH_BUFF_NOTUSED;
Question: Why the pointer 'Eth_TxBuffTablePtr' is considered as a 'signed_int'.? Is there any option to make pointer to structures as unsigned while running MISRA checks?
댓글 수: 0
채택된 답변
추가 답변 (1개)
Alexandre De Barros
2014년 7월 15일
Hi Karan!
Polyspace refers here to the ISO C99 standard to define a pointer equivalent to an int, especially the paragraph 6.3.2.3, sections 5 and 6. But this leads to the violation of 10.1, like in your code. This is why we may change this behaviour for a future version. There is no option to make pointers unsigned but I can suggest you to add a code annotation in order to automatically justify and comment the rule 10.1 on this line. Follow this link for more information on code annotations: http://www.mathworks.fr/fr/help/bugfinder/ug/annotate-code-for-rule-violations.html
Alex
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Run Settings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!