mks004 - 2022-04-22

I am running into a suspected FP when checking this piece of code with Cppcheck 2.7 MISRA addon.

test.c

#include "test.h"

void func1 (void)
{
}

test.h

#if defined(TEST_H_)
#else
#define TEST_H_

void func1(void);

#endif

This is flagged as MISRA rule 8.4 violation:

..\test.c:3:6: style: A compatible declaration shall be visible when an object or function with external linkage is defined [misra-c2012-8.4]
void func1 (void)
     ^

However changing test.h to this version fixes the issue:

#if !defined(TEST_H_)
#define TEST_H_

void func1(void);

#endif