Skip to main content

IAR Embedded Workbench for Arm 9.70.x

RED-unused-enum-val

In this section:
Synopsis

An enumerated value is not used.

Enabled by default

No

Severity/Certainty

Low/Low

lowlow.png
Full description

An enumerated value is not used. It is either missing, perhaps in a switch, or it could be removed.

This is a link analysis check.

Coding standards

This check does not correspond to any coding standard rules.

Code examples

The following code example fails the check and will give a warning:

enum ABC { A, B, C}; /* Not compliant, C not used.*/

int example(enum ABC v) {
  switch (v) {
    case A: return 1;
    case B: return 2;
  } 
}

The following code example passes the check and will not give a warning about this issue:

enum ABC { A, B }; /* Compliant */

int example(enum ABC v) {
  switch (v) {
    case A: return 1;
    case B: return 2;
  } 
}