Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 8.7 clarification needed
#4
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:

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>


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)