Patchwork readline: rlmbutil.h: Declare wcwidth() when HANDLE_MULTIBYTE enabled.

login
register
mail settings
Submitter Chen Gang
Date April 19, 2015, 11:42 a.m.
Message ID <BLU437-SMTP66A78F9AC964A2A53B15ECB9E10@phx.gbl>
Download mbox | patch
Permalink /patch/6321/
State New
Headers show

Comments

Chen Gang - April 19, 2015, 11:42 a.m.
On fedora 20 x86_64, it has wcwidth() in libc.so.6, but does not declare
it if __USE_XOPEN disabled. readline uses libc library, but does not use
XOPEN, so just declare wcwidth() explicitly is OK.

The related warning:

  gcc -c -DHAVE_CONFIG_H    -I. -I../../binutils-gdb/readline -DRL_LIBRARY_VERSION='"6.2"' -g -O2 ../../binutils-gdb/readline/display.c
  ../../binutils-gdb/readline/display.c: In function ‘rl_redisplay’:
  ../../binutils-gdb/readline/display.c:768:15: warning: implicit declaration of function ‘wcwidth’ [-Wimplicit-function-declaration]
          temp = wcwidth (wc);
                 ^

2015-04-19  Chen Gang  <gang.chen.5i5j@gmail.com>

	* rlmbutil.h: Declare wcwidth() when HANDLE_MULTIBYTE enabled.
---
 readline/ChangeLog.gdb | 4 ++++
 readline/rlmbutil.h    | 3 +++
 2 files changed, 7 insertions(+)

Patch

diff --git a/readline/ChangeLog.gdb b/readline/ChangeLog.gdb
index 43abd19..a1051aa 100644
--- a/readline/ChangeLog.gdb
+++ b/readline/ChangeLog.gdb
@@ -1,3 +1,7 @@ 
+2015-04-19  Chen Gang  <gang.chen.5i5j@gmail.com>
+
+	* rlmbutil.h: Declare wcwidth() when HANDLE_MULTIBYTE enabled.
+
 2014-12-30  Eli Zaretskii  <eliz@gnu.org>
 
 	* complete.c (stat_char) [_WIN32]: Don't use 'access' and X_OK on
diff --git a/readline/rlmbutil.h b/readline/rlmbutil.h
index 7716a70..e4cd1f4 100644
--- a/readline/rlmbutil.h
+++ b/readline/rlmbutil.h
@@ -96,6 +96,9 @@  extern int _rl_find_next_mbchar PARAMS((char *, int, int, int));
 
 #ifdef HANDLE_MULTIBYTE
 
+extern int wcwidth (wchar_t __c); /* For fedora 20 x86_64, it has wcwitdh(), but
+				     only declared when __USE_XOPEN.  */
+
 extern int _rl_compare_chars PARAMS((char *, int, mbstate_t *, char *, int, mbstate_t *));
 extern int _rl_get_char_len PARAMS((char *, mbstate_t *));
 extern int _rl_adjust_point PARAMS((char *, int, mbstate_t *));