]> git.kaiwu.me - haproxy.git/commitdiff
CLEANUP: trace/tree-wide: drop trace decoding/definition when USE_TRACE=0
authorWilly Tarreau <w@1wt.eu>
Wed, 1 Jul 2026 13:40:44 +0000 (15:40 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 3 Jul 2026 14:32:28 +0000 (16:32 +0200)
The various trace sources always have the same pattern:
  - trace events
  - trace source
  - trace decoding function

Dropping these when USE_TRACE=0 definitely makes sense. There are two
modes of definition here:
  - those designed after mux_h2 which interleave #define and the entry
    definition in the event. These ones cannot be removed without a
    significant code move to split the #define and usage apart. Instead
    here we mark the struct __maybe_unused, so that the compiler will
    just not implement it.

  - those designed like stream.c where defines are separated. Here we
    can simply enclose the events definition inside the USE_TRACE guard

For most of these the static declaration of the trace function was moved
after the events so that the #if defined(USE_TRACE) could be placed between
the two. Nothing else was changed.

This saves another 51 kB of object code when USE_TRACE=0.

13 files changed:
src/acme.c
src/applet.c
src/check.c
src/haterm.c
src/mux_fcgi.c
src/mux_h1.c
src/mux_pt.c
src/mux_spop.c
src/peers.c
src/qcm_trace.c
src/quic_trace.c
src/session.c
src/stream.c

index 6e67587660b7671a8377c37984e1a7f8165ac41a..6d07eb74450badf053f3f125cbf4d11c90867397 100644 (file)
@@ -52,6 +52,7 @@
 static EVP_PKEY *tmp_pkey = NULL;
 static X509 *tmp_x509 = NULL;
 
+#if defined(USE_TRACE)
 
 static void acme_trace(enum trace_level level, uint64_t mask, const struct trace_source *src,
                        const struct ist where, const struct ist func,
@@ -159,6 +160,7 @@ static void acme_trace(enum trace_level level, uint64_t mask, const struct trace
                }
        }
 }
+#endif
 
 struct eb_root acme_tasks = EB_ROOT_UNIQUE;
 __decl_thread(HA_RWLOCK_T acme_lock);
index a6e6a4e78c3202e3b7f5c0a70bb5b72e28932597..63f2654c07406474e6a66045b8c0b980e4f339ed 100644 (file)
@@ -31,16 +31,10 @@ unsigned int nb_applets = 0;
 
 DECLARE_TYPED_POOL(pool_head_appctx,  "appctx",  struct appctx);
 
-/* trace source and events */
-static void applet_trace(enum trace_level level, uint64_t mask,
-                        const struct trace_source *src,
-                        const struct ist where, const struct ist func,
-                        const void *a1, const void *a2, const void *a3, const void *a4);
-
 /* The event representation is split like this :
  *   app  - applet
   */
-static const struct trace_event applet_trace_events[] = {
+static const struct trace_event applet_trace_events[] __maybe_unused = {
 #define           APPLET_EV_NEW       (1ULL <<  0)
        { .mask = APPLET_EV_NEW,      .name = "app_new",      .desc = "new appctx" },
 #define           APPLET_EV_FREE      (1ULL <<  1)
@@ -64,6 +58,14 @@ static const struct trace_event applet_trace_events[] = {
        {}
 };
 
+#if defined(USE_TRACE)
+
+/* trace source and events */
+static void applet_trace(enum trace_level level, uint64_t mask,
+                        const struct trace_source *src,
+                        const struct ist where, const struct ist func,
+                        const void *a1, const void *a2, const void *a3, const void *a4);
+
 static const struct name_desc applet_trace_lockon_args[4] = {
        /* arg1 */ { /* already used by the applet */ },
        /* arg2 */ { },
@@ -216,6 +218,8 @@ static void applet_trace(enum trace_level level, uint64_t mask, const struct tra
        }
 }
 
+#endif /* USE_TRACE */
+
 /* Tries to allocate a new appctx and initialize all of its fields. The appctx
  * is returned on success, NULL on failure. The appctx must be released using
  * appctx_free(). <applet> is assigned as the applet, but it can be NULL. <thr>
index 8d0effa4cfd7e8d9ebc1659c591290027f9707f0..3cd9a835de618b8b62aec2666574ae212f7aa24d 100644 (file)
 #include <haproxy/trace.h>
 #include <haproxy/vars.h>
 
+/* Dummy frontend used to create all checks sessions. */
+struct proxy checks_fe;
+
+#if defined(USE_TRACE)
+
 /* trace source and events */
 static void check_trace(enum trace_level level, uint64_t mask,
                        const struct trace_source *src,
@@ -139,11 +144,6 @@ struct trace_source trace_check = {
 #define TRACE_SOURCE &trace_check
 INITCALL1(STG_REGISTER, trace_register_source, TRACE_SOURCE);
 
-
-/* Dummy frontend used to create all checks sessions. */
-struct proxy checks_fe;
-
-
 static inline void check_trace_buf(const struct buffer *buf, size_t ofs, size_t len)
 {
        size_t block1, block2;
@@ -285,6 +285,7 @@ static void check_trace(enum trace_level level, uint64_t mask,
 
 }
 
+#endif /* USE_TRACE */
 
 /**************************************************************************/
 /************************ Handle check results ****************************/
index f1b2272141be22997f2be69d9f687eae75b15fde..5ee2848522bef4407478ca9e3ef33794f23d5333 100644 (file)
@@ -83,23 +83,7 @@ size_t master_pipesize = 0;
 static size_t hstream_add_ff_data(struct hstream *hs, struct sedesc *sd, unsigned long long len);
 static size_t hstream_add_htx_data(struct hstream *hs, struct htx *htx, unsigned long long len);
 
-#define TRACE_SOURCE &trace_haterm
-struct trace_source trace_haterm;
-static void hterm_trace(enum trace_level level, uint64_t mask, const struct trace_source *src,
-                        const struct ist where, const struct ist func,
-                        const void *a1, const void *a2, const void *a3, const void *a4);
-
-static const struct  name_desc hterm_trace_logon_args[4] = {
-       /* arg1 */ { /* already used by the haterm stream */ },
-       /* arg2 */ {
-               .name="haterm",
-               .desc="haterm server",
-       },
-       /* arg3 */ { },
-       /* arg4 */ { }
-};
-
-static const struct trace_event hterm_trace_events[] = {
+static const struct trace_event hterm_trace_events[] __maybe_unused = {
 #define HS_EV_HSTRM_NEW      (1ULL << 0)
        { .mask = HS_EV_HSTRM_NEW,      .name = "hstrm_new",      .desc = "new haterm stream" },
 #define HS_EV_PROCESS_HSTRM  (1ULL << 1)
@@ -116,6 +100,24 @@ static const struct trace_event hterm_trace_events[] = {
        { .mask = HS_EV_HSTRM_ADD_DATA, .name = "hstrm_add_data", .desc = "add data to HTX haterm stream" },
 };
 
+#if defined(USE_TRACE)
+
+#define TRACE_SOURCE &trace_haterm
+struct trace_source trace_haterm;
+static void hterm_trace(enum trace_level level, uint64_t mask, const struct trace_source *src,
+                        const struct ist where, const struct ist func,
+                        const void *a1, const void *a2, const void *a3, const void *a4);
+
+static const struct  name_desc hterm_trace_logon_args[4] = {
+       /* arg1 */ { /* already used by the haterm stream */ },
+       /* arg2 */ {
+               .name="haterm",
+               .desc="haterm server",
+       },
+       /* arg3 */ { },
+       /* arg4 */ { }
+};
+
 static const struct name_desc hterm_trace_decoding[] = {
 #define HATERM_VERB_CLEAN 1
        { .name = "clean", .desc = "only user-friendly stuff, generally suitable for level \"user\"" },
@@ -150,6 +152,8 @@ static void hterm_trace(enum trace_level level, uint64_t mask, const struct trac
 
 }
 
+#endif /* USE_TRACE */
+
 int hstream_buf_available(void *target)
 {
        struct hstream *hs = target;
index f3a9b9d2cb6f0f041a320b58bd57da833e049909..3c8f0d2e1deeb688a2716164b71fd7ce8afd23bb 100644 (file)
@@ -148,12 +148,6 @@ struct fcgi_strm_params {
 /* Maximum amount of data we're OK with re-aligning for buffer optimizations */
 #define MAX_DATA_REALIGN 1024
 
-/* trace source and events */
-static void fcgi_trace(enum trace_level level, uint64_t mask,
-                      const struct trace_source *src,
-                      const struct ist where, const struct ist func,
-                      const void *a1, const void *a2, const void *a3, const void *a4);
-
 /* The event representation is split like this :
  *   fconn - internal FCGI connection
  *   fstrm - internal FCGI stream
@@ -162,7 +156,7 @@ static void fcgi_trace(enum trace_level level, uint64_t mask,
  *   tx    - data transmission
  *   rsp   - response parsing
  */
-static const struct trace_event fcgi_trace_events[] = {
+static const struct trace_event fcgi_trace_events[] __maybe_unused = {
 #define           FCGI_EV_FCONN_NEW     (1ULL <<  0)
        { .mask = FCGI_EV_FCONN_NEW,    .name = "fconn_new",        .desc = "new FCGI connection" },
 #define           FCGI_EV_FCONN_RECV    (1ULL <<  1)
@@ -248,6 +242,14 @@ static const struct trace_event fcgi_trace_events[] = {
        { }
 };
 
+#if defined(USE_TRACE)
+
+/* trace source and events */
+static void fcgi_trace(enum trace_level level, uint64_t mask,
+                      const struct trace_source *src,
+                      const struct ist where, const struct ist func,
+                      const void *a1, const void *a2, const void *a3, const void *a4);
+
 static const struct name_desc fcgi_trace_lockon_args[4] = {
        /* arg1 */ { /* already used by the connection */ },
        /* arg2 */ { .name="fstrm", .desc="FCGI stream" },
@@ -284,6 +286,8 @@ static struct trace_source trace_fcgi __read_mostly = {
 #define TRACE_SOURCE &trace_fcgi
 INITCALL1(STG_REGISTER, trace_register_source, TRACE_SOURCE);
 
+#endif /* USE_TRACE */
+
 /* FCGI connection and stream pools */
 DECLARE_STATIC_TYPED_POOL(pool_head_fcgi_conn, "fcgi_conn", struct fcgi_conn);
 DECLARE_STATIC_TYPED_POOL(pool_head_fcgi_strm, "fcgi_strm", struct fcgi_strm);
@@ -333,6 +337,8 @@ static forceinline struct stconn *fcgi_strm_sc(const struct fcgi_strm *fstrm)
 }
 
 
+#if defined(USE_TRACE)
+
 /* the FCGI traces always expect that arg1, if non-null, is of type connection
  * (from which we can derive fconn), that arg2, if non-null, is of type fstrm,
  * and that arg3, if non-null, is a htx for rx/tx headers.
@@ -434,6 +440,8 @@ static void fcgi_trace(enum trace_level level, uint64_t mask, const struct trace
        }
 }
 
+#endif /* USE_TRACE */
+
 /*****************************************************/
 /* functions below are for dynamic buffer management */
 /*****************************************************/
index 41aa3c984240ae017232f5eb10c3e3ef618d001a..264cddd280fc833432e7044f6a29ca6a46b04154 100644 (file)
@@ -99,15 +99,6 @@ static int accept_payload_with_any_method = 0;
 static int h1_be_glitches_threshold = 0;  /* backend's max glitches: unlimited */
 static int h1_fe_glitches_threshold = 0;  /* frontend's max glitches: unlimited */
 
-/* trace source and events */
-static void h1_trace(enum trace_level level, uint64_t mask,
-                     const struct trace_source *src,
-                     const struct ist where, const struct ist func,
-                     const void *a1, const void *a2, const void *a3, const void *a4);
-
-static void h1_trace_fill_ctx(struct trace_ctx *ctx, const struct trace_source *src,
-                              const void *a1, const void *a2, const void *a3, const void *a4);
-
 /* The event representation is split like this :
  *   h1c   - internal H1 connection
  *   h1s   - internal H1 stream
@@ -116,7 +107,7 @@ static void h1_trace_fill_ctx(struct trace_ctx *ctx, const struct trace_source *
  *   tx    - data transmission
  *
  */
-static const struct trace_event h1_trace_events[] = {
+static const struct trace_event h1_trace_events[] __maybe_unused = {
 #define           H1_EV_H1C_NEW       (1ULL <<  0)
        { .mask = H1_EV_H1C_NEW,      .name = "h1c_new",      .desc = "new H1 connection" },
 #define           H1_EV_H1C_RECV      (1ULL <<  1)
@@ -181,6 +172,17 @@ static const struct trace_event h1_trace_events[] = {
        { }
 };
 
+#if defined(USE_TRACE)
+
+/* trace source and events */
+static void h1_trace(enum trace_level level, uint64_t mask,
+                     const struct trace_source *src,
+                     const struct ist where, const struct ist func,
+                     const void *a1, const void *a2, const void *a3, const void *a4);
+
+static void h1_trace_fill_ctx(struct trace_ctx *ctx, const struct trace_source *src,
+                              const void *a1, const void *a2, const void *a3, const void *a4);
+
 static const struct name_desc h1_trace_lockon_args[4] = {
        /* arg1 */ { /* already used by the connection */ },
        /* arg2 */ { .name="h1s", .desc="H1 stream" },
@@ -217,6 +219,7 @@ static struct trace_source trace_h1 __read_mostly = {
 #define TRACE_SOURCE &trace_h1
 INITCALL1(STG_REGISTER, trace_register_source, TRACE_SOURCE);
 
+#endif /* USE_TRACE */
 
 /* h1 stats module */
 enum {
@@ -368,6 +371,8 @@ static forceinline struct stconn *h1s_sc(const struct h1s *h1s)
        return h1s->sd->sc;
 }
 
+#if defined(USE_TRACE)
+
 /* the H1 traces always expect that arg1, if non-null, is of type connection
  * (from which we can derive h1c), that arg2, if non-null, is of type h1s, and
  * that arg3, if non-null, is a htx for rx/tx headers.
@@ -515,6 +520,8 @@ static void h1_trace_fill_ctx(struct trace_ctx *ctx, const struct trace_source *
        }
 }
 
+#endif /* USE_TRACE */
+
 /* report one or more glitches on the connection. That is any unexpected event
  * that may occasionally happen but if repeated a bit too much, might indicate
  * a misbehaving or completely bogus peer. It normally returns zero, unless the
index fe8897b407d81a668d02f7d768f4975b9f89847a..7bfae0b0e4517161692b3508bedbebf04282c2b4 100644 (file)
@@ -29,17 +29,17 @@ struct mux_pt_ctx {
 
 DECLARE_STATIC_TYPED_POOL(pool_head_pt_ctx, "mux_pt", struct mux_pt_ctx);
 
-/* trace source and events */
-static void pt_trace(enum trace_level level, uint64_t mask,
-                     const struct trace_source *src,
-                     const struct ist where, const struct ist func,
-                     const void *a1, const void *a2, const void *a3, const void *a4);
+/* returns the stconn associated to the stream */
+static forceinline struct stconn *pt_sc(const struct mux_pt_ctx *pt)
+{
+       return pt->sd->sc;
+}
 
 /* The event representation is split like this :
  *   pt_ctx - internal PT context
  *   strm   - application layer
  */
-static const struct trace_event pt_trace_events[] = {
+static const struct trace_event pt_trace_events[] __maybe_unused = {
 #define           PT_EV_CONN_NEW      (1ULL <<  0)
        { .mask = PT_EV_CONN_NEW,     .name = "pt_conn_new",  .desc = "new PT connection" },
 #define           PT_EV_CONN_WAKE     (1ULL <<  1)
@@ -64,6 +64,13 @@ static const struct trace_event pt_trace_events[] = {
        {}
 };
 
+#if defined(USE_TRACE)
+
+/* trace source and events */
+static void pt_trace(enum trace_level level, uint64_t mask,
+                     const struct trace_source *src,
+                     const struct ist where, const struct ist func,
+                     const void *a1, const void *a2, const void *a3, const void *a4);
 
 static const struct name_desc pt_trace_decoding[] = {
 #define PT_VERB_CLEAN    1
@@ -93,12 +100,6 @@ static struct trace_source trace_pt __read_mostly = {
 #define TRACE_SOURCE &trace_pt
 INITCALL1(STG_REGISTER, trace_register_source, TRACE_SOURCE);
 
-/* returns the stconn associated to the stream */
-static forceinline struct stconn *pt_sc(const struct mux_pt_ctx *pt)
-{
-       return pt->sd->sc;
-}
-
 static inline void pt_trace_buf(const struct buffer *buf, size_t ofs, size_t len)
 {
        size_t block1, block2;
@@ -200,6 +201,7 @@ static void pt_trace(enum trace_level level, uint64_t mask, const struct trace_s
                }
        }
 }
+#endif
 
 static inline void mux_pt_report_term_evt(struct mux_pt_ctx *ctx, enum muxc_term_event_type type)
 {
index 3a921ca4e75be906b457392cd36f08e81ca61a34..c8551b7acfb40c7d28617ef0af7a14ebcea2958b 100644 (file)
@@ -91,12 +91,6 @@ struct spop_frame_header {
         uint8_t  type;      /* frame type */
 };
 
-/* trace source and events */
-static void spop_trace(enum trace_level level, uint64_t mask,
-                     const struct trace_source *src,
-                     const struct ist where, const struct ist func,
-                     const void *a1, const void *a2, const void *a3, const void *a4);
-
 /* The event representation is split like this :
  *   spop_conn - internal SPOP connection
  *   spop_strm - internal SPOP stream
@@ -104,7 +98,7 @@ static void spop_trace(enum trace_level level, uint64_t mask,
  *   rx    - data receipt
  *   tx    - data transmission
  */
-static const struct trace_event spop_trace_events[] = {
+static const struct trace_event spop_trace_events[] __maybe_unused = {
 #define           SPOP_EV_SPOP_CONN_NEW     (1ULL <<  0)
        { .mask = SPOP_EV_SPOP_CONN_NEW,    .name = "spop_conn_new",  .desc = "new SPOP connection" },
 #define           SPOP_EV_SPOP_CONN_RECV    (1ULL <<  1)
@@ -173,6 +167,14 @@ static const struct trace_event spop_trace_events[] = {
        { }
 };
 
+#if defined(USE_TRACE)
+
+/* trace source and events */
+static void spop_trace(enum trace_level level, uint64_t mask,
+                     const struct trace_source *src,
+                     const struct ist where, const struct ist func,
+                     const void *a1, const void *a2, const void *a3, const void *a4);
+
 static const struct name_desc spop_trace_lockon_args[4] = {
        /* arg1 */ { /* already used by the connection */ },
        /* arg2 */ { .name="spop_strm", .desc="SPOP stream" },
@@ -209,6 +211,8 @@ static struct trace_source trace_spop __read_mostly = {
 #define TRACE_SOURCE &trace_spop
 INITCALL1(STG_REGISTER, trace_register_source, TRACE_SOURCE);
 
+#endif /* USE_TRACE */
+
 /* SPOP connection and stream pools */
 DECLARE_STATIC_TYPED_POOL(pool_head_spop_conn, "spop_conn", struct spop_conn);
 DECLARE_STATIC_TYPED_POOL(pool_head_spop_strm, "spop_strm", struct spop_strm);
@@ -304,6 +308,8 @@ static inline struct sedesc *spop_strm_opposite_sd(struct spop_strm *spop_strm)
        return se_opposite(spop_strm->sd);
 }
 
+#if defined(USE_TRACE)
+
 static inline void spop_trace_buf(const struct buffer *buf, size_t ofs, size_t len)
 {
        size_t block1, block2;
@@ -445,6 +451,7 @@ static void spop_trace(enum trace_level level, uint64_t mask, const struct trace
        }
 }
 
+#endif /* USE_TRACE */
 
 /*****************************************************/
 /* functions below are for dynamic buffer management */
index b8a6cae869f8c27a2b65a517343a330108805f0f..07b1097ccf759ea98dbdf8875d097a5219b4f1ac 100644 (file)
@@ -267,18 +267,12 @@ static struct ebpt_node *dcache_tx_insert(struct dcache *dc,
                                           struct dcache_tx_entry *i);
 static inline void flush_dcache(struct peer *peer);
 
-/* trace source and events */
-static void peers_trace(enum trace_level level, uint64_t mask,
-                        const struct trace_source *src,
-                        const struct ist where, const struct ist func,
-                        const void *a1, const void *a2, const void *a3, const void *a4);
-
 static const char *statuscode_str(int statuscode);
 static const char *peer_app_state_str(enum peer_app_state appstate);
 static const char *peer_learn_state_str(enum peer_learn_state learnstate);
 static const char *peer_applet_state_str(int state);
 
-static const struct trace_event peers_trace_events[] = {
+static const struct trace_event peers_trace_events[] __maybe_unused = {
 #define PEERS_EV_SESS_NEW      (1ULL << 0)
        { .mask = PEERS_EV_SESS_NEW,     .name = "sess_new",       .desc = "create new peer session" },
 #define PEERS_EV_SESS_END      (1ULL << 1)
@@ -328,6 +322,14 @@ static const struct trace_event peers_trace_events[] = {
        { }
 };
 
+#if defined(USE_TRACE)
+
+/* trace source and events */
+static void peers_trace(enum trace_level level, uint64_t mask,
+                        const struct trace_source *src,
+                        const struct ist where, const struct ist func,
+                        const void *a1, const void *a2, const void *a3, const void *a4);
+
 static const struct name_desc peers_trace_lockon_args[4] = {
        /* arg1 */ { /* already used by the appctx */ },
        /* arg2 */ { .name="peer", .desc="Peer" },
@@ -455,6 +457,8 @@ static void peers_trace(enum trace_level level, uint64_t mask,
                return;
 }
 
+#endif /* USE_TRACE */
+
 static const char *statuscode_str(int statuscode)
 {
        switch (statuscode) {
@@ -511,7 +515,7 @@ static const char *peer_learn_state_str(enum peer_learn_state learnstate)
        }
 }
 
-static const char *peer_applet_state_str(int state)
+static inline const char *peer_applet_state_str(int state)
 {
        switch (state) {
        case PEER_SESS_ST_ACCEPT:       return "ACCEPT";
index 4492ed4eae7f59ffe574befb451528691a942098..fcb2017cbf011a96259c598cb6e1b09317019ec6 100644 (file)
@@ -10,6 +10,8 @@
 #include <haproxy/quic_utils.h>
 #include <haproxy/stconn.h>
 
+#if defined(USE_TRACE)
+
 /* trace source and events */
 static void qcm_trace(enum trace_level level, uint64_t mask,
                        const struct trace_source *src,
@@ -133,6 +135,8 @@ static void qcm_trace_fill_ctx(struct trace_ctx *ctx, const struct trace_source
 /* register qcm traces */
 INITCALL1(STG_REGISTER, trace_register_source, TRACE_SOURCE);
 
+#endif /* USE_TRACE*/
+
 static char *qcc_app_st_to_str(const enum qcc_app_st st)
 {
        switch (st) {
index 98d120969240dba290c6567e2cd60574fa211f7b..c0a7cfe4fd074be961850fe96af416f4581e35fc 100644 (file)
@@ -22,6 +22,8 @@
 #include <haproxy/quic_tp.h>
 #include <haproxy/trace.h>
 
+#if defined(USE_TRACE)
+
 static void quic_trace(enum trace_level level, uint64_t mask, const struct trace_source *src,
                        const struct ist where, const struct ist func,
                        const void *a1, const void *a2, const void *a3, const void *a4);
@@ -664,6 +666,8 @@ static void quic_trace(enum trace_level level, uint64_t mask, const struct trace
 
 }
 
+#endif /* USE_TRACE */
+
 void quic_dump_qc_info(struct buffer *msg, const struct quic_conn *qc)
 {
        chunk_appendf(msg, " qc.wnd=%llu/%llu", (ullong)qc->path->in_flight,
index 4c6bbf604577213f13a430ab18aca25fbc81da54..0f86898a9c88eb6e373029f166b051614e38e4a0 100644 (file)
@@ -34,7 +34,7 @@ DECLARE_TYPED_POOL(pool_head_sess_priv_conns, "sess_priv_conns", struct sess_pri
 
 int conn_complete_session(struct connection *conn);
 
-static const struct trace_event sess_trace_events[] = {
+static const struct trace_event sess_trace_events[] __maybe_unused = {
 #define           SESS_EV_NEW       (1ULL <<  0)
        { .mask = SESS_EV_NEW,      .name = "sess_new",     .desc = "new session creation" },
 #define           SESS_EV_END       (1ULL <<  1)
@@ -44,6 +44,8 @@ static const struct trace_event sess_trace_events[] = {
        { }
 };
 
+#if defined(USE_TRACE)
+
 static const struct name_desc sess_trace_lockon_args[4] = {
        /* arg1 */ { /* already used by the session */ },
        /* arg2 */ { },
@@ -63,6 +65,8 @@ static struct trace_source trace_sess __read_mostly = {
 #define TRACE_SOURCE &trace_sess
 INITCALL1(STG_REGISTER, trace_register_source, TRACE_SOURCE);
 
+#endif /* USE_TRACE */
+
 /* Create a a new session and assign it to frontend <fe>, listener <li>,
  * origin <origin>, set the current date and clear the stick counters pointers.
  * Returns the session upon success or NULL. The session may be released using
index 10543f86229bda44070e0847faddb4e24c9ba6d1..2f8dacd1c1a3d44b142f307c2fc62a2e3cb71032 100644 (file)
@@ -71,6 +71,8 @@ unsigned stream_epoch = 0;
 static struct list service_keywords = LIST_HEAD_INIT(service_keywords);
 
 
+#if defined(USE_TRACE)
+
 /* trace source and events */
 static void strm_trace(enum trace_level level, uint64_t mask,
                       const struct trace_source *src,
@@ -272,6 +274,7 @@ static void strm_trace(enum trace_level level, uint64_t mask, const struct trace
                htx_dump(&trace_buf, htx, full);
        }
 }
+#endif
 
 /* Upgrade an existing stream for stream connector <sc>. Return < 0 on error. This
  * is only valid right after a TCP to H1 upgrade. The stream should be