bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] wcwidth: check a macro version of wcwidth () as well


From: Bruno Haible
Subject: Re: [PATCH] wcwidth: check a macro version of wcwidth () as well
Date: Sat, 07 Oct 2017 09:23:46 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-96-generic; KDE/5.18.0; x86_64; ; )

Hi,

KO Myung-Hun wrote:
> > 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.

Thanks. I'm glad to see that it passes the test-wchar-c++ test.

> >> +    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.

Thanks, I applied your patch, with the additional optimizations (below):

- Don't perform the "checking whether wcwidth is a macro" test when wcwidth
  is already known to be a function (which is the case on the vast majority
  of platforms).
- Simplify 'test EXPR1 || test EXPR2' to 'test EXPR1 -o EXPR2'.

Hope I didn't introduce any bugs through this.

diff --git a/ChangeLog b/ChangeLog
index f4fa964..470012f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-10-06  KO Myung-Hun  <address@hidden>
+
+       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  <address@hidden>
 
        getopt-posix: Clarify copyright header.
diff --git a/m4/wcwidth.m4 b/m4/wcwidth.m4
index 6f6a719..b44a9ed 100644
--- a/m4/wcwidth.m4
+++ b/m4/wcwidth.m4
@@ -34,18 +34,20 @@ AC_DEFUN([gl_FUNC_WCWIDTH],
     HAVE_DECL_WCWIDTH=0
   fi
 
-  AC_CACHE_CHECK([whether wcwidth is a macro],
-    [gl_cv_func_wcwidth_macro],
-    [AC_EGREP_CPP([wchar_header_defines_wcwidth], [
+  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])])
+         [gl_cv_func_wcwidth_macro=yes],
+         [gl_cv_func_wcwidth_macro=no])
+      ])
+  fi
 
-  if test $ac_cv_func_wcwidth = yes ||
-     test $gl_cv_func_wcwidth_macro = yes; then
+  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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]