Fix SH4 register-dump.h for soft-float

Message ID alpine.DEB.2.20.1611072318330.23588@digraph.polyomino.org.uk
State Superseded
Headers

Commit Message

Joseph Myers Nov. 7, 2016, 11:18 p.m. UTC
  This patch fixes SH4 register-dump.h to declare a variable under the
same conditions on which it is used, to avoid an unused variable error
breaking the build for soft-float.

Tested (compilation only, in conjunction with other fixes) for SH4
soft-float.

2016-11-07  Joseph Myers  <joseph@codesourcery.com>

	* sysdeps/unix/sysv/linux/sh/sh4/register-dump.h (register_dump):
	Only declare fpregs if [__SH_FPU_ANY__].
  

Comments

Joseph Myers Nov. 14, 2016, 11:38 p.m. UTC | #1
Ping.  This patch 
<https://sourceware.org/ml/libc-alpha/2016-11/msg00257.html> is pending 
review.
  
Mike Frysinger Nov. 15, 2016, 8:49 p.m. UTC | #2
On 07 Nov 2016 23:18, Joseph Myers wrote:
> This patch fixes SH4 register-dump.h to declare a variable under the
> same conditions on which it is used, to avoid an unused variable error
> breaking the build for soft-float.
> 
> Tested (compilation only, in conjunction with other fixes) for SH4
> soft-float.
> 
> 2016-11-07  Joseph Myers  <joseph@codesourcery.com>
> 
> 	* sysdeps/unix/sysv/linux/sh/sh4/register-dump.h (register_dump):
> 	Only declare fpregs if [__SH_FPU_ANY__].
> 
> --- a/sysdeps/unix/sysv/linux/sh/sh4/register-dump.h
> +++ b/sysdeps/unix/sysv/linux/sh/sh4/register-dump.h
> @@ -56,7 +56,9 @@ static void
>  register_dump (int fd, struct sigcontext *ctx)
>  {
>    char regs[22][8];
> +#ifdef __SH_FPU_ANY__
>    char fpregs[34][8];
> +#endif
>    struct iovec iov[22 * 2 + 34 * 2 + 2];
>    size_t nr = 0;

seems like you could just move it into the existing ifdef scope
rather than duplicating the logic ?  fpregs is only used inside
of an existing if(){...} scope.
-mike
  

Patch

diff --git a/sysdeps/unix/sysv/linux/sh/sh4/register-dump.h b/sysdeps/unix/sysv/linux/sh/sh4/register-dump.h
index 4a642ab..154824d 100644
--- a/sysdeps/unix/sysv/linux/sh/sh4/register-dump.h
+++ b/sysdeps/unix/sysv/linux/sh/sh4/register-dump.h
@@ -56,7 +56,9 @@  static void
 register_dump (int fd, struct sigcontext *ctx)
 {
   char regs[22][8];
+#ifdef __SH_FPU_ANY__
   char fpregs[34][8];
+#endif
   struct iovec iov[22 * 2 + 34 * 2 + 2];
   size_t nr = 0;