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.
This commit is contained in:
Amaury Denoyelle 2022-03-25 15:11:38 +01:00
parent 251eadfce5
commit 18a10d07b6

View File

@ -206,8 +206,8 @@ int qpack_decode_fs(const unsigned char *raw, size_t len, struct buffer *tmp,
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 @@ int qpack_decode_fs(const unsigned char *raw, size_t len, struct buffer *tmp,
}
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 @@ int qpack_decode_fs(const unsigned char *raw, size_t len, struct buffer *tmp,
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 @@ int qpack_decode_fs(const unsigned char *raw, size_t len, struct buffer *tmp,
}
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:");