]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: ssl: silence a build warning when threads are disabled
authorWilly Tarreau <w@1wt.eu>
Fri, 1 May 2020 09:38:39 +0000 (11:38 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 1 May 2020 09:41:36 +0000 (11:41 +0200)
Building without threads now shows this warning:

src/ssl_sock.c: In function 'cli_io_handler_commit_cert':
src/ssl_sock.c:12121:24: warning: unused variable 'bind_conf' [-Wunused-variable]
      struct bind_conf *bind_conf = ckchi->bind_conf;
                        ^~~~~~~~~

This is because the variable is needed only to unlock the structure, and
the unlock operation does nothing in this case. Let's mark the variable
__maybe_unused for this, but it would be convenient in the long term if
we could make the thread macros pretend they consume the argument so that
this remains less visible outside.

No backport is needed.

src/ssl_sock.c

index 967b425cf550d0080262e904d69e7c5bb976725f..6462c3e59293d10105fb5bcbcd2def4525faa7b7 100644 (file)
@@ -12118,7 +12118,7 @@ static int cli_io_handler_commit_cert(struct appctx *appctx)
 
                                /* delete the old sni_ctx, the old ckch_insts and the ckch_store */
                                list_for_each_entry_safe(ckchi, ckchis, &old_ckchs->ckch_inst, by_ckchs) {
-                                       struct bind_conf *bind_conf = ckchi->bind_conf;
+                                       struct bind_conf __maybe_unused *bind_conf = ckchi->bind_conf;
 
                                        HA_RWLOCK_WRLOCK(SNI_LOCK, &bind_conf->sni_lock);
                                        ckch_inst_free(ckchi);