[PATCH] D132851: Further update -Wbitfield-constant-conversion for 1-bit bitfield

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 29 07:53:42 PDT 2022


aaron.ballman updated this revision to Diff 456343.
aaron.ballman added a comment.

Added a test case for `true` in C++, and added similar logic for C to reduce the chance for false positives. If the user uses `true` (the macro from stdbool.h), they're signaling an intent that the field is used in boolean contexts. The macro expands to `1` (per spec) but should not be diagnosed because the actual value stored only needs to be nonzero to have the correct boolean semantics.


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

https://reviews.llvm.org/D132851

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Basic/DiagnosticGroups.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaChecking.cpp
  clang/test/CXX/drs/dr6xx.cpp
  clang/test/Sema/constant-conversion.c
  clang/test/SemaCXX/constant-conversion.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132851.456343.patch
Type: text/x-patch
Size: 8468 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220829/cf2a2c1f/attachment-0001.bin>


More information about the cfe-commits mailing list