BUILD: thread: add parenthesis around values of locking macros
authorWilly Tarreau <w@1wt.eu>
Fri, 12 Jun 2020 09:42:25 +0000 (11:42 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 21 Jul 2020 16:08:56 +0000 (18:08 +0200)
commitb35a82ba015aa347209a0285320608fcc71a9690
treed1c2d7715c772cef39822e5dbbfeeeb7fb856e11
parente79b08a704c4960af599ee0320646ac3f8bf99c1
BUILD: thread: add parenthesis around values of locking macros

clang just failed on fd.c with this error:

  src/fd.c:491:9: error: logical not is only applied to the left hand side of this comparison [-Werror,-Wlogical-not-parentheses]
          while (HA_SPIN_TRYLOCK(OTHER_LOCK, &log_lock) != 0) {
                 ^                                      ~~
That's because this expands to this:

          while (!pl_try_s(&log_lock) != 0) {

Let's just add parenthesis in the TRYLOCK macros to avoid this.
This may need to be backported if commit df187875d ("BUG/MEDIUM: log:
don't hold the log lock during writev() on a file descriptor") is
backported as well as it seems to be the first one to trigger it.

(cherry picked from commit db57a142c31016ff3e0dd533cb2b4de14445781e)
[wt: applied by hand to common/hathread.h since context significantly differed]
Signed-off-by: Willy Tarreau <w@1wt.eu>
include/common/hathreads.h