[PATCH] D24289: Add warning when assigning enums to bitfields without an explicit unsigned underlying type

Nico Weber via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 8 13:10:50 PDT 2016

thakis added inline comments.

Comment at: include/clang/Basic/DiagnosticSemaKinds.td:2962
@@ -2959,1 +2961,3 @@
+  "the enum %0 an unsigned underlying type">,
+  InGroup<DiagGroup<"signed-enum-bitfield">>, DefaultIgnore;
 def warn_attribute_packed_for_bitfield : Warning<
Hm, isn't the more safe default to have it on by default? A "what you're doing isn't portable" warning seems useful, and people who don't care can easily turn it off. And if it's not off by default, it's hard for people who do care to turn it on (they'll have to know about the warning).

Maybe it should be off-by-default but part of -Wall?


More information about the cfe-commits mailing list