Hi/2.

Bruno Haible wrote:
> Hi,
> 
> KO Myung-Hun wrote:
>> 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.
> 
> With your patch, does the following command sequence pass its tests?
> 
>   $ ./gnulib-tool --create-testdir --dir=testdir1 --single-configure 
> --with-c++-tests wcwidth
>   $ cd testdir1
>   $ ./configure
>   $ make
>   $ make check
> 

I attach test-suite.log.

>> +    gl_cv_func_wcwidth_macro,
>> ...
>> +       gl_cv_func_wcwidth_macro=yes,
>> +       gl_cv_func_wcwidth_macro=no)])
> 
> In gnulib, for a long time, we use "quote all m4 macro arguments through 
> brackets"
> coding style. Just a matter of consistent coding style (that makes our 
> Autoconf
> macros halfway readable).
> 

Fixed. And I increased serial number by 1.

-- 
KO Myung-Hun

Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM

Korean OS/2 User Community : http://www.os2.kr/

=====================================
   dummy 0: gltests/test-suite.log
=====================================

# TOTAL: 22
# PASS:  20
# SKIP:  0
# XFAIL: 0
# FAIL:  2
# XPASS: 0
# ERROR: 0

.. contents:: :depth: 2

FAIL: test-init.sh
==================

./test-init.sh: ./init.sh[253]: shopt: not found
test-init.sh: failed test: invalid path dir: 
'F:/lang/work/gnulib/gnulib.git/testdir1/gltests/.'
FAIL test-init.sh (exit status: 1)

FAIL: test-wctype-h
===================

test-wctype-h.c:70: assertion 'towlower (e) == e' failed

Killed by SIGABRT
pid=0x5a5c ppid=0x5a5b tid=0x0001 slot=0x00dc pri=0x0200 mc=0x0001 ps=0x0010
F:\LANG\WORK\GNULIB\GNULIB.GIT\TESTDIR1\GLTESTS\TEST-WCTYPE-H.EXE
Process dumping was disabled, use DUMPPROC / PROCDUMP to enable it.
FAIL test-wctype-h.exe (exit status: 134)

From 24cccb995ff8a52870a09fd2f9fb4ceb9ea70601 Mon Sep 17 00:00:00 2001
From: KO Myung-Hun <komh@chollian.net>
Date: Fri, 6 Oct 2017 22:06:55 +0900
Subject: [PATCH] wcwidth: check a macro version of wcwidth () as well

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.
---
 lib/wchar.in.h |  7 +------
 m4/wcwidth.m4  | 15 +++++++++++++--
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/lib/wchar.in.h b/lib/wchar.in.h
index c65cc6668..3307e235e 100644
--- a/lib/wchar.in.h
+++ b/lib/wchar.in.h
@@ -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
diff --git a/m4/wcwidth.m4 b/m4/wcwidth.m4
index 58716416c..6f6a7196b 100644
--- a/m4/wcwidth.m4
+++ b/m4/wcwidth.m4
@@ -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,18 @@ AC_DEFUN([gl_FUNC_WCWIDTH],
     HAVE_DECL_WCWIDTH=0
   fi
 
-  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])])
+
+  if test $ac_cv_func_wcwidth = yes ||
+     test $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.
-- 
2.13.3

Reply via email to