Skip to content

More warning audit fallout - #136

Merged
rustyrussell merged 2 commits into
masterfrom
more-warning-audit-fallout
Sep 14, 2026
Merged

rustyrussell merged 2 commits into
masterfrom
more-warning-audit-fallout

Conversation

@rustyrussell

Copy link
Copy Markdown
Owner

Compiling CLN with recent CCAN revealed two more warnings at higher optimization, which this fixes.

It could be NULL, and technically this is undefined (even though len arg will be 0).
Similar possibility in loop above, so fix that too.

```
ccan/ccan/cdump/cdump.c: In function ‘tok_take_conglom’:
ccan/ccan/cdump/cdump.c:272:35: error: ‘%.*s’ directive argument is null [-Werror=format-overflow=]
  272 |                        "Line %u: '%.*s': %s\n",
      |                                   ^~~~
cc1: all warnings being treated as errors
make: *** [Makefile:1140: ccan-cdump.o] Error 1
make: *** Waiting for unfinished jobs....
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
```
In file included from ccan/ccan/strmap/strmap.h:5,
                 from ./common/memleak.h:4,
                 from lightningd/channel_gossip.c:5:
lightningd/channel_gossip.c: In function ‘broadcast_new_gossip’:
ccan/ccan/build_assert/build_assert.h:56:17: error: anonymous struct declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
   56 |         (sizeof(struct { _Static_assert(cond, "BUILD_ASSERT_OR_ZERO"); char c; }) - 1)
      |                 ^~~~~~
ccan/ccan/typesafe_cb/typesafe_cb.h:35:46: note: in definition of macro ‘typesafe_cb_cast’
   35 |                                              oktype),                   \
      |                                              ^~~~~~
./lightningd/subd.h:184:19: note: in expansion of macro ‘typesafe_cb_preargs’
  184 |                   typesafe_cb_preargs(void, void *,                     \
      |                   ^~~~~~~~~~~~~~~~~~~
lightningd/channel_gossip.c:415:9: note: in expansion of macro ‘subd_req’
  415 |         subd_req(ld->gossip, ld->gossip,
      |         ^~~~~~~~
ccan/ccan/cast/cast.h:47:14: note: in expansion of macro ‘BUILD_ASSERT_OR_ZERO’
   47 |         (0 ? BUILD_ASSERT_OR_ZERO(cast_const_compat1((expr), type)) :   \
      |              ^~~~~~~~~~~~~~~~~~~~
lightningd/channel_gossip.c:417:42: note: in expansion of macro ‘cast_const’
  417 |                  -1, 0, addgossip_reply, cast_const(char *, desc));
      |                                          ^~~~~~~~~~
cc1: all warnings being treated as errors
```

Fortunately, union works (ccan/cast uses this, thanks Kimi!).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
@rustyrussell
rustyrussell merged commit 0ca68d3 into master Sep 14, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant