[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: proposed gnulib-related additions to Autoconf
From: |
Paul Eggert |
Subject: |
Re: proposed gnulib-related additions to Autoconf |
Date: |
Wed, 05 Apr 2006 00:37:03 -0700 |
User-agent: |
Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) |
Ralf Wildenhues <address@hidden> writes:
> First, there is still a bug in both your version and mine, AFAICS: if
> you pass a MIN-VARIABLE for an unsigned entity, and that variable is not
> yet defined, it computes the wrong result.
I assume this can be fixed by replacing:
[$ac_min1 < $ac_min && ($1) $ac_min1 == $ac_min1]
with:
[$ac_min1 < $ac_min && ($1) $ac_min1 == $ac_min1
&& ($1) $ac_min1 < 0]
so that we don't execute the ac_min=$ac_min1 assignment by mistake.
> Eric mentioned the desire for a macro to compute all of stdint.
> So I decided it was worthwhile to have one that does not expand to
> megabytes of redundant code, even if it was very slow. Thus the
> version below allows shell variables as arguments.
I don't quite follow the motivation here, sorry. (This is the most
important point, ...)
> Would you rather prefer a BITS-VARIABLE to a VALUE-BITS-VARIABLE, by
> the way?
I'm not sure why one would need a bits-variable; can't you just use
sizeof (type) * CHAR_BIT?
> Currently the VALUE-BITS-VARIABLE is not tested for being defined
> already. Should that be included for safety?
I wouldn't bother, for now.
> I tried to accomodate for all that was brought up in the previous
> discussion. The testsuite found one more subtle bug: in this code
> while :; do
> AC_COMPILE_IFELSE([program], [if-true], [break])
> done
>
> the break will inhibit the cleanup code that removes conftest.c
I should have remembered that. We can fix that without using an extra
status variable by using this sort of idea:
# Double the number of bits until this fails.
while
$3[]1=`expr $$3 '*' 2`
ac_max="((((($1) 1 << ($$3 - 1 - $2)) - 1) << 1) + 1)"
ac_max1="((((($1) 1 << ($$3[]1 - 1 - $2)) - 1) << 1) + 1)"
AC_COMPILE_IFELSE(
[AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT([$4])],
[$ac_max < $ac_max1 && ($1) $ac_max1 == $ac_max1])],
[$3=$$3[]1])
test $3 = $$3[]1
do :
done