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

Yan Wang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 26 16:01:45 PDT 2017


yawanng added a comment.

In https://reviews.llvm.org/D34114#800253, @rsmith wrote:

> Some concrete suggestions throughout the patch, but I think we should take a step back and reconsider this warning approach: it seems bizarre for us to warn on any packed struct that happens to contain a `char`. It would make sense to warn if an `__attribute__((packed))` written in the source has *no* effect (because it's applied to a struct where all fields already have alignment 1, or because it's applied to a field that has alignment 1) -- even then I'm not entirely convinced this is a valuable warning, but I assume there's some reason you want to warn on it :)


Yes. I think the only case for this warning to be useful is when the alignment of the class or struct is 1 byte :-)


https://reviews.llvm.org/D34114





More information about the cfe-commits mailing list