[PATCH] D131307: [Clang] Allow downgrading to a warning the diagnostic for setting a non fixed enum to a value outside the range of the enumeration values

Shoaib Meenai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 16 10:48:20 PDT 2022


smeenai added a comment.

In D131307#3726643 <https://reviews.llvm.org/D131307#3726643>, @erichkeane wrote:

> In D131307#3726631 <https://reviews.llvm.org/D131307#3726631>, @smeenai wrote:
>
>> Was it intended that the warning generated here isn't silenced by `-w`, only by an explicit `-Wno-enum-constexpr-conversion` (or `-Wno-everythning`), and that `-Wno-error` doesn't downgrade the error? See https://godbolt.org/z/s9qPveTWG for an example.
>
> Yes, we've discussed that on this thread before: Clang's behavior for warnings-as-default-error require explicit suppression of the warning, and isn't effected by global warning/error settings.



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

> In D131307#3726631 <https://reviews.llvm.org/D131307#3726631>, @smeenai wrote:
>
>> Was it intended that the warning generated here isn't silenced by `-w`, only by an explicit `-Wno-enum-constexpr-conversion` (or `-Wno-everythning`), and that `-Wno-error` doesn't downgrade the error? See https://godbolt.org/z/s9qPveTWG for an example.
>
> Yes. That is the behavior of warnings which default to an error. The idea is: these aren't really *warnings*, they're errors that we let users downgrade for <reasons>. So `-w` shouldn't blanket disable them or users will be very surprised when that warning turns into a hard error in a future version of the compiler. So you have to explicitly disable warnings that default to an error. The same is true for `-Wno-error` behavior.

Yup, all of that makes sense; I just missed it earlier. Thank you both :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131307



More information about the cfe-commits mailing list