]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: traces: set a few __maybe_unused on vars used only for traces
authorWilly Tarreau <w@1wt.eu>
Wed, 20 May 2026 07:34:26 +0000 (09:34 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 20 May 2026 09:46:43 +0000 (11:46 +0200)
Certain variables are used only for traces in mux, ssl and quic
essentially, and disabling traces emits warnings, so let's mark
them appropriately.

src/mux_fcgi.c
src/mux_h1.c
src/mux_h2.c
src/mux_spop.c
src/quic_ssl.c
src/quic_tls.c
src/ssl_clienthello.c

index f49b66f7d8fca351bd2a77a519a39cd35638f854..8838be95dddad30ef30cc8214bab1c16ec7c01c6 100644 (file)
@@ -981,7 +981,7 @@ static inline void fcgi_strm_propagate_term_flags(struct fcgi_conn *fconn, struc
  */
 static void fcgi_strm_destroy(struct fcgi_strm *fstrm)
 {
-       struct connection *conn = fstrm->fconn->conn;
+       struct connection __maybe_unused *conn = fstrm->fconn->conn;
 
        TRACE_ENTER(FCGI_EV_FSTRM_END, conn, fstrm);
 
@@ -3540,7 +3540,7 @@ static size_t fcgi_strm_parse_trailers(struct fcgi_strm *fstrm, struct h1m *h1m,
 
 static size_t fcgi_strm_parse_response(struct fcgi_strm *fstrm, struct buffer *buf, size_t count)
 {
-       struct fcgi_conn *fconn = fstrm->fconn;
+       struct fcgi_conn __maybe_unused *fconn = fstrm->fconn;
        struct htx *htx;
        struct h1m *h1m = &fstrm->h1m;
        size_t ret, data, total = 0;
@@ -4031,7 +4031,7 @@ static int fcgi_subscribe(struct stconn *sc, int event_type, struct wait_event *
 static int fcgi_unsubscribe(struct stconn *sc, int event_type, struct wait_event *es)
 {
        struct fcgi_strm *fstrm = __sc_mux_strm(sc);
-       struct fcgi_conn *fconn = fstrm->fconn;
+       struct fcgi_conn __maybe_unused *fconn = fstrm->fconn;
 
        BUG_ON(event_type & ~(SUB_RETRY_SEND|SUB_RETRY_RECV));
        BUG_ON(fstrm->subs && fstrm->subs != es);
index 3c726d7fdfff558c920308b7f81141b74c49dd9f..ec97d020de92d30644a812f55c506d3339420741 100644 (file)
@@ -1897,7 +1897,7 @@ static void h1_append_chunk_crlf(struct buffer *buf)
  */
 static void h1_set_tunnel_mode(struct h1s *h1s)
 {
-       struct h1c *h1c = h1s->h1c;
+       struct h1c __maybe_unused *h1c = h1s->h1c;
 
        h1s->req.state = H1_MSG_TUNNEL;
        h1s->req.flags &= ~(H1_MF_XFER_LEN|H1_MF_CLEN|H1_MF_CHNK);
index 37162fc3cbd7f4f08a9141988465861d577f7c64..8a54e3a0c66dac00441a077ce5cec3f246f6bd5d 100644 (file)
@@ -1281,7 +1281,7 @@ void _h2_trace_header(const struct ist hn, const struct ist hv,
                      const struct h2c *h2c, const struct h2s *h2s)
 {
        struct ist n_ist, v_ist;
-       const char *c_str, *s_str;
+       const char __maybe_unused *c_str, *s_str;
 
        chunk_reset(&trash);
        c_str = chunk_newstr(&trash);
@@ -2024,7 +2024,7 @@ static inline void h2s_propagate_term_flags(struct h2c *h2c, struct h2s *h2s)
  */
 static void h2s_destroy(struct h2s *h2s)
 {
-       struct connection *conn = h2s->h2c->conn;
+       struct connection __maybe_unused *conn = h2s->h2c->conn;
        int freed = 0;
 
        TRACE_ENTER(H2_EV_H2S_END, conn, h2s);
@@ -7613,7 +7613,7 @@ static size_t h2s_make_data(struct h2s *h2s, struct buffer *buf, size_t count)
  */
 static size_t h2s_skip_data(struct h2s *h2s, struct buffer *buf, size_t count)
 {
-       struct h2c *h2c = h2s->h2c;
+       struct h2c __maybe_unused *h2c = h2s->h2c;
        struct htx *htx;
        int bsize; /* htx block size */
        int fsize; /* h2 frame size  */
index 8fd08e29cf6a3f2d3c1a717bc6345461bd19f99d..c3ca4ac7df0f700fbb3e9c0cfc0d2c3174b735c9 100644 (file)
@@ -1154,7 +1154,7 @@ static inline void spop_strm_propagate_term_flags(struct spop_conn *spop_conn, s
  */
 static void spop_strm_destroy(struct spop_strm *spop_strm)
 {
-       struct connection *conn = spop_strm->spop_conn->conn;
+       struct connection __maybe_unused *conn = spop_strm->spop_conn->conn;
 
        TRACE_ENTER(SPOP_EV_SPOP_STRM_END, conn, spop_strm);
 
@@ -3199,7 +3199,7 @@ static int spop_subscribe(struct stconn *sc, int event_type, struct wait_event *
 static int spop_unsubscribe(struct stconn *sc, int event_type, struct wait_event *es)
 {
        struct spop_strm *spop_strm = __sc_mux_strm(sc);
-       struct spop_conn *spop_conn = spop_strm->spop_conn;
+       struct spop_conn __maybe_unused *spop_conn = spop_strm->spop_conn;
 
        BUG_ON(event_type & ~(SUB_RETRY_SEND|SUB_RETRY_RECV));
        BUG_ON(spop_strm->subs && spop_strm->subs != es);
index f3f0d9afdc8ce866d08591919ea71ea43693e34e..18dc9650cdd81831dbc93337704ad0398ed8d985 100644 (file)
@@ -710,7 +710,7 @@ static inline int ha_quic_set_write_secret(SSL *ssl, enum ssl_encryption_level_t
 
 static int ha_quic_flush_flight(SSL *ssl)
 {
-       struct quic_conn *qc = SSL_get_ex_data(ssl, ssl_qc_app_data_index);
+       struct quic_conn __maybe_unused *qc = SSL_get_ex_data(ssl, ssl_qc_app_data_index);
 
        TRACE_ENTER(QUIC_EV_CONN_FFLIGHT, qc);
        TRACE_LEAVE(QUIC_EV_CONN_FFLIGHT, qc);
index 55d36e662428f36ad8327f416b196315d2454d2e..04d6b6b8823233f99b941308c5c8cd9942c982b7 100644 (file)
@@ -1060,7 +1060,7 @@ int quic_tls_key_update(struct quic_conn *qc)
        struct quic_tls_secrets *rx = &tls_ctx->rx;
        struct quic_tls_secrets *tx = &tls_ctx->tx;
        /* Used only for the traces */
-       struct quic_kp_trace kp_trace = {
+       struct quic_kp_trace __maybe_unused kp_trace = {
                .rx_sec = rx->secret,
                .rx_seclen = rx->secretlen,
                .tx_sec = tx->secret,
index 3a777544464a800a12cad5107f1883984b6cbb2c..7d769611b8b0c5b64d8ac94b69c9d39a7fa41f0b 100644 (file)
@@ -349,7 +349,7 @@ int ssl_sock_switchctx_cbk(SSL *ssl, int *al, void *arg)
        if ((TRACE_SOURCE)->verbosity >= SSL_VERB_ADVANCED) {
                if (TRACE_ENABLED(TRACE_LEVEL_DATA, SSL_EV_CONN_CIPHERS_EXT, conn, 0, 0, 0)) {
                        const uint8_t *cipher_suites;
-                       size_t len;
+                       size_t __maybe_unused len;
 
 #if defined(OPENSSL_IS_BORINGSSL) || defined(OPENSSL_IS_AWSLC)
                        len = ctx->cipher_suites_len;