Consider the following:
a.c:
-------------------------
#define TEST defined(X)
#if TEST
#include <stdlib.h>
#endif
even though it's not standard C, it does compile.
It becomes interesting with the -M option.
$ gcc -M a.c
a.o: a.c
$ clang -M a.c
a.c:3:5: warning: macro expansion producing 'defined' has undefined behavior
[-Wexpansion-to-defined]
#if TEST
^
a.c:1:14: note: expanded from macro 'TEST'
#define TEST defined(X)
^
a.o: a.c
1 warning generated.
$ clang -w -M a.c
a.o: a.c
Reading the description of gcc -M, there's an implicit -w every time.
Obviously not so with clang.
What to do ? try to get clang to be conformant with gcc (and probably
lengthy discussions with upstream), or add an explicit -w in mkdep
to be sure ?