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!