[previous] 3315 [next] This 'switch' statement contains only a single path - it is redundant.
Switch statements REFERENCE - ISO:C90-6.6.4.2 The switch Statement

This switch statement is a redundant construct. It contains only a single path

For example:


/*PRQA S 2017,3227,3408 ++*/

extern int foo(int n)
{
    int r;

    switch(n)
    {
    default:
        r = n;
        break;
    }                           /* Message 3315 */

    return r;
}


MISRA-C:2004 Rules applicable to message 3315:

Rule  15.5  (Required) Every switch statement shall have at least one case clause.


QA·C Source Code Analyser 8.1
MISRA-C:2004 Compliance Module 3.2
© 2012 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index | MISRA-C:2004 Rule Index Contents