BUILD: qpack: fix unused value when not using DEBUG_HPACK
If the macro is not defined, some local variables are flagged as unused
by the compiler. Fix this by using the __maybe_unused attribute.
For now, the macro is defined in the qpack-dec.c. However, this will
change to not mess up the stderr output of haproxy with QUIC traffic.
diff --git a/src/qpack-dec.c b/src/qpack-dec.c
index 0f087fd..ed43bae 100644
--- a/src/qpack-dec.c
+++ b/src/qpack-dec.c
@@ -206,8 +206,8 @@
qpack_debug_printf(stderr, "efl_type=0x%02x\n", efl_type);
if (efl_type == QPACK_LFL_WPBNM) {
/* Literal field line with post-base name reference */
- uint64_t index, length;
- unsigned int n, h;
+ uint64_t index __maybe_unused, length;
+ unsigned int n __maybe_unused, h;
qpack_debug_printf(stderr, "literal field line with post-base name reference:");
n = *raw & 0x08;
@@ -241,7 +241,7 @@
}
else if (efl_type == QPACK_IFL_WPBI) {
/* Indexed field line with post-base index */
- uint64_t index;
+ uint64_t index __maybe_unused;
qpack_debug_printf(stderr, "indexed field line with post-base index:");
index = qpack_get_varint(&raw, &len, 4);
@@ -275,7 +275,7 @@
else if (efl_type & QPACK_LFL_WNR_BIT) {
/* Literal field line with name reference */
uint64_t index, length;
- unsigned int t, n, h;
+ unsigned int t, n __maybe_unused, h;
qpack_debug_printf(stderr, "Literal field line with name reference:");
n = efl_type & 0x20;
@@ -338,7 +338,7 @@
}
else if (efl_type & QPACK_LFL_WLN_BIT) {
/* Literal field line with literal name */
- unsigned int n, hname, hvalue;
+ unsigned int n __maybe_unused, hname __maybe_unused, hvalue __maybe_unused;
uint64_t name_len, value_len;
qpack_debug_printf(stderr, "Literal field line with literal name:");