git: ad83dd2b2b6b - main - LinuxKPI: Appease -Wunused-but-set-variable warnings from GCC.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 31 Mar 2023 17:59:17 UTC
The branch main has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=ad83dd2b2b6bb56c002a93fcf800b30f2ec448d5
commit ad83dd2b2b6bb56c002a93fcf800b30f2ec448d5
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2023-03-31 17:56:33 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2023-03-31 17:56:33 +0000
LinuxKPI: Appease -Wunused-but-set-variable warnings from GCC.
- Mark assert dummy variables as __unused.
- Use a dummy (void) cast of the flags argument passed to
spin_unlock_irqrestore so it gets treated as used.
Reviewed by: manu, hselasky
Differential Revision: https://reviews.freebsd.org/D39349
---
sys/compat/linuxkpi/common/include/linux/kernel.h | 2 +-
sys/compat/linuxkpi/common/include/linux/spinlock.h | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/sys/compat/linuxkpi/common/include/linux/kernel.h b/sys/compat/linuxkpi/common/include/linux/kernel.h
index 22b25a202395..4fd9f8613895 100644
--- a/sys/compat/linuxkpi/common/include/linux/kernel.h
+++ b/sys/compat/linuxkpi/common/include/linux/kernel.h
@@ -103,7 +103,7 @@
#define _O_CTASSERT(x) _O__CTASSERT(x, __LINE__)
#define _O__CTASSERT(x, y) _O___CTASSERT(x, y)
#define _O___CTASSERT(x, y) while (0) { \
- typedef char __assert_line_ ## y[(x) ? 1 : -1]; \
+ typedef char __unused __assert_line_ ## y[(x) ? 1 : -1]; \
__assert_line_ ## y _x; \
_x[0] = '\0'; \
}
diff --git a/sys/compat/linuxkpi/common/include/linux/spinlock.h b/sys/compat/linuxkpi/common/include/linux/spinlock.h
index a87cb7180b28..f72a295d2a40 100644
--- a/sys/compat/linuxkpi/common/include/linux/spinlock.h
+++ b/sys/compat/linuxkpi/common/include/linux/spinlock.h
@@ -128,6 +128,7 @@ typedef struct {
} while (0)
#define spin_unlock_irqrestore(_l, flags) do { \
+ (void)(flags); \
spin_unlock(_l); \
} while (0)