From: Aaron Merey Date: Tue, 7 Oct 2025 16:34:17 +0000 (-0400) Subject: gelf_getnote.c: Replace assert with eu_static_assert X-Git-Tag: elfutils-0.194~10 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=da66afc5162502a22c7a00f07c4e81734f86ccb2;p=thirdparty%2Felfutils.git gelf_getnote.c: Replace assert with eu_static_assert Two runtime asserts in gelf_getnote() compare sizeof GElf_Nhdr with Elf32_Ndhr and Elf64_Nhdr. This can be done at compile time using eu_static_assert. Signed-off-by: Aaron Merey --- diff --git a/libelf/gelf_getnote.c b/libelf/gelf_getnote.c index 0f7b9d68..2cf28565 100644 --- a/libelf/gelf_getnote.c +++ b/libelf/gelf_getnote.c @@ -51,8 +51,8 @@ gelf_getnote (Elf_Data *data, size_t offset, GElf_Nhdr *result, /* It's easy to handle this type. It has the same size for 32 and 64 bit objects. */ - assert (sizeof (GElf_Nhdr) == sizeof (Elf32_Nhdr)); - assert (sizeof (GElf_Nhdr) == sizeof (Elf64_Nhdr)); + eu_static_assert (sizeof (GElf_Nhdr) == sizeof (Elf32_Nhdr)); + eu_static_assert (sizeof (GElf_Nhdr) == sizeof (Elf64_Nhdr)); rwlock_rdlock (((Elf_Data_Scn *) data)->s->elf->lock);