[PATCH] D80751: [clang][diagnostics] Add '-Wundef-prefix' warning option

Zixu Wang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 12 15:59:05 PDT 2020


zixuw added inline comments.


================
Comment at: clang/lib/Lex/PPExpressions.cpp:262
+          // string to UndefPrefixes as an explicit "-Wundef" does.
+          if (UndefPrefixes.empty() ||
+              llvm::any_of(UndefPrefixes,
----------------
arphaman wrote:
> zixuw wrote:
> > ributzka wrote:
> > > What happens when you use `-Werror=undef` and `-Wundef-prefix=<arg>`?
> > Then we only get errors for `undef-prefix=<arg>`. Yes this needs to be fixed.
> > Perhaps a better way to handle the `-Werror=undef` implication of `-Wundef`.
> We should try to fix this in this PR then. Can you check the severity of the diagnostic, and if it's an error always emit it here?
That is an option. But then we lose the ability to intentionally turning just the prefixes into errors, like `-Wundef-prefix=FOO -Werror` or `-Wundef-prefix=BAR -Werror=undef-prefix`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80751/new/

https://reviews.llvm.org/D80751





More information about the cfe-commits mailing list