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: Mon, 09 Oct 2017 22:07:36 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-96-generic; KDE/5.18.0; x86_64; ; )

Eric Blake wrote:
> On 10/07/2017 02:23 AM, Bruno Haible wrote:
> > Thanks, I applied your patch, with the additional optimizations (below):
> > 
> 
> > - Simplify 'test EXPR1 || test EXPR2' to 'test EXPR1 -o EXPR2'.
> 
> No, that is a pessimization.  POSIX explicitly states that use of -a or
> -o with test is prone to obscure breakage, and should not be treated as
> portable.

I could live with that, as I haven't seen test '-a' or '-o' breakage in
the last 15 years. But it's worse than that: POSIX
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html
now marks '-a' and '-o' as "obsolescent", which means that new implementations
of 'test' need not support it.


2017-10-09  Bruno Haible  <address@hidden>

        wcwidth: Don't use obsolete syntax of 'test'.
        Reported by Eric Blake.
        * m4/wcwidth.m4 (gl_FUNC_WCWIDTH): Don't optimize two 'test'
        invocations into one, as POSIX marks '-a' and '-o' as "obsolescent".

diff --git a/m4/wcwidth.m4 b/m4/wcwidth.m4
index b44a9ed..1243606 100644
--- a/m4/wcwidth.m4
+++ b/m4/wcwidth.m4
@@ -1,4 +1,4 @@
-# wcwidth.m4 serial 24
+# wcwidth.m4 serial 25
 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,
@@ -47,7 +47,7 @@ AC_DEFUN([gl_FUNC_WCWIDTH],
       ])
   fi
 
-  if test $ac_cv_func_wcwidth = yes -o "$gl_cv_func_wcwidth_macro" = yes; then
+  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.




reply via email to

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