Re: [PATCH 1/3] autoconf: prefer an unrolled loop for trivial AC_CHECK_FUNCS

Eric Blake <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.patches
Organization Red Hat, Inc.
Message-ID <[email protected]>
On 10/31/2016 06:39 AM, Paolo Bonzini wrote:
> An unrolled loop avoids the cost of spawning sed in AS_TR_SH and
> AS_TR_CPP.  Prefer it if there is nothing in the second and third
> argument of AC_CHECK_FUNCS and the first argument is a literal.
> Modify AC_CHECK_FUNCS_ONCE to avoid the variable indirection too.
> 
> * lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Unroll loop if safe.
> (_AC_CHECK_FUNCS): Move basic implementation here.
> (_AC_CHECK_FUNC_ONCE): Expand AC_CHECK_FUNCS here...
> (_AC_FUNCS_EXPANSION): ... and not here, so remove.

> -	       [$3])dnl])
> +[m4_if([$2$3]AS_LITERAL_IF([$1], [yes], [no]), []yes,

Why []yes instead of the more typical [yes] ?

If the user has (unwisely) defined yes as a macro, your version will
compare against their expansion, instead of against the intended literal.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc (application/pgp-signature, 604 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBCAAGBQJYF2MkAAoJEKeha0olJ0Nq7UQIAJ18LqBGrpSyeHaizKO5Km71
CUlQz0hCf2wazQ30yzjV8pD/ZOnvgFn4sA7+Go5JQ6nWp3M/1prpENPRBvA0dlpa
FWXdIaaYw8I8K5ows8DcIDilmmuiyDRRTSiDOmgqeoAXPax7GT2O5JI52oFzIuVk
1thYrHK1bvnL0WmvK9uQr+mYf/NFBquw/2Kt1ZxkR3R03CmALjC1nINoomLkv5SE
TfnduOFnCUJnLzZ3W8eyh0fc9Q170WbTgWEYm6Ri6JfFUTCnCNZn0hK7cbcRMTLX
p/N26ON9wGbGWYRkdIbx+Pp89K7xovR1EEor2bzL6cPSbqctJY9JVfeV9hQNYKE=
=eG8g
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.