aboutsummaryrefslogtreecommitdiff
path: root/libcpp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2023-11-22 13:20:58 -0500
committerJason Merrill <jason@redhat.com>2023-12-13 15:34:13 -0500
commitb7e4a4c626eeeb32c291d5bbbaa148c5081b6bfd (patch)
treecde073c8479e884ecb5dc8745b2afd56c0995c3f /libcpp
parent7362543f00c9d3359d9377b800080fb421414ee5 (diff)
downloadgcc-b7e4a4c626eeeb32c291d5bbbaa148c5081b6bfd.zip
gcc-b7e4a4c626eeeb32c291d5bbbaa148c5081b6bfd.tar.gz
gcc-b7e4a4c626eeeb32c291d5bbbaa148c5081b6bfd.tar.bz2
c-family: -Waddress-of-packed-member and casts
-Waddress-of-packed-member, in addition to the documented warning about actually taking the address of a packed member, also warns about casting from a pointer to a TYPE_PACKED type to a pointer to a type with greater alignment. This wrongly warns if the source is a pointer to enum when -fshort-enums is on, since that is also represented by TYPE_PACKED. And there's already -Wcast-align to catch casting from pointer to less aligned type (packed or otherwise) to pointer to more aligned type; even apart from the enum problem, this seems like a somewhat arbitrary subset of that warning. So, this patch removes the undocumented type-based warning from -Waddress-of-packed-member. Some of the tests where the warning is desirable I changed to use -Wcast-align=strict instead. The ones that require -Wno-incompatible-pointer-types I just removed. gcc/c-family/ChangeLog: * c-warn.cc (check_address_or_pointer_of_packed_member): Remove warning based on TYPE_PACKED. gcc/testsuite/ChangeLog: * c-c++-common/Waddress-of-packed-member-1.c: Don't expect a warning on the cast cases. * c-c++-common/pr51628-35.c: Use -Wcast-align=strict. * g++.dg/warn/Waddress-of-packed-member3.C: Likewise. * gcc.dg/pr88928.c: Likewise. * gcc.dg/pr51628-20.c: Removed. * gcc.dg/pr51628-21.c: Removed. * gcc.dg/pr51628-25.c: Removed.
Diffstat (limited to 'libcpp')
0 files changed, 0 insertions, 0 deletions