[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:2012 Rules applicable to message 3315:

Rule-16.6  (Required) Every switch statement shall have at least two switch-clauses


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