]> git.ipfire.org Git - thirdparty/systemd.git/commit
libsystemd-network: remove _packed_ attribute to appease the compiler
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 27 Jan 2019 16:09:21 +0000 (17:09 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 4 Feb 2019 19:32:44 +0000 (20:32 +0100)
commite27b9aba30381331905619d62af276bf5f967b8d
tree1342a189272bb75a474a3eef9d3cb9992ec6f3b3
parent00e1adf8b1477e8770a49bc2b0ebc2f611f57906
libsystemd-network: remove _packed_ attribute to appease the compiler

gcc-9 warns whenever the elements of a structure defined with _packed_ are used:

../src/network/networkd-dhcp6.c: In function ‘dhcp6_pd_prefix_assign’:
../src/network/networkd-dhcp6.c:92:53: warning: taking address of packed member of ‘struct <anonymous>’ may result in an unaligned pointer value [-Waddress-of-packed-member]
   92 |         r = manager_dhcp6_prefix_add(link->manager, &p->opt.in6_addr, link);
      |                                                     ^~~~~~~~~~~~~~~~

And the compiler is right, because in principle the alignment could be wrong.
In this particular case it is not, because the structure is carefully defined
not to have holes. Let's remove _packed_ and use compile-time asserts to verify
that the offsets are not changed.
src/libsystemd-network/radv-internal.h