Skip to main content

IAR Embedded Workbench for RX 5.20

MISRAC++2008-3-2-3_b

In this section:
Synopsis

(Required) A type, object or function that is used in multiple translation units shall be declared in one and only one file.

Enabled by default

Yes

Severity/Certainty

Low/Medium

lowmedium.png
Full description

Multiple declarations of the same external object or function were found. This check is identical to MISRAC2004-8.8_b, MISRAC2012-Rule-8.5_b.

This is a link analysis check.

Coding standards
MISRA C:2004 8.8

(Required) An external object or function shall be declared in one and only one file.

MISRA C:2012 Rule-8.5

(Required) An external object or function shall be declared once in one and only one file

Code examples

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

/* file2.c
  extern int foo(int m);
 */
extern int foo(int m);

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

/* file1.c
   extern int foo( int m );
*/
int foo(int m) {
  return m;
}