BUILD: atomic: make the old HA_ATOMIC_LOAD() support const pointers
authorWilly Tarreau <w@1wt.eu>
Fri, 28 Jan 2022 07:52:57 +0000 (08:52 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 1 Mar 2022 09:49:18 +0000 (10:49 +0100)
commit4bb1483c999fa00052137293229c926aa66e64bf
tree9871c549c411c894cb93933a7178de1c57ae05f7
parente270824bf18a9d1355f7fd6cfb8ad4397f5569dc
BUILD: atomic: make the old HA_ATOMIC_LOAD() support const pointers

We have an implementation of atomic ops for older versions of gcc that
do not provide the __builtin_* API (< 4.4). Recent changes to the pools
broke that in pool_releasable() by having a load from a const pointer,
which doesn't work there due to a temporary local variable that is
declared then assigned. Let's make use of a compount statement to assign
it a value when declaring it.

There's no need to backport this.

(cherry picked from commit 8da23393a1ec3f24dcd408f4b35fdd3d9a141a5f)
[wt: 2.5 on gcc-4.4 is reportedly affected by this as well, e.g. in
 freq_ctr_total()]
Signed-off-by: Willy Tarreau <w@1wt.eu>
include/haproxy/atomic.h