Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 Mar 2023 17:59:17 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: ad83dd2b2b6b - main - LinuxKPI: Appease -Wunused-but-set-variable warnings from GCC.
Message-ID:  <202303311759.32VHxHYU078842@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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)
 



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