Closed
Description
Affected rules
- RULE-8-7
Description
The query flags all functions that are called in only one unit, even if that unit is not the one where the function is defined. Technically, if we understand the term "referenced" as "called", this would indeed be a violation of the rule. But according to a MISRA official in this forum post, "referenced" should also include the definition of the function.
Example
Example taken from the forum post mentioned above. Here, bar() is flagged as a violation of the rule even if it is called from main.c.
/* foo.h*/
#ifndef FOO_H
#define FOO_H
extern void foo(void);
extern void bar(void);
#endif
/* foo.c*/
#include "foo.h"
void foo(void)
{
}
void bar(void)
{
foo();
}
/* main.c*/
#include "foo.h"
int main(void)
{
bar();
return 0;
}