]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: quic: fix anonymous union for gcc-4.4
authorBenoit DOLEZ <bdolez@zenetys.com>
Wed, 8 Jun 2022 07:28:56 +0000 (09:28 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 8 Jun 2022 09:24:36 +0000 (11:24 +0200)
Building QUIC with gcc-4.4 on el6 shows this error:

src/xprt_quic.c: In function 'qc_release_lost_pkts':
src/xprt_quic.c:1905: error: unknown field 'loss' specified in initializer
compilation terminated due to -Wfatal-errors.
make: *** [src/xprt_quic.o] Error 1
make: *** Waiting for unfinished jobs....

Initializing an anonymous form of union like :
     struct quic_cc_event ev = {
          (...)
          .loss.time_sent = newest_lost->time_sent,
          (...)
     };

generates an error with gcc-4.4 but not when initializing the
fields outside of the declaration.

src/xprt_quic.c

index d16fee548fc4e2668c48a2bb330d61ab101c73c7..32eeab8fdc41b9e45f7c7addffb3119af5407ca4 100644 (file)
@@ -1900,10 +1900,10 @@ static inline void qc_release_lost_pkts(struct quic_conn *qc,
 
        if (newest_lost) {
                /* Sent a congestion event to the controller */
-               struct quic_cc_event ev = {
-                       .type = QUIC_CC_EVT_LOSS,
-                       .loss.time_sent = newest_lost->time_sent,
-               };
+               struct quic_cc_event ev = { };
+
+               ev.type = QUIC_CC_EVT_LOSS;
+               ev.loss.time_sent = newest_lost->time_sent;
 
                quic_cc_event(&qc->path->cc, &ev);
        }