MISRAC2012-Rule-8.5_b
In this section:
Synopsis
(Required) An external object or function shall be declared once in one and only one file.
Enabled by default
Yes
Severity/Certainty
Low/Medium

Full description
Multiple declarations of the same external object or function were found. This check is identical to MISRAC2004-8.8_b, MISRAC++2008-3-2-3_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
- MISRA C++ 2008 3-2-3
(Required) A type, object or function that is used in multiple translation units shall be declared 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;
}