From patchwork Thu Jul 16 22:42:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Sebor X-Patchwork-Id: 7731 Received: (qmail 32844 invoked by alias); 16 Jul 2015 22:42:50 -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 32832 invoked by uid 89); 16 Jul 2015 22:42:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-qk0-f179.google.com X-Received: by 10.55.42.4 with SMTP id q4mr9029150qkh.60.1437086565191; Thu, 16 Jul 2015 15:42:45 -0700 (PDT) Message-ID: <55A83361.6010506@gmail.com> Date: Thu, 16 Jul 2015 16:42:41 -0600 From: Martin Sebor User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: GNU C Library Subject: fix build errors with -DNDEBUG Building the top of trunk with the -DNDEBUG option fails due to local variables that are assigned to but only used in assertions, and due to one instance where a variable is reported as possibly used before initialized. The attached patch suppresses these errors and allows the top of trunk to build. Verified on powerpc64le. Is it still time to commit this on trunk or should it wait until after the release? Martin 2015-07-16 Martin Sebor * iconv/skeleton.c (FUNCTION_NAME): Suppress -Wunused-but-set-variable warnings. * sysdeps/nptl/gai_misc.h (__gai_start_notify_thread): Same. (__gai_create_helper_thread): Same. * nscd/nscd.c (do_exit): Suppress -Wunused-variable. * iconvdata/iso-2022-cn-ext.c (BODY): Initialize local variable to suppress -Wmaybe-uninitialized warnings. diff --git a/iconv/skeleton.c b/iconv/skeleton.c index 09dfe11..9239c6f 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 2c9846d..bb0fd87 100644 --- a/iconvdata/iso-2022-cn-ext.c +++ b/iconvdata/iso-2022-cn-ext.c @@ -426,7 +426,7 @@ enum } \ else \ { \ - unsigned char buf[2]; \ + unsigned char buf[2] = { 0, 0 }; \ int used; \ \ if (set == GB2312_set || ((ann & SO_ann) != CNS11643_1_ann \ diff --git a/nscd/nscd.c b/nscd/nscd.c index 35b3a97..df29a81 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 96c8fa0..a1ff2ba 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);