git: f4f847018048 - main - Fix unused variable warning in icl_soft.c
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 24 Jul 2022 22:40:35 UTC
The branch main has been updated by dim:
URL: https://cgit.FreeBSD.org/src/commit/?id=f4f847018048ac7699b55bc1915a393eb65e4c53
commit f4f847018048ac7699b55bc1915a393eb65e4c53
Author: Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-07-24 20:54:08 +0000
Commit: Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-07-24 22:40:12 +0000
Fix unused variable warning in icl_soft.c
With clang 15, the following -Werror warning is produced:
sys/dev/iscsi//icl_soft.c:886:6: error: variable 'coalesced' set but not used [-Werror,-Wunused-but-set-variable]
int coalesced, error;
^
The 'coalesced' variable is eventually used only in an #if 0'd block,
obviously meant for debugging. Ensure that 'coalesced' is only declared
and used when DEBUG_COALESCED is defined, so the debugging can be easily
turned on later, if desired.
MFC after: 3 days
---
sys/dev/iscsi/icl_soft.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/sys/dev/iscsi/icl_soft.c b/sys/dev/iscsi/icl_soft.c
index 669cb9618d3a..700f1c6e79f8 100644
--- a/sys/dev/iscsi/icl_soft.c
+++ b/sys/dev/iscsi/icl_soft.c
@@ -883,7 +883,10 @@ icl_conn_send_pdus(struct icl_soft_conn *isc, struct icl_pdu_stailq *queue)
struct mbuf *m;
struct socket *so;
long available, size, size2;
- int coalesced, error;
+#ifdef DEBUG_COALESCED
+ int coalesced;
+#endif
+ int error;
ICL_CONN_LOCK_ASSERT_NOT(ic);
@@ -942,7 +945,15 @@ icl_conn_send_pdus(struct icl_soft_conn *isc, struct icl_pdu_stailq *queue)
}
if (coalesce) {
m = request->ip_bhs_mbuf;
- for (coalesced = 1; ; coalesced++) {
+ for (
+#ifdef DEBUG_COALESCED
+ coalesced = 1
+#endif
+ ; ;
+#ifdef DEBUG_COALESCED
+ coalesced++
+#endif
+ ) {
request2 = STAILQ_FIRST(queue);
if (request2 == NULL)
break;
@@ -967,7 +978,7 @@ icl_conn_send_pdus(struct icl_soft_conn *isc, struct icl_pdu_stailq *queue)
size += size2;
icl_soft_pdu_done(request2, 0);
}
-#if 0
+#ifdef DEBUG_COALESCED
if (coalesced > 1) {
ICL_DEBUG("coalesced %d PDUs into %ld bytes",
coalesced, size);