]> git.ozlabs.org Git - ccan/commit
tcon: fix overzealous gcc 12.2.0 warning.
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 9 Jan 2023 02:09:22 +0000 (12:39 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Thu, 16 Mar 2023 23:22:47 +0000 (09:52 +1030)
commite62e48b9d841dd7bac1955df177c2089eb4719b7
treefc8499802236169edf90f84cf5dfa03e482b1161
parent374a0b73cc507b3121cf40cab77dc0d3eab794a9
tcon: fix overzealous gcc 12.2.0 warning.

At least with -fsanitize=address -fno-sanitize-recover=address -fsanitize=undefined -fno-sanitize-recover=undefined:

```
/home/rusty/devel/cvs/ccan/ccan/tcon/test/compile_fail-container1.c:Compile gave warnings without -DFAIL:
In file included from /home/rusty/devel/cvs/ccan/ccan/tcon/test/compile_fail-container1.c:3:
/home/rusty/devel/cvs/ccan/ccan/tcon/tcon.h: In function ‘main’:
/home/rusty/devel/cvs/ccan/ccan/tcon/tcon.h:332:25: warning: ‘innerp’ may be used uninitialized [-Wmaybe-uninitialized]
  332 |                 canary, tcon_container_of_((member_ptr),                \
      |                         ^~~~~~~~~~~~~~~~~~
/home/rusty/devel/cvs/ccan/ccan/tcon/tcon.h:335:21: note: by argument 1 of type ‘const void *’ to ‘tcon_container_of_’ declared here
  335 | static inline void *tcon_container_of_(const void *member_ptr, size_t offset)
      |                     ^~~~~~~~~~~~~~~~~~
/home/rusty/devel/cvs/ccan/ccan/tcon/test/compile_fail-container1.c:28:22: note: ‘ovar’ declared here
   28 |         struct outer ovar;
      |                      ^~~~

tcon: Total score: 33/41 FAIL!
```
ccan/tcon/test/compile_fail-container1.c
ccan/tcon/test/compile_fail-container1w.c
ccan/tcon/test/compile_fail-container3.c
ccan/tcon/test/compile_fail-container3w.c