mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-11-09 13:01:00 +01:00
MINOR: fd/threads: silence a build warning with threads disabled
Building with gcc-9.3.0 without threads may result in this warning:
In file included from include/haproxy/api-t.h:36,
from include/haproxy/api.h:33,
from src/fd.c:90:
src/fd.c: In function 'updt_fd_polling':
include/haproxy/fd.h:507:11: warning: array subscript 63 is above array bounds of 'int[1]' [-Warray-bounds]
507 | DISGUISE(write(poller_wr_pipe[tid], &c, 1));
include/haproxy/compiler.h:92:41: note: in definition of macro 'DISGUISE'
92 | #define DISGUISE(v) ({ typeof(v) __v = (v); ALREADY_CHECKED(__v); __v; })
| ^
src/fd.c:113:5: note: while referencing 'poller_wr_pipe'
113 | int poller_wr_pipe[MAX_THREADS]; // Pipe to wake the threads
| ^~~~~~~~~~~~~~
gcc is wrong but this time it cannot be blamed because it doesn't know
that the FD's thread_mask always has at least one bit set. Let's add
the test for all_threads_mask there. It will also remove that test and
drop the else block.
This commit is contained in:
parent
b34aee8294
commit
5a7d6ebf2c
5
src/fd.c
5
src/fd.c
@ -394,10 +394,7 @@ int fd_takeover(int fd, void *expected_owner)
|
||||
|
||||
void updt_fd_polling(const int fd)
|
||||
{
|
||||
if ((fdtab[fd].thread_mask & all_threads_mask) == tid_bit) {
|
||||
|
||||
/* note: we don't have a test-and-set yet in hathreads */
|
||||
|
||||
if (all_threads_mask == 1UL || (fdtab[fd].thread_mask & all_threads_mask) == tid_bit) {
|
||||
if (HA_ATOMIC_BTS(&fdtab[fd].update_mask, tid))
|
||||
return;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user