This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430 TI compiler MISRA rule 10.1, 19.15

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;
}

  • The compiler should not be emitting a diagnostic about violating MISRA rule 10.1 in this case.  I submitted SDSCM00042444 to the SDOWP system to get this fixed.  Feel free to track it with the SDOWP link in my sig below.

    As for the problems with the header file in430.h ...  That file is not part of the compiler release package.  So I cannot comment on it.  I suggest you post in the MSP430 forum about those issues.  I suspect that this header file has not been checked for MISRA compliance.

    Thanks and regards,

    -George