bug-gnulib
[Top][All Lists]
Advanced

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

Re: new module 'vasnprintf-posix'


From: Eric Blake
Subject: Re: new module 'vasnprintf-posix'
Date: Tue, 06 Mar 2007 22:58:57 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.10) Gecko/20070221 Thunderbird/1.5.0.10 Mnenhy/0.7.4.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Bruno Haible on 3/4/2007 4:28 PM:
> The module vasnprintf-posix defines a vasnprintf() function that supports
> POSIX format strings with all frills.
> 
>   AC_CHECK_FUNCS([vasnprintf])
>   if expr "$gl_cv_func_printf_sizes_c99" : ".*yes" > /dev/null \
>      && expr "$gl_cv_func_printf_directive_a" : ".*yes" > /dev/null \
>      && expr "$gl_cv_func_printf_directive_n" : ".*yes" > /dev/null \
>      && expr "$gl_cv_func_printf_positions" : ".*yes" > /dev/null \
>      && test $ac_cv_func_vasnprintf = yes; then
>     : # vasnprintf exists and is already POSIX compliant.

This is rather expensive in the number of forks (ie. noticeably slows down
./configure on cygwin).  Couldn't you rewrite it using shell builtins:

case "$gl_cv_func_printf_sizes_c99:$gl_cv_func_printf_directive_a:..." in
 *no*) # vasnprintf needs help
esac

>   if (sprintf (buf, "%zu %d", (size_t) 12345672, 33, 44, 55) < 0
>       || strcmp (buf, "12345672 33") != 0)

This causes false negatives (more arguments than % directives) when
configuring with gcc -Wall -Werror.  This happens throughout your tests in
printf.m4.

> changequote(,)dnl
>        case "$host_os" in
>                                dnl Guess yes on glibc systems.


I'll just reiterate my dislike of changequote.  You violated your own
copy-n-paste rule of thumb here by using dnl instead of shell comments
inside a region that you are marking as shell literal.  I would rather see
this as:

[[
    case "$host_os" in
           # Guess yes on glibc systems.
        *-gnu*) ...
           # Guess yes on MacOS X >= 10.3
        darwin[1-6].*) ...
...
    esac
]]

with the [[ and ]] serving as the delimiters of copy-n-pasteable
shell-literal code rather than changequote(,).

I'm also going to add %a and %A support to m4 2.0's format builtin, as a
good test of this module, so expect some feedback as I try that.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF7lSh84KuGfSFAYARAp0UAJ9lRNk/2eIbUA5gSRbb/x5itor5tACggeLR
qpM/S/awGu75LyDcYvcgVEg=
=TyH8
-----END PGP SIGNATURE-----




reply via email to

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