git: e967183cb030 - main - Fix unused variable warning in tcp_stacks's rack.c
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 14 Aug 2022 19:27:57 UTC
The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=e967183cb030dfc349c264520e5710bac70bcdd4 commit e967183cb030dfc349c264520e5710bac70bcdd4 Author: Dimitry Andric <dim@FreeBSD.org> AuthorDate: 2022-08-14 19:13:40 +0000 Commit: Dimitry Andric <dim@FreeBSD.org> CommitDate: 2022-08-14 19:27:34 +0000 Fix unused variable warning in tcp_stacks's rack.c With clang 15, the following -Werror warning is produced: sys/netinet/tcp_stacks/rack.c:16148:6: error: variable 'cnt_thru' set but not used [-Werror,-Wunused-but-set-variable] int cnt_thru = 1; ^ The 'cnt_thru' variable is only used when TCP_ACCOUNTING is defined. Ensure it is only declared and set in that case. MFC after: 3 days --- sys/netinet/tcp_stacks/rack.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index c3008b38dd4f..0cb7b5cb4680 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -16145,7 +16145,9 @@ rack_fast_output(struct tcpcb *tp, struct tcp_rack *rack, uint64_t ts_val, struct tcpopt to; u_char opt[TCP_MAXOLEN]; uint32_t hdrlen, optlen; +#ifdef TCP_ACCOUNTING int cnt_thru = 1; +#endif int32_t slot, segsiz, len, max_val, tso = 0, sb_offset, error, ulen = 0; uint16_t flags; uint32_t s_soff; @@ -16503,7 +16505,9 @@ again: max_val -= len; len = segsiz; th = rack->r_ctl.fsb.th; +#ifdef TCP_ACCOUNTING cnt_thru++; +#endif goto again; } tp->t_flags &= ~(TF_ACKNOW | TF_DELACK);