Skip to main content

IAR Embedded Workbench for RL78 5.20

MISRAC2012-Rule-8.6

In this section:
Synopsis

(Required) An identifier with external linkage shall have exactly one external definition.

Enabled by default

Yes

Severity/Certainty

Low/Medium

lowmedium.png
Full description

Multiple definitions or no definition were found for an external object or function. This check is identical to MISRAC2004-8.9, MISRAC++2008-3-2-4, MISRAC++2023-6.2.3_a.

This is a link analysis check.

Coding standards
MISRA C:2004 8.9

(Required) An identifier with external linkage shall have exactly one external definition.

MISRA C++ 2008 3-2-4

(Required) An identifier with external linkage shall have exactly one definition.

MISRA C++ 2023 6.2.3

(Required) The source code used to implement an entity shall appear only once

Code examples

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

int foo(int v);
int example() {
  return foo(3);
}
  

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

extern int x;

extern void example(void);

int x = 1;

void example(void) {
}