Skip to main content

IAR Embedded Workbench for RL78 5.20

MISRAC2004-2.1

In this section:
Synopsis

(Required) Assembler language shall be encapsulated and isolated.

Enabled by default

Yes

Severity/Certainty

Low/Medium

lowmedium.png
Full description

Inline assembler statements were found that are not encapsulated in functions. This check is identical to MISRAC++2008-7-4-3, MISRAC2012-Dir-4.3.

Coding standards
MISRA C:2004 2.1

(Required) Assembler language shall be encapsulated and isolated.

MISRA C:2012 Dir-4.3

(Required) Assembly language shall be encapsulated and isolated

MISRA C++ 2008 7-4-3

(Required) Assembly language shall be encapsulated and isolated.

Code examples

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

int example(int x)
{
  int r;
  asm("");
  return r + 1;
}

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

int example(int x)
{
    asm("");
    return x;
}