BUILD: quic: fix anonymous union for gcc-4.4

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.
This commit is contained in:
Benoit DOLEZ 2022-06-08 09:28:56 +02:00 committed by Willy Tarreau
parent dca4c53a95
commit 69e3f05b15

View 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);
}