[cfe-dev] clang -M compatibility with gcc
Marc Espie via cfe-dev
cfe-dev at lists.llvm.org
Mon Jun 5 03:09:50 PDT 2017
All the gcc docs, up to 7.1, say about -M:
> Passing -M to the driver implies -E, and suppresses warnings with an implicit -w.
However, this is not the case with clang.
Observe
$ cat a.c
#warning this is a warning
$ cc -M a.c
a.o: a.c
$ clang -M a.c
a.c:1:2: warning: this is a warning [-W#warnings]
#warning this is a warning
^
a.o: a.c
1 warning generated.
$ clang -M -w a.c
a.o: a.c
$ cat a.c
#warning this is a warning
$ cc -M a.c
a.o: a.c
$ clang -M a.c
a.c:1:2: warning: this is a warning [-W#warnings]
#warning this is a warning
^
a.o: a.c
1 warning generated.
$ clang -M -w a.c
a.o: a.c
$
Is this intentional ? From what I've gathered, one of clang's goals
is compatibility with gcc.
Otherwise, I'm going to have to stuff explicit -w in depend tools... which
should be more or less "safe" (are there compilers which support -M and not -w)
More information about the cfe-dev
mailing list