Skip to main content

IAR Embedded Workbench for RISC-V 3.40

MISRAC2004-5.4

In this section:
Synopsis

(Required) A tag name shall be a unique identifier.

Enabled by default

Yes

Severity/Certainty

Low/Medium

lowmedium.png
Full description

A class, struct, union, or enum declaration was found that clashes with a previous declaration. This check is identical to MISRAC++2008-2-10-4, MISRAC2012-Rule-5.7.

This is a link analysis check.

Coding standards
MISRA C:2004 5.4

(Required) A tag name shall be a unique identifier.

MISRA C:2012 Rule-5.7

(Required) A tag name shall be a unique identifier

MISRA C++ 2008 2-10-4

(Required) A class, union or enum name (including qualification, if any) shall be a unique identifier.

Code examples

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

void f1()
{
  class TYPE {};
}

void f2()
{
  float TYPE; // non-compliant
}

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

void f1()
{
  class TYPE {};
}

void f2()
{
  float a_type;
}