Hi,
Using the lates CCS : 5.1.0.09000 for MSP430 the following example raises a violation against rule 10.1 but for my understanding it should NOT
Is this a bug in the MISRA rule 10.1 implementation?
Another 2 issues not related to the above are:
Header file in430.h has no header guard.
This is complained by rule 19.15. However for this rule the selection entry in the dialog for MISRA settings is missing
An so far the last one:
if in430.h is included and intrinsics.h some function declarations are redundant on violates rule 8.8
Regards
Rainer
/* Compile this example with all required MISRA rules activated
*
*
*/
void main(void);
void main(void) {
int s16Var1;
unsigned int u16Var2;
/* should be allowed: implicit widening to integer type of the same signedness */
s16Var1 = 4 * 256; /* but violates 10.1 */
u16Var2 = 4U * 256U; /* but violates 10.1 */
/* make implicit widening explicit */
s16Var1 = (int)4 * 256; /* ok */
u16Var2 = (unsigned int )4U * 256U; /* ok */
/* calm down compiler unused variable warning */
s16Var1 = s16Var1;
u16Var2 = u16Var2;
}