blob: e0627e069547e4f12b94b82244818aeff7e408b2 [file]
From ed5851d00b0e7c28cff614b9ca88d9d328c2de3b Mon Sep 17 00:00:00 2001
From: Guangzong Chen <guangzong@google.com>
Date: Fri, 11 Sep 2026 21:11:02 +0000
Subject: [PATCH] ccan: cast pointers to void * in fprintf for %p format
specifier
GCC 15 enables stricter format validation by default, triggering
-Werror=format= when passing non-void pointers (e.g. `const struct list_node *`)
to `%p`:
ccan/ccan/list/list.c: In function 'corrupt':
ccan/ccan/list/list.c:13:52: error: format '%p' expects argument of type 'void *', but argument 4 has type 'const struct list_node *' [-Werror=format=]
13 | "%s: prev corrupt in node %p (%u) of %p\n",
| ~^
| |
| void *
14 | abortstr, node, count, head);
| ~~~~
| |
| const struct list_node *
ccan/ccan/list/list.c:13:63: error: format '%p' expects argument of type 'void *', but argument 6 has type 'const struct list_node *' [-Werror=format=]
13 | "%s: prev corrupt in node %p (%u) of %p\n",
| ~^
| |
| void *
14 | abortstr, node, count, head);
| ~~~~
| |
| const struct list_node *
Per ISO C standard (C99/C11 7.21.6.1), the `%p` conversion specifier
expects an argument of type `void *` or `const void *`. Explicitly cast
`node` and `head` to `(const void *)` to prevent build failures under
modern compiler toolchains with -Werror enabled.
Upstream-Status: Submitted [https://github.com/linux-nvme/libnvme/pull/1146]
Signed-off-by: Guangzong Chen <guangzong@google.com>
---
ccan/ccan/list/list.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ccan/ccan/list/list.c b/ccan/ccan/list/list.c
index 2717fa3f..3916605c 100644
--- a/ccan/ccan/list/list.c
+++ b/ccan/ccan/list/list.c
@@ -11,7 +11,7 @@ static void *corrupt(const char *abortstr,
if (abortstr) {
fprintf(stderr,
"%s: prev corrupt in node %p (%u) of %p\n",
- abortstr, node, count, head);
+ abortstr, (const void *)node, count, (const void *)head);
abort();
}
return NULL;
--
2.46.0