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

Paolo Bonzini <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.patches
Message-ID <[email protected]>

On 31/10/2016 16:28, Eric Blake wrote:
> 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.

Because I've never understood the rules for m4_if, and thought []yes
matched what you get from m4_if([$2$3]AS_LITERAL_IF([$1], [yes], [no]).

Paolo
signature.asc (application/pgp-signature, 473 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJYF2RnAAoJEL/70l94x66DbkkH/jvFJmWObBOXOBvHMOXBV+U0
ncXIohCZO0q08wiVxVlozvUAUKn3v2DR98g0IhpLUZ0Dd+BC0swyH8/3DZjB+KVI
+fnW6hQHNy/uMdVWMSQS/3eRyaf3Y8uai8grTLlA5RGUDsrCF64bzHJUw5h8NlYd
C6by48hf0d4+Liz2PPmt749ci85QhfmzDkxFrRJvZXhWWMGGt9FfJmjpMvPnbtOV
bhGhmy2NZIYYkFij9CJJkrvusFBkrWr+0QN4jb6FAlwIPcz+Tq2W1njzX04nmlAE
5Tvz+/PPE2CDDq1C0/kGGdv2DJNZe5kF5GqcxI18TlMqahhADfc7Iv16yxDiVa0=
=g3P5
-----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.