30-11-2018, 10:17 AM
OK, but rule 8.7 for once leaves absolutely no room for any interpretation whatsoever (not always the case with MISRA rules).
Let's assume your whole project consists of foo.c and main.c:
The external declaration of foo violates rule 8.7 because it is not called from any other module.
The external declaration of bar on the other hand would be a bug / false positive from your code checking tool if reported as violation of rule 8.7 because it is called from main.c.
Let's assume your whole project consists of foo.c and main.c:
Code:
/* 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;
}
The external declaration of foo violates rule 8.7 because it is not called from any other module.
The external declaration of bar on the other hand would be a bug / false positive from your code checking tool if reported as violation of rule 8.7 because it is called from main.c.
<t></t>