NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
lib/53058: libedit compiles with warnings on Linux
>Number: 53058
>Category: lib
>Synopsis: libedit compiles with warnings on Linux
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: lib-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Feb 26 16:35:00 +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 */
Home |
Main Index |
Thread Index |
Old Index