From 08b2c1be44d7759bae62009e02293e8ee063bf30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Mon, 21 Feb 2022 10:50:38 +0100 Subject: [PATCH] Add "UNUSED(fctx);" to FCTXTRACE*() macro stubs Commit 21ae6bb1b2e561802f77e8f5726233899d5e7520 removed most uses of the 'fctx' variable from the rctx_dispfail() function: it is now only needed by the FCTXTRACE3() macro. However, when --enable-querytrace is not in effect, that macro evaluates to a list of UNUSED() macros that does not include "UNUSED(fctx);". This triggers the following compilation warning when building without --enable-querytrace: resolver.c: In function 'rctx_dispfail': resolver.c:7888:21: warning: unused variable 'fctx' [-Wunused-variable] 7888 | fetchctx_t *fctx = rctx->fctx; | ^~~~ Fix by adding "UNUSED(fctx);" lines to all FCTXTRACE*() macros. This is safe to do because all of those macros use the 'fctx' local variable, so there is no danger of introducing new errors caused by use of undeclared identifiers. (cherry picked from commit b645e28167b28b11fb88f27258b98484acacaada) --- lib/dns/resolver.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index 9610608fb8..2c5c50ab38 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -121,28 +121,33 @@ UNUSED(r); \ UNUSED(m); \ } while (0) -#define FCTXTRACE(m) \ - do { \ - UNUSED(m); \ +#define FCTXTRACE(m) \ + do { \ + UNUSED(fctx); \ + UNUSED(m); \ } while (0) -#define FCTXTRACE2(m1, m2) \ - do { \ - UNUSED(m1); \ - UNUSED(m2); \ +#define FCTXTRACE2(m1, m2) \ + do { \ + UNUSED(fctx); \ + UNUSED(m1); \ + UNUSED(m2); \ } while (0) -#define FCTXTRACE3(m1, res) \ - do { \ - UNUSED(m1); \ - UNUSED(res); \ +#define FCTXTRACE3(m1, res) \ + do { \ + UNUSED(fctx); \ + UNUSED(m1); \ + UNUSED(res); \ } while (0) #define FCTXTRACE4(m1, m2, res) \ do { \ + UNUSED(fctx); \ UNUSED(m1); \ UNUSED(m2); \ UNUSED(res); \ } while (0) #define FCTXTRACE5(m1, m2, v) \ do { \ + UNUSED(fctx); \ UNUSED(m1); \ UNUSED(m2); \ UNUSED(v); \ @@ -9553,9 +9558,7 @@ rctx_resend(respctx_t *rctx, dns_adbaddrinfo_t *addrinfo) { */ static isc_result_t rctx_next(respctx_t *rctx) { -#ifdef WANT_QUERYTRACE fetchctx_t *fctx = rctx->fctx; -#endif /* ifdef WANT_QUERYTRACE */ isc_result_t result; FCTXTRACE("nextitem");