If I have a file with MACRO_B calling MACRO_A - which is defined in header-a.h, cppclean will complain that header-a.h doesn't need to be included:
Three files to reproduce:
#include "macro-a.h"
#include <stdio.h>
int main( )
{
int result = MY_RESULT(3);
printf("result is %d\n", result);
return 0;
}
#include "macro-a.h"
#define MY_RESULT(c) { \
( MY_REPLACE_MACRO - (c)) \
}
#define MY_REPLACE_MACRO 345
Program compiles as runs as expected, but running cppclean gives a false positive:
cppclean macro-b.h
macro-b.h:1: 'macro-a.h' does not need to be #included
Removing the macro-a.h include leads to a compilation error:
main.c:6:18: error: use of undeclared identifier 'MY_REPLACE_MACRO'
int result = MY_RESULT(3);
^
./macro-b.h:4:7: note: expanded from macro 'MY_RESULT'
( MY_REPLACE_MACRO - (c)) \
If I have a file with
MACRO_BcallingMACRO_A- which is defined inheader-a.h, cppclean will complain thatheader-a.hdoesn't need to be included:Three files to reproduce:
Program compiles as runs as expected, but running cppclean gives a false positive:
Removing the
macro-a.hinclude leads to a compilation error: