From 69e3f05b1502317f83768c9cf25892bfb4f35dcb Mon Sep 17 00:00:00 2001 From: Benoit DOLEZ Date: Wed, 8 Jun 2022 09:28:56 +0200 Subject: [PATCH] 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. --- src/xprt_quic.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/xprt_quic.c b/src/xprt_quic.c index d16fee5..32eeab8 100644 --- a/src/xprt_quic.c +++ b/src/xprt_quic.c @@ -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); } -- 1.7.10.4