ARM: arch/arm/kernel/signal.c: resolve set-but-not-used warning
PATCH 1/1 ARM: arch/arm/kernel/signal.c: resolve set-but-not-used warning
If neither CONFIG_IWMMXT nor CONFIG_VFP are enabled (which is the case, for example, in rpc_defconfig), the variable "aux" is set but not used, which generates a warning during W=1 builds. Resolve this issue by only defining the variable if it will be used.
--- arch/arm/kernel/signal.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/kernel/signal.c +4 -0
@@ -140,7 +140,9 @@ static int restore_vfp_context(char __user **auxp)static int restore_sigframe (struct pt_regs *regs,struct sigframe __user *sf) {struct sigcontext context; +#if defined(CONFIG_IWMMXT ) || defined(CONFIG_VFP )char __user *aux; +#endif sigset_t set;int err;
@@ -171,6 +173,7 @@ static int restore_sigframe(struct pt_regs *regs, struct sigframe __user *sf) err |= !valid_user_regs (regs); +#if defined(CONFIG_IWMMXT ) || defined(CONFIG_VFP ) aux = (char __user *) sf->uc.uc_regspace;#ifdef CONFIG_IWMMXT if (err ==0 )
@@ -180,6 +183,7 @@ static int restore_sigframe(struct pt_regs *regs, struct sigframe __user *sf)if (err ==0 ) err |=restore_vfp_context (&aux);#endif +#endif /* defined(CONFIG_IWMMXT) || defined(CONFIG_VFP) */ return err; }
Signature · 1 line
2.43.0
Quoted 6 lines · Ethan Nelson-Moore
If neither
CONFIG_IWMMXTnorCONFIG_VFPare enabled (which is the case, for example, inrpc_defconfig), the variable "aux" is set but not used, which generates a warning during W=1 builds. Resolve this issue by only defining the variable if it will be used.Signed-off-by Ethan Nelson-Moore <[email protected]>
Hi Ethan,
Quoted 15 lines · Ethan Nelson-Moore
If neither
CONFIG_IWMMXTnorCONFIG_VFPare enabled (which is the case, for example, inrpc_defconfig), the variable "aux" is set but not used, which generates a warning during W=1 builds. Resolve this issue by only defining the variable if it will be used.Signed-off-by Ethan Nelson-Moore <[email protected]>--- arch/arm/kernel/signal.c | 4 ++++ 1 file changed, 4 insertions(+)arch/arm/kernel/signal.c +0
-0
arch/arm/kernel/signal.c static int restore_vfp_context(char __user **auxp) · line 144
Quoted 5 lines
arch/arm/kernel/signal.c +1
-0@@ -140,7 +140,9 @@ static int restore_vfp_context(char __user **auxp)static int restore_sigframe (struct pt_regs *regs,struct sigframe __user *sf) {struct sigcontext context; +#if defined(CONFIG_IWMMXT ) || defined(CONFIG_VFP )char __user *aux;
__maybe_unused is a common attribute marking local variables that are not always used. I find it nicer than another layer of #ifdef.
baruch
Quoted 20 lines
arch/arm/kernel/signal.c +3
-0+#endif sigset_t set;int err;@@ -171,6 +173,7 @@ static int restore_sigframe(struct pt_regs *regs, struct sigframe __user *sf) err |= !valid_user_regs (regs); +#if defined(CONFIG_IWMMXT ) || defined(CONFIG_VFP ) aux = (char __user *) sf->uc.uc_regspace;#ifdef CONFIG_IWMMXT if (err ==0 )@@ -180,6 +183,7 @@ static int restore_sigframe(struct pt_regs *regs, struct sigframe __user *sf)if (err ==0 ) err |=restore_vfp_context (&aux);#endif +#endif /* defined(CONFIG_IWMMXT) || defined(CONFIG_VFP) */ return err; }
Signature · 3 lines
~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- [email protected] - tel: +972.52.368.4656, http://www.tkos.co.il -Hi, Baruch,
Quoted 2 lines · Baruch Siach
__maybe_unusedis a common attribute marking local variables that are not always used. I find it nicer than another layer of #ifdef.
That's a good point. The compiler will just optimize it out in this case. I'll send a new version of the patch using this attribute.
Ethan