openwrt/target/linux/generic/hack-6.18/950-silence-unused-variable-warnings.patch
Mieczyslaw Nalewaj eff7240445 generic: 6.18: silence unused-variable warnings
This patch silences compiler warnings about unused variables by explicitly
casting them to void where appropriate.

Signed-off-by: Mieczyslaw Nalewaj <namiltd@yahoo.com>
Link: https://github.com/openwrt/openwrt/pull/21078
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-03-28 11:51:10 +01:00

48 lines
1.6 KiB
Diff

From: Mieczyslaw Nalewaj <namiltd@yahoo.com>
Date: Wed, 07 Jan 2026 01:30:15 +0100
Subject: [PATCH] Silence unused-variable warnings in ipv6.h and tcp_input.c
This patch silences compiler warnings about unused variables by explicitly
casting them to void where appropriate.
Signed-off-by: Mieczyslaw Nalewaj <namiltd@yahoo.com>
---
include/net/ipv6.h | 6 ++++++
net/ipv4/tcp_input.c | 7 +++++++
2 files changed, 13 insertions(+)
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -248,6 +248,8 @@ extern int sysctl_mld_qrv;
struct inet6_dev *_idev = (idev); \
unsigned long _field = (field); \
unsigned long _val = (val); \
+ (void)_field; \
+ (void)_val; \
if (likely(_idev != NULL)) \
mod##SNMP_ADD_STATS((_idev)->stats.statname, _field, _val); \
mod##SNMP_ADD_STATS((net)->mib.statname##_statistics, _field, _val);\
@@ -257,6 +259,7 @@ extern int sysctl_mld_qrv;
({ \
struct inet6_dev *_idev = (idev); \
unsigned long _val = (val); \
+ (void)_val; \
if (likely(_idev != NULL)) \
mod##SNMP_UPD_PO_STATS((_idev)->stats.statname, field, _val); \
mod##SNMP_UPD_PO_STATS((net)->mib.statname##_statistics, field, _val);\
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -3967,6 +3967,12 @@ static u32 tcp_newly_delivered(struct so
struct tcp_sock *tp = tcp_sk(sk);
u32 delivered;
+ /* ecn_count is only used when FLAG_ECE is set; in some build/config
+ * paths it may be unused and cause a compiler warning. Silence it
+ * explicitly here.
+ */
+ (void)ecn_count;
+
delivered = tp->delivered - prior_delivered;
NET_ADD_STATS(net, LINUX_MIB_TCPDELIVERED, delivered);