]> Savannah Git Hosting - gnulib.git/commitdiff
wcwidth: check a macro version of wcwidth () as well
authorKO Myung-Hun <komh@chollian.net>
Fri, 6 Oct 2017 13:06:55 +0000 (22:06 +0900)
committerBruno Haible <bruno@clisp.org>
Sat, 7 Oct 2017 07:17:33 +0000 (09:17 +0200)
Check the functionality of a macro version wcwidth () as well as a
real function.

This is better than undefining wcwidth on OS/2 kLIBC without functional
check.

* lib/wchar.in.h: Revert commit caee51.
* m4/wcwidth.m4 (gl_cv_func_wcwidth_macro): Check if wcwidth () is a
macro.

ChangeLog
lib/wchar.in.h
m4/wcwidth.m4

index f4fa9644e5ac502f025837765193fa928acd0bfa..470012f4b91e46f3e458effde3db78b241c79cfd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-10-06  KO Myung-Hun  <komh@chollian.net>
+
+       wcwidth: check a macro version of wcwidth () as well
+       * lib/wchar.in.h: Revert commit from 2016-01-14.
+       * m4/wcwidth.m4 (gl_FUNC_WCWIDTH): Test if wcwidth is a macro.
+
 2017-10-06  Bruno Haible  <bruno@clisp.org>
 
        getopt-posix: Clarify copyright header.
index c65cc6668e359bcf2ff9e1cd75e2a0eaf5ca68f9..3307e235e31c0f96ae769b33a8b7d0d92b433d38 100644 (file)
@@ -31,7 +31,7 @@
 @PRAGMA_COLUMNS@
 
 #if (((defined __need_mbstate_t || defined __need_wint_t)               \
-      && !defined __MINGW32__ && !defined __KLIBC__)                    \
+      && !defined __MINGW32__)                                          \
      || (defined __hpux                                                 \
          && ((defined _INTTYPES_INCLUDED && !defined strtoimax)         \
              || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H))               \
@@ -452,11 +452,6 @@ _GL_CXXALIAS_RPL (wcwidth, int, (wchar_t));
 #  if !@HAVE_DECL_WCWIDTH@
 /* wcwidth exists but is not declared.  */
 _GL_FUNCDECL_SYS (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE);
-#  elif defined __KLIBC__
-/* On OS/2 kLIBC, wcwidth is a macro that expands to the name of a
-   static inline function.  The implementation of wcwidth in wcwidth.c
-   causes a "conflicting types" error. */
-#   undef wcwidth
 #  endif
 _GL_CXXALIAS_SYS (wcwidth, int, (wchar_t));
 # endif
index 58716416cf6da460ff72bf1bc9bd8e52f56b98de..b44a9ed0fd4e4438e6de3d7ae79c06e71de6bee0 100644 (file)
@@ -1,4 +1,4 @@
-# wcwidth.m4 serial 23
+# wcwidth.m4 serial 24
 dnl Copyright (C) 2006-2017 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -34,7 +34,20 @@ AC_DEFUN([gl_FUNC_WCWIDTH],
     HAVE_DECL_WCWIDTH=0
   fi
 
-  if test $ac_cv_func_wcwidth = yes; then
+  if test $ac_cv_func_wcwidth != yes; then
+    AC_CACHE_CHECK([whether wcwidth is a macro],
+      [gl_cv_func_wcwidth_macro],
+      [AC_EGREP_CPP([wchar_header_defines_wcwidth], [
+#include <wchar.h>
+#ifdef wcwidth
+ wchar_header_defines_wcwidth
+#endif],
+         [gl_cv_func_wcwidth_macro=yes],
+         [gl_cv_func_wcwidth_macro=no])
+      ])
+  fi
+
+  if test $ac_cv_func_wcwidth = yes -o "$gl_cv_func_wcwidth_macro" = yes; then
     HAVE_WCWIDTH=1
     dnl On Mac OS X 10.3, wcwidth(0x0301) (COMBINING ACUTE ACCENT) returns 1.
     dnl On OpenBSD 5.0, wcwidth(0x05B0) (HEBREW POINT SHEVA) returns 1.