]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: qpack: fix unused value when not using DEBUG_HPACK
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 25 Mar 2022 14:11:38 +0000 (15:11 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 25 Mar 2022 14:21:45 +0000 (15:21 +0100)
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.

src/qpack-dec.c

index 0f087fd4e9cb15e414244ae2a8c696bfc3b3ca44..ed43baebc831ee9a852c4d4e0f9d4ed717d28d72 100644 (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:");