treewide: Add messages to static_assert() calls
A while ago, we updated passt to require C11, for several reasons, but one was to be able to use static_assert() for build time checks. The C11 version of static_assert() requires a message to print in case of failure as well as the test condition it self. It was extended in C23 to make the message optional, but we don't want to require C23 at this time. Unfortunately we missed that in some of the static_assert()s we already added which use the C23 form without a message. clang-tidy has a warning for this, but for some reason it's not seeming to trigger in the current cases (but did for some I'm working on adding). Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
d902bb6288
commit
ba84a3b17a
1 changed files with 4 additions and 2 deletions
6
inany.h
6
inany.h
|
@ -27,8 +27,10 @@ union inany_addr {
|
||||||
} v4mapped;
|
} v4mapped;
|
||||||
uint32_t u32[4];
|
uint32_t u32[4];
|
||||||
};
|
};
|
||||||
static_assert(sizeof(union inany_addr) == sizeof(struct in6_addr));
|
static_assert(sizeof(union inany_addr) == sizeof(struct in6_addr),
|
||||||
static_assert(_Alignof(union inany_addr) == _Alignof(uint32_t));
|
"union inany_addr is larger than an IPv6 address");
|
||||||
|
static_assert(_Alignof(union inany_addr) == _Alignof(uint32_t),
|
||||||
|
"union inany_addr has unexpected alignment");
|
||||||
|
|
||||||
/** inany_v4 - Extract IPv4 address, if present, from IPv[46] address
|
/** inany_v4 - Extract IPv4 address, if present, from IPv[46] address
|
||||||
* @addr: IPv4 or IPv6 address
|
* @addr: IPv4 or IPv6 address
|
||||||
|
|
Loading…
Reference in a new issue