Skip to contentSkip to conversation

bootconfig: give the footer size static_assert a message

PATCH In review Sasha Levin 2 participants 2 messages Oct 11 – Oct 12

Subsystems (3)
lore
Share & tools
lore

Sasha Levin

author maintainer
#0 lore raw

PATCH 1/1 bootconfig: give the footer size static_assert a message

static_assert() without a message is a C23 feature, so clang warns:

main.c:498:56: warning: '_Static_assert' with no message is a C23 extension [-Wc23-extensions]

Add a message.

Fixes 6ed5e20466c79 ("bootconfig: Fix unaligned access when building footer")
Assisted-by LLM
---
 tools/bootconfig/main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/bootconfig/main.c +2 -1
index 17d971d47f879..df05340358578 100644
@@ -495,7 +495,8 @@ static int apply_xbc(const char *path, const char *xbc_path)
 	footer.size = htole32(size);
 	footer.csum = htole32(csum);
 	memcpy(footer.magic, BOOTCONFIG_MAGIC, BOOTCONFIG_MAGIC_LEN);
-	static_assert(sizeof(footer) == BOOTCONFIG_FOOTER_SIZE);
+	static_assert(sizeof(footer) == BOOTCONFIG_FOOTER_SIZE,
+		      "bootconfig footer size mismatch");
 	memcpy(data + size, &footer, BOOTCONFIG_FOOTER_SIZE);
 
 	total_size = size + BOOTCONFIG_FOOTER_SIZE;
Signature · 1 line
2.53.0
#1 lore raw
Quoted 10 lines · Sasha Levin

static_assert() without a message is a C23 feature, so clang warns:

main.c:498:56: warning: '_Static_assert' with no message is a C23 extension [-Wc23-extensions]

Add a message.

Fixes 6ed5e20466c79 ("bootconfig: Fix unaligned access when building footer")
Assisted-by LLM

Looks good to me. Let me pick it.

Thanks!

Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>