From patchwork Mon Apr 27 22:43:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Eggert X-Patchwork-Id: 6472 Received: (qmail 99415 invoked by alias); 27 Apr 2015 22:44:03 -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 99406 invoked by uid 89); 27 Apr 2015 22:44:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: smtp.cs.ucla.edu Message-ID: <553EBBA8.6050902@cs.ucla.edu> Date: Mon, 27 Apr 2015 15:43:52 -0700 From: Paul Eggert User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: David Miller CC: libc-alpha@sourceware.org Subject: Re: pragma change breaks build References: <20150427.123657.10432164616133021.davem@davemloft.net> <20150427.132700.355837165424266128.davem@davemloft.net> In-Reply-To: <20150427.132700.355837165424266128.davem@davemloft.net> David Miller wrote: > instead of just adding a "= 0" initializer to vallen so > that all gcc's will not warn That could cause glibc to have a useless machine instruction, no? Horrors! Does the attached patch work for you? From 3e14ca767b43554c34f3f95c64ac793bdbd733fa Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 27 Apr 2015 15:30:43 -0700 Subject: [PATCH] * stdlib/setenv.c: Pacify only GCC 4.7 and later. Problem with -Wmaybe-uninitialized reported by David Miller in: https://sourceware.org/ml/libc-alpha/2015-04/msg00345.html --- ChangeLog | 6 ++++++ stdlib/setenv.c | 14 ++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 39f74cc..706b5e3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2015-04-27 Paul Eggert + + * stdlib/setenv.c: Pacify only GCC 4.7 and later. + Problem with -Wmaybe-uninitialized reported by David Miller in: + https://sourceware.org/ml/libc-alpha/2015-04/msg00345.html + 2015-04-27 H.J. Lu [BZ#18333] diff --git a/stdlib/setenv.c b/stdlib/setenv.c index 184a8cd..ee45458 100644 --- a/stdlib/setenv.c +++ b/stdlib/setenv.c @@ -19,12 +19,14 @@ # include #endif -/* Pacify GCC; see the commentary about VALLEN below. This is needed - at least through GCC 4.9.2. Pacify GCC for the entire file, as - there seems to be no way to pacify GCC selectively, only for the - place where it's needed. Do not use DIAG_IGNORE_NEEDS_COMMENT - here, as it's not defined yet. */ -#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +/* Pacify GCC 4.7 and later; see the commentary about VALLEN below. + This is needed at least through GCC 5.1.0. Pacify GCC for the + entire file, as there seems to be no way to pacify GCC selectively, + only for the place where it's needed. Do not use macros like + DIAG_IGNORE_NEEDS_COMMENT here, as they're not defined yet. */ +#if 4 < __GNUC__ + (7 <= __GNUC_MINOR__) +# pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif #include #if !_LIBC -- 2.1.0