![]() |
|
MISRA-C:2004 Rule 14.1: (Required) |
|
||||
![]() | |||||||
A portion of code is unreachable if there is no control flow path from the relevant entry point to that code. For example, unlabelled code following an unconditional control transfer is unreachable:
switch(event){caseE_wakeup:do_wakeup();break;/* unconditional control transfer */do_more();/* Not compliant - unreachable code *//* ... */default:/* ... */break;}
A whole function will be unreachable if there is no means by which it can be called.
Code that is excluded by pre-processor directives is not present following pre-processing, and is therefore not subject to this rule.
QAC messages that encompass this guideline:
| 0594 | Negative 'case' label expression is incompatible with unsigned controlling expression in 'switch' statement. |
| 1460 | 'Switch' label value, %s, not contained in enum type. |
| 1503 | The function '%1s' is defined but is not used within this project. |
| 2008 | Code statements precede the first label in this 'switch' construct. |
| 2742 | This 'if' controlling expression is a constant expression and its value is 'false'. |
| 2744 | This 'while' or 'for' loop controlling expression is a constant expression and its value is 'false'. The loop will not be entered. |
| 2880 | This code is unreachable. |
| 2882 | This 'switch' statement will bypass the initialization of local variables. |
| 3219 | Static function '%s()' is not used within this translation unit. |
|
||
(c) The Motor Industry Research Association, 2004
|
QA C Source Code Analyser 8.1.2
MISRA-C:2004 Compliance Module 3.2 © 2013 Programming Research www.programmingresearch.com |
Personality Groups | Glossary | Message Index | MISRA-C:2004 Rule Index | Contents |