]> git.kaiwu.me - haproxy.git/commit
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)
commit75163e93a8c0d48df53dd10f1807bf59d7047785
tree8fd6d2a457537d9fb04682078934dc0baff25bfa
parent5dff525422fe247fd9fba1196ad84cd2ede734e9
CLEANUP: trace/tree-wide: drop trace decoding/definition when USE_TRACE=0

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