Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

MSC17-C-EX2: When control flow is intended to cross statement labels, it is permissible to omit the break statement. In these instances, the unusual control flow must be explicitly documentedmade clear, such as by adding the [[fallthrough]] C2x attribute, the __attribute__((__fallthrough__)) GNU extension, or a simple comment.

Code Block
bgColor#CCCCFF
langc
enum WidgetEnum { WE_W, WE_X, WE_Y, WE_Z } widget_type;
widget_type = WE_X;

switch (widget_type) {
  case WE_W:
    /* ... */
    /* No break; processfall through caseto forthe WE_X as wellcase */
  case WE_X:
    /* ... */
    break;
  case WE_Y: case WE_Z:
    /* ... */
    break;
  default: /* Can't happen */
	 /* Handle error condition */
}

...

PRQA QAC_v

Tool

Version

Checker

Description

Astrée
Include Page
Astrée_V
Astrée_V
switch-clause-break
switch-clause-break-continue
switch-clause-break-return
Fully checked
CodeSonar
Include Page
CodeSonar_V
CodeSonar_V
LANG.STRUCT.SW.MBMissing break
Compass/ROSE




Coverity

Include Page
Coverity_V
Coverity_V

MISSING_BREAK

Can find instances of missing break statement between cases in switch statement

ECLAIR

Include Page
ECLAIR_V
ECLAIR_V

CC2.MSC17

Fully implemented

Helix QAC

Include Page
Helix QAC_V
Helix QAC_V

C2003
Klocwork
Include Page
Klocwork_V
Klocwork_V
MISRA.SWITCH.WELL_FORMED.BREAK.2012
LDRA tool suite
Include Page
LDRA_V
LDRA_V
62 SFully implemented
Parasoft C/C++test
Include Page
Parasoft_V
Parasoft_V
MISRA2004-15_2
CERT_C-MSC17-aMissing break statement between cases in a switch statement
PC-lint Plus

Include Page
PC-lint Plus_V
PC-lint Plus_V

616, 825

Fully supported

Polyspace Bug Finder

Include Page
Polyspace Bug Finder_V

Fully implemented

Polyspace Bug Finder

R2016b

_V

CERT C: Rec. MSC17-CChecks for missing Missing break of switch case No comments at the end of switch case without a break statement(rec. fully covered)
PVS-StudioPRQA QA-C

Include Page

PRQA QA-C_v2003

PVS-

Studio_V

PVS-Studio

6.22

_V

V796
RuleChecker
Include Page
RuleChecker_V
RuleChecker_V
switch-clause-break
switch-clause-break-continue
switch-clause-break-return
Fully checked
SonarQube C/C++ Plugin
Include Page
SonarQube C/C++ Plugin_V
SonarQube C/C++ Plugin_V
NonEmptyCaseWithoutBreak

...