]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUILD: quic_sock: address a strict-aliasing build warning with gcc 5 and 6
authorWilly Tarreau <w@1wt.eu>
Wed, 2 Apr 2025 14:07:31 +0000 (16:07 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 2 Apr 2025 14:07:31 +0000 (16:07 +0200)
commitdd900aead8613af12ea23b18a3e77d28ad42729b
tree164deffae9111067cbe4453caba5ffbf6011ff52
parent870f7aa5cf50c13bf2c141e1f2903d185a16cb1e
BUILD: quic_sock: address a strict-aliasing build warning with gcc 5 and 6

The UDP GSO code emits a build warning with older toolchains (gcc 5 and 6):

  src/quic_sock.c: In function 'cmsg_set_gso':
  src/quic_sock.c:683:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
    *((uint16_t *)CMSG_DATA(c)) = gso_size;
    ^

Let's just use the write_u16() function that's made for this purpose.
It was verified that for all versions from 5 to 13, gcc produces the
exact same code with the fix (and without the warning). It arrived in
3.1 with commit 448d3d388a ("MINOR: quic: add GSO parameter on quic_sock
send API") so this can be backported there.
src/quic_sock.c