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 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!