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: Paul Eggert
Subject: Re: AC_SYS_LARGEFILE bug in autoconf cvs 20001215
Date: Wed, 20 Dec 2000 10:11:31 -0800 (PST)

> Date: Wed, 20 Dec 2000 03:16:22 -0500 (EST)
> From: Pavel Roskin <address@hidden>

> > > > line 2: warning 602: Integer constant exceeds its storage.
> > > > line 2: warning 602: Integer constant exceeds its storage.
> 
> Some vendor C compilers are stripped down C++
> compilers, so they are as strict as C++ about those constants.

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'?

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?

If so, then the following patch should fix things:

2000-12-20  Paul Eggert  <address@hidden>

        * largefile.m4 (AC_SYS_LARGEFILE_TEST_INCLUDES): Do not use
        9223372036854775807, as some C++ compilers masquerading as C
        compilers incorrectly reject large integer constants.

===================================================================
RCS file: largefile.m4,v
retrieving revision 1.16
retrieving revision 1.18
diff -pu -r1.16 -r1.18
--- largefile.m4        2000/12/02 00:41:26     1.16
+++ largefile.m4        2000/12/20 18:08:04     1.18
@@ -1,4 +1,4 @@
-#serial 15
+#serial 18
 
 dnl By default, many hosts won't let programs access large files;
 dnl one must use special compiler options to get large-file access to work.
@@ -11,7 +11,14 @@ dnl Internal subroutine of AC_SYS_LARGEF
 dnl AC_SYS_LARGEFILE_TEST_INCLUDES
 AC_DEFUN(AC_SYS_LARGEFILE_TEST_INCLUDES,
   [[#include <sys/types.h>
-    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];
   ]])
 
 dnl Internal subroutine of AC_SYS_LARGEFILE.



reply via email to

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