From: Willy Tarreau Date: Sat, 17 Sep 2022 09:15:29 +0000 (+0200) Subject: BUILD: fd: fix a build warning on the DWCAS X-Git-Tag: v2.7-dev6~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=85af76070412d87433fbcaa0ac95833a8470159d;p=thirdparty%2Fhaproxy.git BUILD: fd: fix a build warning on the DWCAS Ilya reported in issue #1816 a build warning on armhf (promoted to error here since -Werror): src/fd.c: In function fd_rm_from_fd_list: src/fd.c:209:87: error: passing argument 3 of __ha_cas_dw discards volatile qualifier from pointer target type [-Werror=discarded-array-qualifiers] 209 | unlikely(!_HA_ATOMIC_DWCAS(((long *)&fdtab[fd].update), (uint32_t *)&cur_list.u32, &next_list.u32)) | ^~~~~~~~~~~~~~ This happens only on such an architecture because the DWCAS requires the pointer not the value, and gcc seems to be needlessly picky about reading a const from a volatile! This may safely be backported to older versions. --- diff --git a/src/fd.c b/src/fd.c index 65036c74f3..eb386a830d 100644 --- a/src/fd.c +++ b/src/fd.c @@ -206,7 +206,7 @@ lock_self: #ifdef HA_CAS_IS_8B unlikely(!_HA_ATOMIC_CAS(((uint64_t *)&fdtab[fd].update), (uint64_t *)&cur_list.u64, next_list.u64)) #else - unlikely(!_HA_ATOMIC_DWCAS(((long *)&fdtab[fd].update), (uint32_t *)&cur_list.u32, &next_list.u32)) + unlikely(!_HA_ATOMIC_DWCAS(((long *)&fdtab[fd].update), (uint32_t *)&cur_list.u32, (const uint32_t *)&next_list.u32)) #endif ); next = cur_list.ent.next;