ccan: update for newer compiler fixes.
What changed, and why it matters
This commit updates two internal helper files in the CCAN library to silence compiler warnings when building with newer GCC versions. One change swaps an anonymous struct for an anonymous union inside a compile-time size check, because GCC 13 objects to anonymous structs in certain macro expansions. The other avoids passing a NULL pointer into a printf-style error message. There is no indication these changes fix a runtime security bug; they are build-hygiene fixes.
No security action required; treat as normal build-compatibility maintenance.
Security signals we found
No security-relevant signal in commit message or diff
Changes are compiler warning fixes, not vulnerability fixes
No mention of CVE, security bug, researcher credit, or exploit
Evidence from the diff
The patch updates ccan/build_assert/build_assert.h to use an anonymous union instead of an anonymous struct in BUILD_ASSERT_OR_ZERO when HAVE_STATIC_ASSERT is defined, avoiding a GCC 13 -Werror warning about anonymous structs declared inside parameter lists via typeof() in typesafe_cb macros. It also hardens ccan/cdump/cdump.c’s complain() function to skip line counting and substitute an empty string when ps->toks[0].p is NULL, preventing a -Werror=format-overflow warning. Both changes are defensive and compile-time/diagnostic in nature.
Changed components
ccan/ccan/build_assert/build_assert.hccan/ccan/cdump/cdump.cInspect captured patch +7 / −4
### ccan/README
@@ -1,3 +1,3 @@
CCAN imported from https://github.com/rustyrussell/ccan.
-CCAN version: 17db5e13
+CCAN version: 0ca68d37
### ccan/ccan/build_assert/build_assert.h
@@ -52,8 +52,11 @@
* + BUILD_ASSERT_OR_ZERO(offsetof(struct foo, string) == 0))
*/
#if HAVE_STATIC_ASSERT
+/* Union, not struct: gcc-13 -O3 warns "anonymous struct declared inside
+ * parameter list" when the expansion is embedded in a parameter list via
+ * typeof(), as typesafe_cb() does with its @arg. This works */
#define BUILD_ASSERT_OR_ZERO(cond) \
- (sizeof(struct { _Static_assert(cond, "BUILD_ASSERT_OR_ZERO"); char c; }) - 1)
+ (sizeof(union { _Static_assert(cond, "BUILD_ASSERT_OR_ZERO"); char c; }) - 1)
#else
#define BUILD_ASSERT_OR_ZERO(cond) \
(sizeof(char [1 - 2*!(cond)]) - 1)
### ccan/ccan/cdump/cdump.c
@@ -262,7 +262,7 @@ static void complain(struct parse_state *ps, const char *complaint)
unsigned int linenum;
const char *p = ps->code;
- for (linenum = 1; p < ps->toks[0].p; linenum++) {
+ for (linenum = 1; ps->toks[0].p && p < ps->toks[0].p; linenum++) {
p = strchr(p+1, '\n');
if (!p)
break;
@@ -271,7 +271,7 @@ static void complain(struct parse_state *ps, const char *complaint)
tal_append_fmt(&ps->complaints,
"Line %u: '%.*s': %s\n",
linenum, (int)ps->toks[0].len,
- ps->toks[0].p, complaint);
+ ps->toks[0].p ? ps->toks[0].p : "", complaint);
}
static void tok_take_unknown_statement(struct parse_state *ps)Why this scored 14/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.