]> git.ozlabs.org Git - ccan/commit
tcon: fix warning from gcc when tcon_check_ptr arg is constant.
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 27 Aug 2024 04:12:02 +0000 (13:42 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 27 Aug 2024 04:12:02 +0000 (13:42 +0930)
commit624dbca5fe08119b2c339929afaf9351f70bac26
treef2e999de471fa4f37684cf08c5eccdc69e89c20c
parentf927e4beeaa63ff5596967012b1a84e0d1cc4c49
tcon: fix warning from gcc when tcon_check_ptr arg is constant.

e.g. `&msg`:

```
src/nostrdb.c: In function ‘ndb_ingester_queue_event’:
ccan/ccan/tcon/tcon.h:150:24: error: the address of ‘msg’ will always evaluate as ‘true’ [-Werror=address]
  150 |         (sizeof((expr) ? (expr) : &(x)->_tcon[0].canary) ? (x) : (x))
      |                        ^
ccan/ccan/tcon/tcon.h:116:30: note: in definition of macro ‘tcon_unwrap’
  116 | #define tcon_unwrap(ptr) (&((ptr)->_base))
      |                              ^~~
src/threadpool.h:91:42: note: in expansion of macro ‘tcon_check_ptr’
   91 |         threadpool_dispatch_(tcon_unwrap(tcon_check_ptr((tp), tp_canary, (msg))), (msg))
      |                                          ^~~~~~~~~~~~~~
src/nostrdb.c:4114:16: note: in expansion of macro ‘threadpool_dispatch’
 4114 |         return threadpool_dispatch(&ingester->tp, &msg);
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ccan/tcon/tcon.h