[PATCH] D150226: [Clang] Remove ability to downgrade warning on the diagnostic for setting a non fixed enum to a value outside the range of the enumeration values

James Y Knight via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 6 14:53:38 PDT 2023


jyknight added a comment.

In D150226#4400782 <https://reviews.llvm.org/D150226#4400782>, @rupprecht wrote:

> As a general question/feature request: is there a way to have specific warnings apply even for system headers? It would be nice if I could check what breaks when by adding `-Wsystem-error=enum-constexpr-conversion` to the global build flags. Rebuilding clang w/ this patched in also works, but is a little more difficult/noisy.

I think there's no per-warning flag (you can turn on _all_ of the enabled warnings in system headers with `-Wsystem-headers`), but by modifying the clang sources you can add `ShowInSystemHeader` to the diagnostic.
E.g.

   def warn_constexpr_unscoped_enum_out_of_range : Warning<
     "integer value %0 is outside the valid range of values [%1, %2] for this "
  -  "enumeration type">, DefaultError, InGroup<DiagGroup<"enum-constexpr-conversion">>;
  +  "enumeration type">, DefaultError, InGroup<DiagGroup<"enum-constexpr-conversion">>, ShowInSystemHeader;


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

https://reviews.llvm.org/D150226



More information about the cfe-commits mailing list