From: Christopher Faulet Date: Fri, 27 Nov 2026 14:45:19 +0000 (+0100) Subject: BUILD: compression: silence clang's -Wunused-but-set-global on comp_res_ring X-Git-Url: https://git.kaiwu.me/http/%22../$%7BGITURL%7D/static/gitweb.js?a=commitdiff_plain;h=0995c1d72fad4773544b2c6e974b0a4f7b4508da;p=haproxy.git BUILD: compression: silence clang's -Wunused-but-set-global on comp_res_ring 'comp_res_ring' is only read when haproxy is built with SLZ, but it is unconditionally set by the 'tune.comp.res.ring' parser, so with a zlib-only or compression-less build, clang 23 reports: src/compression.c:334:12: error: variable 'comp_res_ring' set but not used [-Werror,-Wunused-but-set-global] This is caught by the Fedora rawhide CI (clang 23) which builds with USE_ZLIB=1. It is not reproducible with older clang releases which do not implement -Wunused-but-set-global. Mark the variable __maybe_unused like other variables only used conditionally. This does not change the behavior: the keyword remains accepted and ignored on non-SLZ builds. This should fix the issue #3609. --- diff --git a/src/compression.c b/src/compression.c index 12dd1a33f..e66386251 100644 --- a/src/compression.c +++ b/src/compression.c @@ -331,7 +331,7 @@ static int comp_identity_end(struct comp_ctx **comp_ctx) /* "tune.comp.res.ring": rings may be allocated for responses (default) */ -static int comp_res_ring __read_mostly = 1; +static int comp_res_ring __read_mostly __maybe_unused = 1; #ifdef USE_SLZ