Getting MISRA 10.1 in Polyspace 2012a for Pointer to Structures.

1 visualización (últimos 30 días)
Karan
Karan el 26 de Jun. de 2014
Respondida: Karan el 15 de Jul. de 2014
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?

Respuesta aceptada

Karan
Karan el 15 de Jul. de 2014
Thanks Alex.

Más respuestas (1)

Alexandre De Barros
Alexandre De Barros el 15 de Jul. de 2014
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

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by