bug-autoconf
[Top][All Lists]
Advanced

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

Re: AC_SYS_LARGEFILE bug in autoconf cvs 20001215


From: Pavel Roskin
Subject: Re: AC_SYS_LARGEFILE bug in autoconf cvs 20001215
Date: Wed, 20 Dec 2000 14:02:22 -0500 (EST)

Hello, Paul!

> I am not a C++ expert so you'll have to help me out here.
> Are you saying that C++ compilers must reject constants like
> 9223372036854775807 that are larger than 'int', even though
> the implementations support 64-bit 'long' or 'long long'?

I'm saying that 9223372036854775807 is an integer constant because it has
no modifiers. You cast it to (off_t) after it's already interpreted as an
integer constant.

Either of those constants should be Ok:

9223372036854775807l    (if sizeof(long) is big enough)
9223372036854775807ll   (if "long long" is supported)

> In other words, are you saying that the autoconf test is incorrect
> because it incorrectly rejects compilers that have 64-bit off_t, even
> if the compilers don't conform to the C standard with respect to large
> integer constants?

I fail to see how support for constants in the _compiler_ affects support
of large files in the _library_. Most time the position in a file is
determined by an expession, not by a huge constant. Besides, large
constants are supported, you should just use the right modifier.

> -    int a[(off_t) 9223372036854775807 == 9223372036854775807 ? 1 : -1];
> +    /* Check that off_t can represent 2**63 - 1 correctly.
> +       We can't simply "#define LARGE_OFF_T 9223372036854775807",
> +       since some C++ compilers masquerading as C compilers
> +       incorrectly reject 9223372036854775807.  */
> +#   define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
> +    int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
> +                     && LARGE_OFF_T % 2147483647 == 1)
> +                    ? 1 : -1];
>    ]])

Let's make a simple test
configure.in:

AC_INIT
AC_LANG(C++)
AC_SYS_LARGEFILE
AC_OUTPUT

Your patch is applied, configure is generated.

>From config.log:

configure:1286: g++ -c -g -O2  conftest.cc >&5
configure:1259: warning: left shift count >= width of type
configure:1259: warning: left shift count >= width of type
configure:1260: warning: left shift count >= width of type
configure:1260: warning: left shift count >= width of type
configure:1261: syntax error before `?'
configure:1289: $? = 1

If we add parens around ((off_t) 1) the warning disappears (in one case
which should be detected) but the error is still there.

Anyway, we are getting close.

Regards,
Pavel Roskin




reply via email to

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