[Top][All Lists]

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

Linux, autoconf 2.52: inttypes.h incompatibility with iostream [#5060]

From: Keith Bostic
Subject: Linux, autoconf 2.52: inttypes.h incompatibility with iostream [#5060]
Date: Thu, 6 Dec 2001 09:59:23 -0500 (EST)

I'm using autoconf 2.52, on Linux with gcc 3.0.2, glibc 2.2.4.

Our software needs fixed-size types, for example, "int32_t".
So, we look for the types, and, if we don't find them, we build
our own:

        # Check the sizes we know about, and see if any of them match
        # what's needed.
        # $1 substitution variable
        # $2 type name
        # $3 size of type in bytes
                case "$3" in
                        $1="typedef unsigned int $2;";;
                        $1="typedef unsigned char $2;";;
                        $1="typedef unsigned short $2;";;
                        $1="typedef unsigned long $2;";;
                        AC_MSG_ERROR([No unsigned $3-byte integral type]);;

        # We need to know the sizes of various objects on this system.
        # We don't use the SIZEOF_XXX values created by autoconf.
        AC_CHECK_SIZEOF(unsigned char)
        AC_CHECK_SIZEOF(unsigned short)
        AC_CHECK_SIZEOF(unsigned int)
        AC_CHECK_SIZEOF(unsigned long)
        AC_CHECK_SIZEOF(char *)

        if test "$ac_cv_type_u_int32_t" = no; then
                AM_SEARCH_USIZES(u_int32_decl, u_int32_t, 4)

The problem is the standard include files autoconf uses include

If you take this code:

        #include <iostream>
        #include <inttypes.h>

and compile it on Linux with g++ -O2 (at least with gcc 3.0.2, glibc
2.2.4, but probably more), then compilation fails like this:

/usr/include/inttypes.h: In function `intmax_t wcstoimax(const __gwchar_t*, 
   __gwchar_t**, int)':
/usr/include/inttypes.h:432: cannot convert `const __gwchar_t* __restrict' to 
   `const wchar_t*' for argument `1' to `long long int
__wcstoll_internal(const    wchar_t*, wchar_t**, int, int)'
/usr/include/inttypes.h: In function `uintmax_t wcstoumax(const __gwchar_t*, 
   __gwchar_t**, int)':
/usr/include/inttypes.h:451: cannot convert `const __gwchar_t* __restrict' to 
   `const wchar_t*' for argument `1' to `long long unsigned int 
   __wcstoull_internal(const wchar_t*, wchar_t**, int, int)'

What is going on is that compiling with optimization turns on inlining
via a preprocess macro __USE_EXTERN_INLINES, and the inlined code in
inttypes.h is incompatible with wchar.h, which is being included via

Does anybody have any suggestions as to how to solve this problem?

My only idea at the moment is to change autoconf's default includes
to stop using inttypes.h at all, but that's pretty ugly.

Thank you!


Keith Bostic
Sleepycat Software Inc.         address@hidden
118 Tower Rd.                   +1-781-259-3139
Lincoln, MA 01773     

reply via email to

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