NetBSD Problem Report #53058
From www@NetBSD.org Mon Feb 26 16:33:48 2018
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 105887A166
for <gnats-bugs@gnats.NetBSD.org>; Mon, 26 Feb 2018 16:33:48 +0000 (UTC)
Message-Id: <20180226163346.A0C9A7A230@mollari.NetBSD.org>
Date: Mon, 26 Feb 2018 16:33:46 +0000 (UTC)
From: nikhil.benesch@gmail.com
Reply-To: nikhil.benesch@gmail.com
To: gnats-bugs@NetBSD.org
Subject: libedit compiles with warnings on Linux
X-Send-Pr-Version: www-1.0
>Number: 53058
>Category: lib
>Synopsis: libedit compiles with warnings on Linux
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: lib-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Feb 26 16:35:00 +0000 2018
>Closed-Date: Mon Feb 26 18:56:58 +0000 2018
>Last-Modified: Mon Feb 26 18:56:58 +0000 2018
>Originator: Nikhil Benesch
>Release:
>Organization:
Cockroach Labs
>Environment:
>Description:
libedit compiles with the following warnings with clang:
common.c:371:21: warning: passing 'wint_t *' (aka 'unsigned int *') to parameter of type 'wchar_t *' (aka 'int *') converts between pointers to integer types with different sign [-Wpointer-sign]
histedit.h:267:37: note: passing argument to parameter here
search.c:607:20: warning: passing 'wint_t *' (aka 'unsigned int *') to parameter of type 'wchar_t *' (aka 'int *') converts between pointers to integer types with different sign [-Wpointer-sign]
histedit.h:267:37: note: passing argument to parameter here
Do note that I'm compiling on Linux with Jess Thrysoee's autotoolized version of libedit (http://thrysoee.dk/editline/); unfortunately I don't have a NetBSD box to test with. I have verified, however, that the affected code is identical in the current NetBSD source tree.
For reference:
$ uname -a
Linux fcae0848e226 4.13.0-1011-gcp #15-Ubuntu SMP Mon Feb 12 16:29:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
benesch@f
$ clang --version
clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
>How-To-Repeat:
>Fix:
A patch like the following will solve the problem:
diff --git a/common.c b/common.c
index 2708605..523d88c 100644
--- a/common.c
+++ b/common.c
@@ -363,15 +363,17 @@ ed_prev_char(EditLine *el, wint_t c __attribute__((__unused__)))
* [^V] [^V]
*/
libedit_private el_action_t
-ed_quoted_insert(EditLine *el, wint_t c)
+/*ARGSUSED*/
+ed_quoted_insert(EditLine *el, wint_t c __attribute__((__unused__)))
{
int num;
+ wchar_t ch;
tty_quotemode(el);
- num = el_wgetc(el, &c);
+ num = el_wgetc(el, &ch);
tty_noquotemode(el);
if (num == 1)
- return ed_insert(el, c);
+ return ed_insert(el, ch);
else
return ed_end_of_file(el, 0);
}
diff --git a/search.c b/search.c
index 3141629..1132164 100644
--- a/search.c
+++ b/search.c
@@ -604,8 +604,10 @@ cv_csearch(EditLine *el, int direction, wint_t ch, int count, int tflag)
return CC_ERROR;
if (ch == (wint_t)-1) {
- if (el_wgetc(el, &ch) != 1)
+ wchar_t c;
+ if (el_wgetc(el, &c) != 1)
return ed_end_of_file(el, 0);
+ ch = c;
}
/* Save for ';' and ',' commands */
>Release-Note:
>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/53058 CVS commit: src/lib/libedit
Date: Mon, 26 Feb 2018 12:36:15 -0500
Module Name: src
Committed By: christos
Date: Mon Feb 26 17:36:15 UTC 2018
Modified Files:
src/lib/libedit: common.c search.c
Log Message:
PR/53058: Nikhil Benesch: use correctly typed variables (wchar_t vs wint_t)
as parameters.
To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/lib/libedit/common.c src/lib/libedit/search.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->closed
State-Changed-By: maya@NetBSD.org
State-Changed-When: Mon, 26 Feb 2018 18:56:58 +0000
State-Changed-Why:
applied, thanks for the patch!
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.