HomeFreeBSD

Fix clang 4.0.0 warnings about taking the address of a packed member of

Description

Fix clang 4.0.0 warnings about taking the address of a packed member of
struct ip in ping(8):

sbin/ping/ping.c:1684:53: error: taking address of packed member
'ip_src' of class or structure 'ip' may result in an unaligned pointer
value [-Werror,-Waddress-of-packed-member]

(void)printf(" %s ", inet_ntoa(*(struct in_addr *)&ip->ip_src.s_addr));
                                                   ^~~~~~~~~~~~~~~~~

sbin/ping/ping.c:1685:53: error: taking address of packed member
'ip_dst' of class or structure 'ip' may result in an unaligned pointer
value [-Werror,-Waddress-of-packed-member]

(void)printf(" %s ", inet_ntoa(*(struct in_addr *)&ip->ip_dst.s_addr));
                                                   ^~~~~~~~~~~~~~~~~

MFC after: 3 days

Details

Provenance
dimAuthored on
Parents
rS311529: Remove '-vd' option to make iasl(8) reproducible.
Branches
Unknown
Tags
Unknown