[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

Jordan Rupprecht via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 6 12:57:04 PDT 2023


rupprecht added a comment.

In D150226#4353907 <https://reviews.llvm.org/D150226#4353907>, @aaron.ballman wrote:

> In D150226#4353863 <https://reviews.llvm.org/D150226#4353863>, @jyknight wrote:
>
>> When looking for errors in existing codebases, don't forget that this diagnostic is currently suppressed by default in system headers. So this patch is moving from "no diagnostics for code in system headers" to "unconditional hard error in system headers". Just removing `-Wno-enum-constexpr-conversion` from your build flags is insufficient to test that this patch won't break code!
>>
>> I haven't done any tests, but I'm rather skeptical that this change is going to be viable without breaking stuff, still.
>
> +1 to needing to test against system headers, but also: if we find any system headers that would be broken by this, we should proactively alert the owners of those headers so that they understand there's urgency to getting the fixes into their headers so that the entire ecosystem isn't held back. Alternatively, if it's just one problematic system header in an LTS release somewhere, we could perhaps put in a compat hack for just that header so we can move forward.

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.


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

https://reviews.llvm.org/D150226



More information about the cfe-commits mailing list