From patchwork Tue Dec 23 05:31:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 4408 Received: (qmail 12905 invoked by alias); 23 Dec 2014 05:32:02 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 12880 invoked by uid 89); 23 Dec 2014 05:32:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com From: Alexandre Oliva To: libc-alpha@sourceware.org Subject: fix -Werror regressions with gcc 4.8 on x86_64 Date: Tue, 23 Dec 2014 03:31:50 -0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 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(-) 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);