public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] readline: rlmbutil.h: Declare wcwidth() when HANDLE_MULTIBYTE enabled.
@ 2015-04-19 11:42 Chen Gang
  2015-04-19 15:44 ` Andreas Schwab
  0 siblings, 1 reply; 3+ messages in thread
From: Chen Gang @ 2015-04-19 11:42 UTC (permalink / raw)
  To: binutils, gdb-patches

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(+)

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 *));
-- 
1.9.3

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] readline: rlmbutil.h: Declare wcwidth() when HANDLE_MULTIBYTE enabled.
  2015-04-19 11:42 [PATCH] readline: rlmbutil.h: Declare wcwidth() when HANDLE_MULTIBYTE enabled Chen Gang
@ 2015-04-19 15:44 ` Andreas Schwab
  2015-04-19 18:46   ` Chen Gang
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Schwab @ 2015-04-19 15:44 UTC (permalink / raw)
  To: Chen Gang; +Cc: binutils, gdb-patches

Chen Gang <xili_gchen_5257@hotmail.com> writes:

> 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,

It does, but config.h.in fails to provide the necessary template.

Andreas.

	* readline/config.h.in: Add missing templates.
---
 readline/config.h.in | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/readline/config.h.in b/readline/config.h.in
index 8560c4b..f50956e 100644
--- a/readline/config.h.in
+++ b/readline/config.h.in
@@ -6,6 +6,14 @@
 
 #undef _FILE_OFFSET_BITS
 
+#undef __EXTENSIONS__
+#undef _ALL_SOURCE
+#undef _GNU_SOURCE
+#undef _POSIX_SOURCE
+#undef _POSIX_1_SOURCE
+#undef _POSIX_PTHREAD_SEMANTICS
+#undef _TANDEM_SOURCE
+
 /* Define if on MINIX.  */
 #undef _MINIX
 
@@ -27,6 +35,8 @@
 
 #undef PROTOTYPES
 
+#undef __PROTOTYPES
+
 #undef __CHAR_UNSIGNED__
 
 /* Define if the `S_IS*' macros in <sys/stat.h> do not work properly.  */
@@ -71,6 +81,12 @@
 /* Define if you have the mbrtowc function. */
 #undef HAVE_MBRTOWC
 
+/* Define if you have the mbscmp function. */
+#undef HAVE_MBSCMP
+
+/* Define if you have the mbsnrtowcs function. */
+#undef HAVE_MBSNRTOWCS
+
 /* Define if you have the mbsrtowcs function. */
 #undef HAVE_MBSRTOWCS
 
@@ -118,6 +134,9 @@
 /* Define if you have the wcscoll function.  */
 #undef HAVE_WCSCOLL
 
+/* Define if you have the wcsdup function.  */
+#undef HAVE_WCSDUP
+
 /* Define if you have the wctype function.  */
 #undef HAVE_WCTYPE
 
@@ -235,9 +254,9 @@
 
 #undef HAVE_GETPW_DECLS
 
-#undef STRUCT_DIRENT_HAS_D_INO
+#undef HAVE_STRUCT_DIRENT_D_INO
 
-#undef STRUCT_DIRENT_HAS_D_FILENO
+#undef HAVE_STRUCT_DIRENT_D_FILENO
 
 #undef HAVE_BSD_SIGNALS
 
-- 
2.3.5

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] readline: rlmbutil.h: Declare wcwidth() when HANDLE_MULTIBYTE enabled.
  2015-04-19 15:44 ` Andreas Schwab
@ 2015-04-19 18:46   ` Chen Gang
  0 siblings, 0 replies; 3+ messages in thread
From: Chen Gang @ 2015-04-19 18:46 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: binutils, gdb-patches, bug-readline

On 4/19/15 23:44, Andreas Schwab wrote:
> Chen Gang <xili_gchen_5257@hotmail.com> writes:
> 
>> 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,
> 
> It does, but config.h.in fails to provide the necessary template.
> 
> Andreas.
> 
> 	* readline/config.h.in: Add missing templates.

OK, thanks. It sounds reasonable to me (in this case, it is about
_GNU_SOURCE).

> ---
>  readline/config.h.in | 23 +++++++++++++++++++++--
>  1 file changed, 21 insertions(+), 2 deletions(-)
> 
> diff --git a/readline/config.h.in b/readline/config.h.in
> index 8560c4b..f50956e 100644
> --- a/readline/config.h.in
> +++ b/readline/config.h.in
> @@ -6,6 +6,14 @@
>  
>  #undef _FILE_OFFSET_BITS
>  
> +#undef __EXTENSIONS__
> +#undef _ALL_SOURCE
> +#undef _GNU_SOURCE
> +#undef _POSIX_SOURCE
> +#undef _POSIX_1_SOURCE
> +#undef _POSIX_PTHREAD_SEMANTICS
> +#undef _TANDEM_SOURCE
> +
>  /* Define if on MINIX.  */
>  #undef _MINIX
>  
> @@ -27,6 +35,8 @@
>  
>  #undef PROTOTYPES
>  
> +#undef __PROTOTYPES
> +
>  #undef __CHAR_UNSIGNED__
>  
>  /* Define if the `S_IS*' macros in <sys/stat.h> do not work properly.  */
> @@ -71,6 +81,12 @@
>  /* Define if you have the mbrtowc function. */
>  #undef HAVE_MBRTOWC
>  
> +/* Define if you have the mbscmp function. */
> +#undef HAVE_MBSCMP
> +
> +/* Define if you have the mbsnrtowcs function. */
> +#undef HAVE_MBSNRTOWCS
> +
>  /* Define if you have the mbsrtowcs function. */
>  #undef HAVE_MBSRTOWCS
>  
> @@ -118,6 +134,9 @@
>  /* Define if you have the wcscoll function.  */
>  #undef HAVE_WCSCOLL
>  
> +/* Define if you have the wcsdup function.  */
> +#undef HAVE_WCSDUP
> +
>  /* Define if you have the wctype function.  */
>  #undef HAVE_WCTYPE
>  
> @@ -235,9 +254,9 @@
>  
>  #undef HAVE_GETPW_DECLS
>  
> -#undef STRUCT_DIRENT_HAS_D_INO
> +#undef HAVE_STRUCT_DIRENT_D_INO
>  
> -#undef STRUCT_DIRENT_HAS_D_FILENO
> +#undef HAVE_STRUCT_DIRENT_D_FILENO
>  
>  #undef HAVE_BSD_SIGNALS
>  
> 

-- 
Chen Gang

Open, share, and attitude like air, water, and life which God blessed

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-04-19 18:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-19 11:42 [PATCH] readline: rlmbutil.h: Declare wcwidth() when HANDLE_MULTIBYTE enabled Chen Gang
2015-04-19 15:44 ` Andreas Schwab
2015-04-19 18:46   ` Chen Gang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).