[PATCH] D43162: [Parser] (C++) Make -Wextra-semi slightly more useful

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 28 11:06:25 PST 2018


lebedev.ri added a comment.

Thank you for the feedback!

In https://reviews.llvm.org/D43162#1022427, @rsmith wrote:

> This is the wrong way to deal with this. The only thing that should ever be controlled by -W flags is whether the warnings in that group appear, not whether warnings in other groups appear. The principle is that -W flags should behave "as if" they filter the diagnostic output of Clang. (We actually depend on this in the implicit modules implementation, to allow modules to be reused in compilation modes where a different set of warning flags is enabled.) `isIgnored` exists only to allow the computations leading to the emission of a diagnostic to be skipped if the diagnostic will not actually be emitted.


Aha, i see. To be noted, this is how it is currently already done for `warn_cxx98_compat_no_newline_eof`/`warn_no_newline_eof`
https://github.com/llvm-mirror/clang/blob/f828172bcfd7d6d10497c645c3cc5eee321cd669/lib/Lex/Lexer.cpp#L2684-L2695
https://github.com/llvm-mirror/clang/blob/f828172bcfd7d6d10497c645c3cc5eee321cd669/include/clang/Basic/DiagnosticLexKinds.td#L58-L63
So i'm guessing that^ should be fixed too?

> The right thing to do is to add a new warning group for the `warn_cxx98_compat_top_level_semi` warning, and make that a subgroup of the `-Wextra-semi` group. That way `-Wno-extra-semi` can be used to turn off both the C++98 extension warning and the C++11 compatibility warning. Take a look at the `*BinaryLiteral` warning groups for an example of how to do this. (That case is a little more complex because there's also a warning group for the corresponding case in C.)

I'll look into it, but *right now* this sounds like it won't do what i'm trying to do here. Hopefully i'm just missing the point :)


Repository:
  rC Clang

https://reviews.llvm.org/D43162





More information about the cfe-commits mailing list