Date: Fri, 29 Jul 2022 18:47:12 GMT From: Dimitry Andric <dim@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: afd97f6b96cc - stable/13 - Fix unused variable warnings in sctp_indata.c Message-ID: <202207291847.26TIlCDr023787@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=afd97f6b96cc4b70f60552a0e609e6a1bc15eb81 commit afd97f6b96cc4b70f60552a0e609e6a1bc15eb81 Author: Dimitry Andric <dim@FreeBSD.org> AuthorDate: 2022-07-25 19:15:52 +0000 Commit: Dimitry Andric <dim@FreeBSD.org> CommitDate: 2022-07-29 18:28:07 +0000 Fix unused variable warnings in sctp_indata.c With clang 15, the following -Werror warnings are produced: sys/netinet/sctp_indata.c:3309:6: error: variable 'tot_retrans' set but not used [-Werror,-Wunused-but-set-variable] int tot_retrans = 0; ^ sys/netinet/sctp_indata.c:3842:20: error: variable 'resend' set but not used [-Werror,-Wunused-but-set-variable] int inflight = 0, resend = 0, inbetween = 0, acked = 0, above = 0; ^ sys/netinet/sctp_indata.c:3842:47: error: variable 'acked' set but not used [-Werror,-Wunused-but-set-variable] int inflight = 0, resend = 0, inbetween = 0, acked = 0, above = 0; ^ sys/netinet/sctp_indata.c:3842:58: error: variable 'above' set but not used [-Werror,-Wunused-but-set-variable] int inflight = 0, resend = 0, inbetween = 0, acked = 0, above = 0; ^ The 'tot_retrans' variable was used in sctp_strike_gap_ack_chunks(), but refactoring in 493d8e5a830e got rid of it. Remove the variable since it no longer serves any purpose. The 'resend', 'acked', and 'above' variables are only used when INVARIANTS is undefined. Ensure they are only declared and set in that case. MFC after: 3 days (cherry picked from commit 05b3a4282c408f495add570bbca12242dd006279) --- sys/netinet/sctp_indata.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/sys/netinet/sctp_indata.c b/sys/netinet/sctp_indata.c index fb1327a94475..18949ab9b6e2 100644 --- a/sys/netinet/sctp_indata.c +++ b/sys/netinet/sctp_indata.c @@ -3305,7 +3305,6 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, struct sctp_association *asoc, struct sctp_tmit_chunk *tp1; int strike_flag = 0; struct timeval now; - int tot_retrans = 0; uint32_t sending_seq; struct sctp_nets *net; int num_dests_sacked = 0; @@ -3693,7 +3692,6 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, struct sctp_association *asoc, } tp1->rec.data.doing_fast_retransmit = 1; - tot_retrans++; /* mark the sending seq for possible subsequent FR's */ /* * SCTP_PRINTF("Marking TSN for FR new value %x\n", @@ -3838,9 +3836,10 @@ static int sctp_fs_audit(struct sctp_association *asoc) { struct sctp_tmit_chunk *chk; - int inflight = 0, resend = 0, inbetween = 0, acked = 0, above = 0; + int inflight = 0, inbetween = 0; int ret; #ifndef INVARIANTS + int resend = 0, acked = 0, above = 0; int entry_flight, entry_cnt; #endif @@ -3860,13 +3859,19 @@ sctp_fs_audit(struct sctp_association *asoc) chk->snd_count); inflight++; } else if (chk->sent == SCTP_DATAGRAM_RESEND) { +#ifndef INVARIANTS resend++; +#endif } else if (chk->sent < SCTP_DATAGRAM_ACKED) { inbetween++; } else if (chk->sent > SCTP_DATAGRAM_ACKED) { +#ifndef INVARIANTS above++; +#endif } else { +#ifndef INVARIANTS acked++; +#endif } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202207291847.26TIlCDr023787>