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
This commit is contained in:
Dimitry Andric 2022-08-14 21:13:40 +02:00
parent 7624896571
commit e967183cb0

View File

@ -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 @@ rack_fast_output(struct tcpcb *tp, struct tcp_rack *rack, uint64_t ts_val,
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);