From: Amaury Denoyelle Date: Fri, 25 Mar 2022 14:11:38 +0000 (+0100) Subject: BUILD: qpack: fix unused value when not using DEBUG_HPACK X-Git-Tag: v2.6-dev4~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=18a10d07b66064f9829a93811338523d13d1e791;p=thirdparty%2Fhaproxy.git 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 0f087fd4e9..ed43baebc8 100644 --- a/src/qpack-dec.c +++ b/src/qpack-dec.c @@ -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:");