From patchwork Wed Jan 30 08:57:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Hayward X-Patchwork-Id: 31258 Received: (qmail 47274 invoked by alias); 30 Jan 2019 08:57:39 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 47265 invoked by uid 89); 30 Jan 2019 08:57:39 -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_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: EUR01-HE1-obe.outbound.protection.outlook.com Received: from mail-eopbgr130085.outbound.protection.outlook.com (HELO EUR01-HE1-obe.outbound.protection.outlook.com) (40.107.13.85) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 30 Jan 2019 08:57:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=T8wC7jYZH1d3fTEqVNF4c7LJko03fxrBSGVHnwtVrnU=; b=chz73YhrbvoBFBeVP198YfPnVIxNuGvX4+vrWstoqTXwT+zxSO0iJiRRHKm6S0XBsTt2kUasLjRiOwgRmSCoZot27v47wSRto5sBK/Wrss2+xHyTxj/b0oMRv9hz8iFYPS246O6P0Jl4Z3D67kpR2GE3SGgebAiyOIGjzdu6Pc4= Received: from DB6PR0802MB2133.eurprd08.prod.outlook.com (10.172.227.22) by DB6PR0802MB2487.eurprd08.prod.outlook.com (10.172.250.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1580.16; Wed, 30 Jan 2019 08:57:33 +0000 Received: from DB6PR0802MB2133.eurprd08.prod.outlook.com ([fe80::acd7:a958:2aaa:562e]) by DB6PR0802MB2133.eurprd08.prod.outlook.com ([fe80::acd7:a958:2aaa:562e%5]) with mapi id 15.20.1580.017; Wed, 30 Jan 2019 08:57:33 +0000 From: Alan Hayward To: "gdb-patches@sourceware.org" CC: nd , Alan Hayward Subject: [PATCH] Readline: Cleanup some warnings Date: Wed, 30 Jan 2019 08:57:33 +0000 Message-ID: <20190130085716.75179-1-alan.hayward@arm.com> authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alan.Hayward@arm.com; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 MIME-Version: 1.0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-IsSubscribed: yes (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. --- 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; }