linux-mips
[Top] [All Lists]

[PATCH 1/4] MIPS: Fix GCC-4.6 'set but not used' warning in signal*.c

To: linux-mips@linux-mips.org, ralf@linux-mips.org
Subject: [PATCH 1/4] MIPS: Fix GCC-4.6 'set but not used' warning in signal*.c
From: David Daney <ddaney@caviumnetworks.com>
Date: Mon, 24 Jan 2011 14:51:34 -0800
Cc: David Daney <ddaney@caviumnetworks.com>
In-reply-to: <1295909497-23317-1-git-send-email-ddaney@caviumnetworks.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1295909497-23317-1-git-send-email-ddaney@caviumnetworks.com>
Sender: linux-mips-bounce@linux-mips.org
GCC-4.6 can find more unused code than previous versions could.

In the case of protected_restore_fp_context{,32}, the variable tmp is
really used.  Its use is tricky in that we really care about the side
effects of the __put_user() calls.  So we must mark tmp with
__maybe_unused to quiet the warning.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
---
 arch/mips/kernel/signal.c   |    2 +-
 arch/mips/kernel/signal32.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
index 5922342..dbbe0ce 100644
--- a/arch/mips/kernel/signal.c
+++ b/arch/mips/kernel/signal.c
@@ -84,7 +84,7 @@ static int protected_save_fp_context(struct sigcontext __user 
*sc)
 
 static int protected_restore_fp_context(struct sigcontext __user *sc)
 {
-       int err, tmp;
+       int err, tmp __maybe_unused;
        while (1) {
                lock_fpu_owner();
                own_fpu_inatomic(0);
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c
index a0ed0e0..aae9866 100644
--- a/arch/mips/kernel/signal32.c
+++ b/arch/mips/kernel/signal32.c
@@ -115,7 +115,7 @@ static int protected_save_fp_context32(struct sigcontext32 
__user *sc)
 
 static int protected_restore_fp_context32(struct sigcontext32 __user *sc)
 {
-       int err, tmp;
+       int err, tmp __maybe_unused;
        while (1) {
                lock_fpu_owner();
                own_fpu_inatomic(0);
-- 
1.7.2.3


<Prev in Thread] Current Thread [Next in Thread>