From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 44546 invoked by alias); 31 Jan 2019 07:59:16 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 44536 invoked by uid 89); 31 Jan 2019 07:59:16 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=driven X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 31 Jan 2019 07:59:14 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 774B311752D; Thu, 31 Jan 2019 02:59:12 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Kls5iNUWr3kf; Thu, 31 Jan 2019 02:59:12 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 14F111161C7; Thu, 31 Jan 2019 02:59:12 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 61AFE854F8; Thu, 31 Jan 2019 11:59:07 +0400 (+04) Date: Thu, 31 Jan 2019 07:59:00 -0000 From: Joel Brobecker To: Alan Hayward Cc: "gdb-patches@sourceware.org" , nd Subject: Re: [PATCH] Readline: Cleanup some warnings Message-ID: <20190131075907.GA313@adacore.com> References: <20190130085716.75179-1-alan.hayward@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190130085716.75179-1-alan.hayward@arm.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-SW-Source: 2019-01/txt/msg00617.txt.bz2 > (Posted this first to binutils, then was directed back here and > pointed at the upstream readline. Looking at the upstream > readline it has already fixed the issues below in the same way. > Tested by running the gdb testsuite - couldn't see a readline > specific suite.) > > Cleanup the readline warnings that gdb buildbot complains about. > > To prevent wcwidth missing declaration warnings, add the SOURCE / > EXTENSION macros to config.in that have already checked for in > configure. Use the exact same list as GDB - it seemed sensible > to add all of them. > > Ensure pid is a long before printing as one. Also fix GNU style. > > Check the return value of write the same way as history_do_write (). > > These changes are consistent with upstream readline. > > readline/ChangeLog.gdb: > > 2019-01-30 Alan Hayward > > * config.h.in: Add SOURCE/EXTENSION macros. > * histfile.c (history_truncate_file): Check return of write. > * util.c: Ensure pid is long. If it is a backport from mainline readline, and you've run the testsuite (readline is being necessarily extensively covered, but at least it is used implicitly, since it provides the framework for the interactive prompt, which is being driven via expect/tcl), it's OK to push. Just one question: Any reason you didn't list the name of the function being modified, in the change to util.c? > --- > readline/config.h.in | 21 +++++++++++++++++++++ > readline/histfile.c | 3 ++- > readline/util.c | 6 +++--- > 3 files changed, 26 insertions(+), 4 deletions(-) > > diff --git a/readline/config.h.in b/readline/config.h.in > index 86d86cfa3d..81575f43f7 100644 > --- a/readline/config.h.in > +++ b/readline/config.h.in > @@ -271,3 +271,24 @@ > # define USE_VARARGS > # endif > #endif > + > +/* Enable extensions on AIX 3, Interix. */ > +#ifndef _ALL_SOURCE > +# undef _ALL_SOURCE > +#endif > +/* Enable GNU extensions on systems that have them. */ > +#ifndef _GNU_SOURCE > +# undef _GNU_SOURCE > +#endif > +/* Enable threading extensions on Solaris. */ > +#ifndef _POSIX_PTHREAD_SEMANTICS > +# undef _POSIX_PTHREAD_SEMANTICS > +#endif > +/* Enable extensions on HP NonStop. */ > +#ifndef _TANDEM_SOURCE > +# undef _TANDEM_SOURCE > +#endif > +/* Enable general extensions on Solaris. */ > +#ifndef __EXTENSIONS__ > +# undef __EXTENSIONS__ > +#endif > diff --git a/readline/histfile.c b/readline/histfile.c > index fffeb3fd31..56cbbf0498 100644 > --- a/readline/histfile.c > +++ b/readline/histfile.c > @@ -407,7 +407,8 @@ history_truncate_file (fname, lines) > truncate to. */ > if (bp > buffer && ((file = open (filename, O_WRONLY|O_TRUNC|O_BINARY, 0600)) != -1)) > { > - write (file, bp, chars_read - (bp - buffer)); > + if (write (file, bp, chars_read - (bp - buffer)) < 0) > + rv = errno; > > #if defined (__BEOS__) > /* BeOS ignores O_TRUNC. */ > diff --git a/readline/util.c b/readline/util.c > index d402fce842..13bd00c09c 100644 > --- a/readline/util.c > +++ b/readline/util.c > @@ -515,11 +515,11 @@ _rl_tropen () > (sh_get_env_value ("TEMP") > ? sh_get_env_value ("TEMP") > : "."), > - getpid()); > + getpid ()); > #else > - sprintf (fnbuf, "/var/tmp/rltrace.%ld", getpid()); > + sprintf (fnbuf, "/var/tmp/rltrace.%ld", (long) getpid ()); > #endif > - unlink(fnbuf); > + unlink (fnbuf); > _rl_tracefp = fopen (fnbuf, "w+"); > return _rl_tracefp != 0; > } > -- > 2.17.2 (Apple Git-113) -- Joel