MINOR: fd/threads: silence a build warning with threads disabled
authorWilly Tarreau <w@1wt.eu>
Thu, 26 Nov 2020 21:25:10 +0000 (22:25 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 26 Nov 2020 21:28:41 +0000 (22:28 +0100)
commit5a7d6ebf2c38ab004fb85a7465470c1be8d1c47e
treef4b9df5cc89eae9543139bec197b7402d89a5f2a
parentb34aee82947cf3ad8b49801318d1fc0d3c7a0b2b
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.
src/fd.c