Patchwork fix -Werror regressions with gcc 4.8 on x86_64

login
register
mail settings
Submitter Alexandre Oliva
Date Dec. 23, 2014, 5:31 a.m.
Message ID <orr3vr3pa1.fsf@free.home>
Download mbox | patch
Permalink /patch/4408/
State New
Headers show

Comments

Alexandre Oliva - Dec. 23, 2014, 5:31 a.m.
Here's a patch that fixes a few build errors I got when using GCC 4.8
with -Werror.  Ok to install?


for  ChangeLog

	* iconv/skeleton.c (FUNCTION_NAME): Mark nstatus as possibly
	unused.
	* nscd/nscd.c (do_exit, notify_parent): Likewise ret.
	* sysdeps/nptl/gai_misc.h (__gai_start_notify_thread),
	(__gai_create_helper_thread): Likewise sigerr.
	* iconvdata/iso-2022-cn-ext.c (UCS4 to ISO-2022-CN BODY): Mark
	buf uses as maybe uninitialized.
---
 iconv/skeleton.c            |    2 +-
 iconvdata/iso-2022-cn-ext.c |    5 +++++
 nscd/nscd.c                 |    6 ++++--
 sysdeps/nptl/gai_misc.h     |    6 ++++--
 4 files changed, 14 insertions(+), 5 deletions(-)

Patch

diff --git a/iconv/skeleton.c b/iconv/skeleton.c
index acd60e2..c16ee39 100644
--- a/iconv/skeleton.c
+++ b/iconv/skeleton.c
@@ -675,7 +675,7 @@  FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data,
 #else
 		      /* We have a problem in one of the functions below.
 			 Undo the conversion upto the error point.  */
-		      size_t nstatus;
+		      size_t nstatus __attribute__ ((__unused__));
 
 		      /* Reload the pointers.  */
 		      *inptrp = inptr;
diff --git a/iconvdata/iso-2022-cn-ext.c b/iconvdata/iso-2022-cn-ext.c
index e922246..b4cc71e 100644
--- a/iconvdata/iso-2022-cn-ext.c
+++ b/iconvdata/iso-2022-cn-ext.c
@@ -637,8 +637,13 @@  enum
 	    break;							      \
 	  }								      \
 									      \
+	/* Both unsigned chars in buf are initialized before use, but	      \
+	   GCC 4.8 cannot figure this out.  */				      \
+	DIAG_PUSH_NEEDS_COMMENT;					      \
+	DIAG_IGNORE_NEEDS_COMMENT (4.8, "-Wmaybe-uninitialized");	      \
 	*outptr++ = buf[0];						      \
 	*outptr++ = buf[1];						      \
+	DIAG_POP_NEEDS_COMMENT;						      \
 	set = used;							      \
       }									      \
 									      \
diff --git a/nscd/nscd.c b/nscd/nscd.c
index 1185ed6..40afc39 100644
--- a/nscd/nscd.c
+++ b/nscd/nscd.c
@@ -659,7 +659,8 @@  do_exit (int child_ret, int errnum, const char *format, ...)
 {
   if (parent_fd != -1)
     {
-      int ret = write (parent_fd, &child_ret, sizeof (child_ret));
+      int ret __attribute__ ((__unused__));
+      ret = write (parent_fd, &child_ret, sizeof (child_ret));
       assert (ret == sizeof (child_ret));
       close (parent_fd);
     }
@@ -691,7 +692,8 @@  notify_parent (int child_ret)
   if (parent_fd == -1)
     return;
 
-  int ret = write (parent_fd, &child_ret, sizeof (child_ret));
+  int ret __attribute__ ((__unused__));
+  ret = write (parent_fd, &child_ret, sizeof (child_ret));
   assert (ret == sizeof (child_ret));
   close (parent_fd);
   parent_fd = -1;
diff --git a/sysdeps/nptl/gai_misc.h b/sysdeps/nptl/gai_misc.h
index 49be366..8273a0d 100644
--- a/sysdeps/nptl/gai_misc.h
+++ b/sysdeps/nptl/gai_misc.h
@@ -81,7 +81,8 @@  __gai_start_notify_thread (void)
 {
   sigset_t ss;
   sigemptyset (&ss);
-  int sigerr = pthread_sigmask (SIG_SETMASK, &ss, NULL);
+  int sigerr __attribute__ ((__unused__));
+  sigerr = pthread_sigmask (SIG_SETMASK, &ss, NULL);
   assert_perror (sigerr);
 }
 
@@ -105,7 +106,8 @@  __gai_create_helper_thread (pthread_t *threadp, void *(*tf) (void *),
   sigset_t ss;
   sigset_t oss;
   sigfillset (&ss);
-  int sigerr = pthread_sigmask (SIG_SETMASK, &ss, &oss);
+  int sigerr __attribute__ ((__unused__));
+  sigerr = pthread_sigmask (SIG_SETMASK, &ss, &oss);
   assert_perror (sigerr);
 
   int ret = pthread_create (threadp, &attr, tf, arg);