git: 7593646bac79 - stable/13 - Fix unused variable warning in tcp_stacks's rack.c

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Sun, 21 Aug 2022 11:29:05 UTC
The branch stable/13 has been updated by dim:

URL: https://cgit.FreeBSD.org/src/commit/?id=7593646bac7900a2b5da5b7ac8845017da7f77cd

commit 7593646bac7900a2b5da5b7ac8845017da7f77cd
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-08-14 19:13:40 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-08-21 11:13:17 +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
    
    (cherry picked from commit e967183cb030dfc349c264520e5710bac70bcdd4)
---
 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 2f9ea65c5ec2..30508f5666d8 100644
--- a/sys/netinet/tcp_stacks/rack.c
+++ b/sys/netinet/tcp_stacks/rack.c
@@ -15709,7 +15709,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 = 0, flags, ulen = 0;
 	uint32_t us_cts, s_soff;
 	uint32_t if_hw_tsomaxsegcount = 0, startseq;
@@ -16077,7 +16079,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);