aboutgitcodebugslistschat
path: root/inany.h
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2023-11-30 13:02:07 +1100
committerStefano Brivio <sbrivio@redhat.com>2023-12-04 09:50:53 +0100
commitba84a3b17af81e25bb11854052c616f399ba4275 (patch)
tree44fb5652f75eb813d7fc0c6b6cf55e114c7b93fd /inany.h
parentd902bb62885257ce19556e12af625abba67ccefd (diff)
downloadpasst-ba84a3b17af81e25bb11854052c616f399ba4275.tar
passt-ba84a3b17af81e25bb11854052c616f399ba4275.tar.gz
passt-ba84a3b17af81e25bb11854052c616f399ba4275.tar.bz2
passt-ba84a3b17af81e25bb11854052c616f399ba4275.tar.lz
passt-ba84a3b17af81e25bb11854052c616f399ba4275.tar.xz
passt-ba84a3b17af81e25bb11854052c616f399ba4275.tar.zst
passt-ba84a3b17af81e25bb11854052c616f399ba4275.zip
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>
Diffstat (limited to 'inany.h')
-rw-r--r--inany.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/inany.h b/inany.h
index 85a18e3..90e98f1 100644
--- a/inany.h
+++ b/inany.h
@@ -27,8 +27,10 @@ union inany_addr {
} v4mapped;
uint32_t u32[4];
};
-static_assert(sizeof(union inany_addr) == sizeof(struct in6_addr));
-static_assert(_Alignof(union inany_addr) == _Alignof(uint32_t));
+static_assert(sizeof(union inany_addr) == sizeof(struct in6_addr),
+ "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
* @addr: IPv4 or IPv6 address