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

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 28 10:56:33 PST 2018


rsmith added a comment.

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.

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.)


Repository:
  rC Clang

https://reviews.llvm.org/D43162





More information about the cfe-commits mailing list