Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Jul 2022 20:08:49 GMT
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 5bfd8cf36913 - main - Fix unused variable warning in sctp_timer.c
Message-ID:  <202207252008.26PK8nQ2023168@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by dim:

URL: https://cgit.FreeBSD.org/src/commit/?id=5bfd8cf3691381c19296d76d7944d6c1df5f4a75

commit 5bfd8cf3691381c19296d76d7944d6c1df5f4a75
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-07-25 20:06:28 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-07-25 20:08:28 +0000

    Fix unused variable warning in sctp_timer.c
    
    With clang 15, the following -Werror warning is produced:
    
        sys/netinet/sctp_timer.c:510:6: error: variable 'recovery_cnt' set but not used [-Werror,-Wunused-but-set-variable]
                int recovery_cnt = 0;
                    ^
    
    The 'recovery_cnt' variable is only used when INVARIANTS is undefined.
    Ensure it is only declared and set in that case.
    
    MFC after:      3 days
---
 sys/netinet/sctp_timer.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sys/netinet/sctp_timer.c b/sys/netinet/sctp_timer.c
index 9eff569e0f53..c808b6751384 100644
--- a/sys/netinet/sctp_timer.c
+++ b/sys/netinet/sctp_timer.c
@@ -507,7 +507,9 @@ sctp_mark_all_for_resend(struct sctp_tcb *stcb,
 	unsigned int cnt_mk;
 	uint32_t orig_flight, orig_tf;
 	uint32_t tsnlast, tsnfirst;
+#ifndef INVARIANTS
 	int recovery_cnt = 0;
+#endif
 
 	/* none in flight now */
 	audit_tf = 0;
@@ -565,10 +567,10 @@ start_again:
 			/* Strange case our list got out of order? */
 			SCTP_PRINTF("Our list is out of order? last_acked:%x chk:%x\n",
 			    (unsigned int)stcb->asoc.last_acked_seq, (unsigned int)chk->rec.data.tsn);
-			recovery_cnt++;
 #ifdef INVARIANTS
 			panic("last acked >= chk on sent-Q");
 #else
+			recovery_cnt++;
 			SCTP_PRINTF("Recover attempts a restart cnt:%d\n", recovery_cnt);
 			sctp_recover_sent_list(stcb);
 			if (recovery_cnt < 10) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202207252008.26PK8nQ2023168>