mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-03-04 03:40:38 +01:00
glib-aux/tests: fix and extend static assertions for NMIPAddr alignment
On m68k, integers are 2-byte aligned. Hence the assertion was wrong.
What we really want to check, is that NMIPAddr has not a smaller
alignment than in_addr_t and similar.
While at it, also assert the alignment for NMEtherAddr.
(cherry picked from commit 835554a4db)
This commit is contained in:
parent
6169ad5930
commit
d1d91a91f4
2 changed files with 7 additions and 4 deletions
|
|
@ -133,6 +133,9 @@ nm_ip_addr_set_from_variant(int addr_family, gpointer dst, GVariant *variant, in
|
|||
|
||||
G_STATIC_ASSERT(ETH_ALEN == sizeof(struct ether_addr));
|
||||
G_STATIC_ASSERT(ETH_ALEN == 6);
|
||||
G_STATIC_ASSERT(ETH_ALEN == sizeof(NMEtherAddr));
|
||||
|
||||
G_STATIC_ASSERT(_nm_alignof(struct ether_addr) <= _nm_alignof(NMEtherAddr));
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
|
|||
|
|
@ -23,10 +23,10 @@ G_STATIC_ASSERT(NM_AF_INET_SIZE == sizeof(in_addr_t));
|
|||
G_STATIC_ASSERT(NM_AF_INET_SIZE == sizeof(struct in_addr));
|
||||
G_STATIC_ASSERT(NM_AF_INET6_SIZE == sizeof(struct in6_addr));
|
||||
|
||||
G_STATIC_ASSERT(4 == _nm_alignof(in_addr_t));
|
||||
G_STATIC_ASSERT(4 == _nm_alignof(struct in_addr));
|
||||
G_STATIC_ASSERT(4 == _nm_alignof(struct in6_addr));
|
||||
G_STATIC_ASSERT(4 == _nm_alignof(NMIPAddr));
|
||||
G_STATIC_ASSERT(_nm_alignof(in_addr_t) <= _nm_alignof(NMIPAddr));
|
||||
G_STATIC_ASSERT(_nm_alignof(struct in_addr) <= _nm_alignof(NMIPAddr));
|
||||
G_STATIC_ASSERT(_nm_alignof(struct in6_addr) <= _nm_alignof(NMIPAddr));
|
||||
G_STATIC_ASSERT(_nm_alignof(NMEtherAddr) <= _nm_alignof(NMIPAddr));
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue