]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUILD: debug: fix build issues in COUNT_IF() with -Wunused-value
authorWilly Tarreau <w@1wt.eu>
Mon, 9 Dec 2024 16:49:08 +0000 (17:49 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 9 Dec 2024 17:04:51 +0000 (18:04 +0100)
commitd6dc8120c0b13f896bf2628e611517701aff7a38
treec7c6326c36ab797d43f9a71993be95af50cf8a2a
parentcb21db04c748a77122c118a3d526fdc058ca564f
BUILD: debug: fix build issues in COUNT_IF() with -Wunused-value

Commit 7f64bb79fd ("BUG/MINOR: debug: COUNT_IF() should return true/false")
allowed the COUNT_IF() macro to return the evaluated value. This is handy
to place it in "if ()" conditions and count them at the same time. When
glitches are disabled, the condition is just returned as-is, but most call
places do not use the result, making some compilers complain. In addition,
while reviewing this, it was noticed that when DEBUG_STRICT=0, the macro
would still be replaced by a "do { } while (0)" statement, which not only
does not evaluate the expression, but also cannot return anything. Ditto
for COUNT_IF_HOT().

Let's make sure both are always properly evaluated now.
include/haproxy/bug.h