[PATCH] D127452: [clang-cl][MSVC] Map /external:Wn n=1-4 to -Wsystem-headers
Stephen Long via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 9 15:42:33 PDT 2022
steplong added a comment.
I don't think /external:Wn behaves exactly like -Wsystem-headers. /external:Wn applies /Wn to the system headers, while -Wsystem-headers applies whatever is on the command line to the system headers. I think /external:Wn behaves more like:
// foo.c
#pragma clang diagnostic push
#pragma clang diagnostic warning "-Wall"
#include <foo.h>
#pragma clang diagnostic pop
void foo() {
int i = 10;
}
// foo.h
void bar() {
int i = 11;
}
Passing `-Wno-unused-variables` only suppresses the warnings for the rest of `foo.c`. It looks like the pragma is calling `setSeverityForGroup(diag::Flavor::WarningOrError, "-Wall", diag::Serverity::Warning, Loc)`, but I'm not sure where we can detect that we are including a system header.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127452/new/
https://reviews.llvm.org/D127452
More information about the cfe-commits
mailing list