Skip to main content

IAR Embedded Workbench for RX 5.20

MISRAC2004-18.1

In this section:
Synopsis

(Required) All structure and union types shall be complete at the end of the translation unit.

Enabled by default

Yes

Severity/Certainty

Low/Medium

lowmedium.png
Full description

Structs and unions were found that are used without being defined.

Coding standards
MISRA C:2004 18.1

(Required) All structure and union types shall be complete at the end of the translation unit.

Code examples

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

struct incomplete;

void example(struct incomplete *p)
{
}

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

struct complete {
    int x;
};

void example(struct complete *p)
{
}