[PATCH] D34114: [clang] A better format for unnecessary packed warning.

Chih-Hung Hsieh via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 6 00:56:16 PDT 2017


chh added a comment.

These warnings are triggered by -Wpadded -Wpacked
or clang-tidy's clang-diagnostic-packed check.
I agree that they should be ignored or suppressed in many cases.
What I am not sure is the amount of real positive cases.

I found it too tedious to suppress one warning per struct field,
and hence liked this CL to consolidate those per-field warnings
into one per struct type. With this change we can use one NOLINT to
suppress all such warnings of a struct type, in the header file.

One alternative for users is to ignore these checks or warnings
for the whole compilation unit. That has the risk of masking
out valid warnings to other packed struct types in the same
compilation unit. Since the types are defined in header files,
these warnings would need to be suppressed in all compilation
units that include those header files.

I am not against removing these warnings completely.
If not removed, I hope that we can consolidate multiple
per-field warnings to one at the struct type level.


Repository:
  rL LLVM

https://reviews.llvm.org/D34114





More information about the cfe-commits mailing list