SLAU132Y September 2004 – June 2021
Normally, for the switch expression values 0 and 5, the compiler generates code to test for both 0 and 5 since the compiler must handle the possible values 1−4. The __never_executed( ) intrinsic in Section 7.9.5.2.1 asserts that val cannot take on the values 1−4 and therefore the compiler only needs to generate a single test (val < 6) to handle both case labels.
Additionally, using the __never_executed( ) intrinsic results in the assertion that if val is not 0 or 5 then it has to be 14 and the compiler has no need to generate code to test for val == 14.
The __never_executed( ) intrinsic is only defined when specified as the single statement following a default case label. The compiler ignores the use of the intrinsic in any other context.