bug-gnulib
[Top][All Lists]
Advanced

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

Re: stdint.h, C++ and __STDC_LIMIT_MACROS


From: Pedro Alves
Subject: Re: stdint.h, C++ and __STDC_LIMIT_MACROS
Date: Mon, 02 Nov 2015 10:36:39 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

On 11/02/2015 01:36 AM, Paul Eggert wrote:
> Pedro Alves wrote:
>> and gnulib is deciding that the system's stdint.h is good enough
>> At least, I don't get a stdint.h replacement.
> 
> Since gnulib's test program contains this:
> 
> intmax_t i = INTMAX_MAX;
> 
> I'm surprised that gnulib decided that the system's stdint.h was good enough. 
> Perhaps you could investigate why.
> 

Thanks Paul.

AFAICS, that doesn't compile, the test fails, but I still don't
get a replacement.  config.log has this:

~~~
conftest.cpp:150:14: error: 'INTMAX_MAX' was not declared in this scope
 intmax_t i = INTMAX_MAX;
              ^
~~~

See here the whole context of the stdint.h test:

~~~
configure:8818: checking whether stdint.h conforms to C99
configure:8987: x86_64-w64-mingw32-g++ -c -g -O2  conftest.cpp >&5
conftest.cpp:66:2: error: #error "WCHAR_MIN, WCHAR_MAX not defined in 
<stdint.h>"
 #error "WCHAR_MIN, WCHAR_MAX not defined in <stdint.h>"
  ^
conftest.cpp:100:50: error: size of array 'b1' is negative
 typedef int b1[(unsigned char) -1 != 255 ? 1 : -1];
                                                  ^
conftest.cpp:111:31: error: 'INT8_C' was not declared in this scope
 int_least8_t c1 = INT8_C (0x7f);
                               ^
conftest.cpp:112:22: error: 'INT_LEAST8_MAX' was not declared in this scope
 int_least8_t c1max = INT_LEAST8_MAX;
                      ^
conftest.cpp:113:22: error: 'INT_LEAST8_MIN' was not declared in this scope
 int_least8_t c1min = INT_LEAST8_MIN;
                      ^
conftest.cpp:114:35: error: 'INT16_C' was not declared in this scope
 int_least16_t c2 = INT16_C (0x7fff);
                                   ^
conftest.cpp:115:23: error: 'INT_LEAST16_MAX' was not declared in this scope
 int_least16_t c2max = INT_LEAST16_MAX;
                       ^
conftest.cpp:116:23: error: 'INT_LEAST16_MIN' was not declared in this scope
 int_least16_t c2min = INT_LEAST16_MIN;
                       ^
conftest.cpp:117:39: error: 'INT32_C' was not declared in this scope
 int_least32_t c3 = INT32_C (0x7fffffff);
                                       ^
conftest.cpp:118:23: error: 'INT_LEAST32_MAX' was not declared in this scope
 int_least32_t c3max = INT_LEAST32_MAX;
                       ^
conftest.cpp:119:23: error: 'INT_LEAST32_MIN' was not declared in this scope
 int_least32_t c3min = INT_LEAST32_MIN;
                       ^
conftest.cpp:120:47: error: 'INT64_C' was not declared in this scope
 int_least64_t c4 = INT64_C (0x7fffffffffffffff);
                                               ^
conftest.cpp:121:23: error: 'INT_LEAST64_MAX' was not declared in this scope
 int_least64_t c4max = INT_LEAST64_MAX;
                       ^
conftest.cpp:122:23: error: 'INT_LEAST64_MIN' was not declared in this scope
 int_least64_t c4min = INT_LEAST64_MIN;
                       ^
conftest.cpp:123:33: error: 'UINT8_C' was not declared in this scope
 uint_least8_t d1 = UINT8_C (0xff);
                                 ^
conftest.cpp:124:23: error: 'UINT_LEAST8_MAX' was not declared in this scope
 uint_least8_t d1max = UINT_LEAST8_MAX;
                       ^
conftest.cpp:125:37: error: 'UINT16_C' was not declared in this scope
 uint_least16_t d2 = UINT16_C (0xffff);
                                     ^
conftest.cpp:126:24: error: 'UINT_LEAST16_MAX' was not declared in this scope
 uint_least16_t d2max = UINT_LEAST16_MAX;
                        ^
conftest.cpp:127:41: error: 'UINT32_C' was not declared in this scope
 uint_least32_t d3 = UINT32_C (0xffffffff);
                                         ^
conftest.cpp:128:24: error: 'UINT_LEAST32_MAX' was not declared in this scope
 uint_least32_t d3max = UINT_LEAST32_MAX;
                        ^
conftest.cpp:129:49: error: 'UINT64_C' was not declared in this scope
 uint_least64_t d4 = UINT64_C (0xffffffffffffffff);
                                                 ^
conftest.cpp:130:24: error: 'UINT_LEAST64_MAX' was not declared in this scope
 uint_least64_t d4max = UINT_LEAST64_MAX;
                        ^
conftest.cpp:131:18: error: 'INT_FAST8_MAX' was not declared in this scope
 int_fast8_t e1 = INT_FAST8_MAX;
                  ^
conftest.cpp:132:21: error: 'INT_FAST8_MIN' was not declared in this scope
 int_fast8_t e1min = INT_FAST8_MIN;
                     ^
conftest.cpp:133:19: error: 'INT_FAST16_MAX' was not declared in this scope
 int_fast16_t e2 = INT_FAST16_MAX;
                   ^
conftest.cpp:134:22: error: 'INT_FAST16_MIN' was not declared in this scope
 int_fast16_t e2min = INT_FAST16_MIN;
                      ^
conftest.cpp:135:19: error: 'INT_FAST32_MAX' was not declared in this scope
 int_fast32_t e3 = INT_FAST32_MAX;
                   ^
conftest.cpp:136:22: error: 'INT_FAST32_MIN' was not declared in this scope
 int_fast32_t e3min = INT_FAST32_MIN;
                      ^
conftest.cpp:137:19: error: 'INT_FAST64_MAX' was not declared in this scope
 int_fast64_t e4 = INT_FAST64_MAX;
                   ^
conftest.cpp:138:22: error: 'INT_FAST64_MIN' was not declared in this scope
 int_fast64_t e4min = INT_FAST64_MIN;
                      ^
conftest.cpp:139:19: error: 'UINT_FAST8_MAX' was not declared in this scope
 uint_fast8_t f1 = UINT_FAST8_MAX;
                   ^
conftest.cpp:140:20: error: 'UINT_FAST16_MAX' was not declared in this scope
 uint_fast16_t f2 = UINT_FAST16_MAX;
                    ^
conftest.cpp:141:20: error: 'UINT_FAST32_MAX' was not declared in this scope
 uint_fast32_t f3 = UINT_FAST32_MAX;
                    ^
conftest.cpp:142:20: error: 'UINT_FAST64_MAX' was not declared in this scope
 uint_fast64_t f4 = UINT_FAST64_MAX;
                    ^
conftest.cpp:150:14: error: 'INTMAX_MAX' was not declared in this scope
 intmax_t i = INTMAX_MAX;
              ^
conftest.cpp:151:15: error: 'UINTMAX_MAX' was not declared in this scope
 uintmax_t j = UINTMAX_MAX;
               ^
conftest.cpp:158:7: error: 'PTRDIFF_MIN' was not declared in this scope
       PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t)
       ^
conftest.cpp:159:10: error: 'PTRDIFF_MAX' was not declared in this scope
       && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t)
          ^
conftest.cpp:163:7: error: 'SIG_ATOMIC_MIN' was not declared in this scope
       SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t)
       ^
conftest.cpp:164:10: error: 'SIG_ATOMIC_MAX' was not declared in this scope
       && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t)
          ^
conftest.cpp:173:7: error: 'WINT_MIN' was not declared in this scope
       WINT_MIN == TYPE_MINIMUM (wint_t)
       ^
conftest.cpp:174:10: error: 'WINT_MAX' was not declared in this scope
       && WINT_MAX == TYPE_MAXIMUM (wint_t)
          ^
conftest.cpp:179:25: error: a function call cannot appear in a 
constant-expression
         (-1 < UINT8_C (0)) == (-1 < (uint_least8_t) 0) ? 1 : -1;
                         ^
conftest.cpp:181:26: error: a function call cannot appear in a 
constant-expression
         (-1 < UINT16_C (0)) == (-1 < (uint_least16_t) 0) ? 1 : -1;
                          ^
conftest.cpp:196:48: error: 'UINT_LEAST8_MAX' was not declared in this scope
   int check_uint_least8: (uint_least8_t) -1 == UINT_LEAST8_MAX ? 1 : -1;
                                                ^
conftest.cpp:197:50: error: 'UINT_LEAST16_MAX' was not declared in this scope
   int check_uint_least16: (uint_least16_t) -1 == UINT_LEAST16_MAX ? 1 : -1;
                                                  ^
conftest.cpp:198:50: error: 'UINT_LEAST32_MAX' was not declared in this scope
   int check_uint_least32: (uint_least32_t) -1 == UINT_LEAST32_MAX ? 1 : -1;
                                                  ^
conftest.cpp:199:50: error: 'UINT_LEAST64_MAX' was not declared in this scope
   int check_uint_least64: (uint_least64_t) -1 == UINT_LEAST64_MAX ? 1 : -1;
                                                  ^
conftest.cpp:200:46: error: 'UINT_FAST8_MAX' was not declared in this scope
   int check_uint_fast8: (uint_fast8_t) -1 == UINT_FAST8_MAX ? 1 : -1;
                                              ^
conftest.cpp:201:48: error: 'UINT_FAST16_MAX' was not declared in this scope
   int check_uint_fast16: (uint_fast16_t) -1 == UINT_FAST16_MAX ? 1 : -1;
                                                ^
conftest.cpp:202:48: error: 'UINT_FAST32_MAX' was not declared in this scope
   int check_uint_fast32: (uint_fast32_t) -1 == UINT_FAST32_MAX ? 1 : -1;
                                                ^
conftest.cpp:203:48: error: 'UINT_FAST64_MAX' was not declared in this scope
   int check_uint_fast64: (uint_fast64_t) -1 == UINT_FAST64_MAX ? 1 : -1;
                                                ^
conftest.cpp:204:40: error: 'UINTPTR_MAX' was not declared in this scope
   int check_uintptr: (uintptr_t) -1 == UINTPTR_MAX ? 1 : -1;
                                        ^
conftest.cpp:205:40: error: 'UINTMAX_MAX' was not declared in this scope
   int check_uintmax: (uintmax_t) -1 == UINTMAX_MAX ? 1 : -1;
                                        ^
configure:8987: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define __EXTENSIONS__ 1
| #define _ALL_SOURCE 1
| #define _DARWIN_C_SOURCE 1
| #define _GNU_SOURCE 1
| #define __USE_MINGW_ANSI_STDIO 1
| #define _POSIX_PTHREAD_SEMANTICS 1
| #define _TANDEM_SOURCE 1
| #define _FILE_OFFSET_BITS 64
| #define _DARWIN_USE_64_BIT_INODE 1
| #define HAVE_ALLOCA 1
| #define HAVE_GETCWD 1
| #define HAVE_BTOWC 1
| #define HAVE_ISBLANK 1
| #define HAVE_ISWCTYPE 1
| #define HAVE_MBSRTOWCS 1
| #define HAVE_MEMPCPY 1
| #define HAVE_WMEMCHR 1
| #define HAVE_WMEMCPY 1
| #define HAVE_WMEMPCPY 1
| #define HAVE_GETTIMEOFDAY 1
| #define HAVE_MBSINIT 1
| #define HAVE_MBRTOWC 1
| #define HAVE_MPROTECT 1
| #define HAVE_ISWCNTRL 1
| #define HAVE_SYS_PARAM_H 1
| #define HAVE_DIRENT_H 1
| #define HAVE_WCTYPE_H 1
| #define HAVE_SYS_TIME_H 1
| #define HAVE_WCHAR_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_MATH_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_MBSTATE_T 1
| #define HAVE_DECL_ALARM 0
| #define restrict /**/
| #define HAVE_WINSOCK2_H 1
| #define HAVE_RAW_DECL_GETTIMEOFDAY 1
| #define HAVE_UNSIGNED_LONG_LONG_INT 1
| #define HAVE_LONG_LONG_INT 1
| /* end confdefs.h.  */
|
|
| #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
| #include <stdint.h>
| /* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in <wchar.h>.  */
| #if !(defined WCHAR_MIN && defined WCHAR_MAX)
| #error "WCHAR_MIN, WCHAR_MAX not defined in <stdint.h>"
| #endif
|
|
|   /* BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
|      included before <wchar.h>.  */
|   #include <stddef.h>
|   #include <signal.h>
|   #if HAVE_WCHAR_H
|   # include <stdio.h>
|   # include <time.h>
|   # include <wchar.h>
|   #endif
|
|
| #ifdef INT8_MAX
| int8_t a1 = INT8_MAX;
| int8_t a1min = INT8_MIN;
| #endif
| #ifdef INT16_MAX
| int16_t a2 = INT16_MAX;
| int16_t a2min = INT16_MIN;
| #endif
| #ifdef INT32_MAX
| int32_t a3 = INT32_MAX;
| int32_t a3min = INT32_MIN;
| #endif
| #ifdef INT64_MAX
| int64_t a4 = INT64_MAX;
| int64_t a4min = INT64_MIN;
| #endif
| #ifdef UINT8_MAX
| uint8_t b1 = UINT8_MAX;
| #else
| typedef int b1[(unsigned char) -1 != 255 ? 1 : -1];
| #endif
| #ifdef UINT16_MAX
| uint16_t b2 = UINT16_MAX;
| #endif
| #ifdef UINT32_MAX
| uint32_t b3 = UINT32_MAX;
| #endif
| #ifdef UINT64_MAX
| uint64_t b4 = UINT64_MAX;
| #endif
| int_least8_t c1 = INT8_C (0x7f);
| int_least8_t c1max = INT_LEAST8_MAX;
| int_least8_t c1min = INT_LEAST8_MIN;
| int_least16_t c2 = INT16_C (0x7fff);
| int_least16_t c2max = INT_LEAST16_MAX;
| int_least16_t c2min = INT_LEAST16_MIN;
| int_least32_t c3 = INT32_C (0x7fffffff);
| int_least32_t c3max = INT_LEAST32_MAX;
| int_least32_t c3min = INT_LEAST32_MIN;
| int_least64_t c4 = INT64_C (0x7fffffffffffffff);
| int_least64_t c4max = INT_LEAST64_MAX;
| int_least64_t c4min = INT_LEAST64_MIN;
| uint_least8_t d1 = UINT8_C (0xff);
| uint_least8_t d1max = UINT_LEAST8_MAX;
| uint_least16_t d2 = UINT16_C (0xffff);
| uint_least16_t d2max = UINT_LEAST16_MAX;
| uint_least32_t d3 = UINT32_C (0xffffffff);
| uint_least32_t d3max = UINT_LEAST32_MAX;
| uint_least64_t d4 = UINT64_C (0xffffffffffffffff);
| uint_least64_t d4max = UINT_LEAST64_MAX;
| int_fast8_t e1 = INT_FAST8_MAX;
| int_fast8_t e1min = INT_FAST8_MIN;
| int_fast16_t e2 = INT_FAST16_MAX;
| int_fast16_t e2min = INT_FAST16_MIN;
| int_fast32_t e3 = INT_FAST32_MAX;
| int_fast32_t e3min = INT_FAST32_MIN;
| int_fast64_t e4 = INT_FAST64_MAX;
| int_fast64_t e4min = INT_FAST64_MIN;
| uint_fast8_t f1 = UINT_FAST8_MAX;
| uint_fast16_t f2 = UINT_FAST16_MAX;
| uint_fast32_t f3 = UINT_FAST32_MAX;
| uint_fast64_t f4 = UINT_FAST64_MAX;
| #ifdef INTPTR_MAX
| intptr_t g = INTPTR_MAX;
| intptr_t gmin = INTPTR_MIN;
| #endif
| #ifdef UINTPTR_MAX
| uintptr_t h = UINTPTR_MAX;
| #endif
| intmax_t i = INTMAX_MAX;
| uintmax_t j = UINTMAX_MAX;
|
| #include <limits.h> /* for CHAR_BIT */
| #define TYPE_MINIMUM(t)   ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ TYPE_MAXIMUM (t)))
| #define TYPE_MAXIMUM(t)   ((t) ((t) 0 < (t) -1         ? (t) -1         : 
((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1)))
| struct s {
|   int check_PTRDIFF:
|       PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t)
|       && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t)
|       ? 1 : -1;
|   /* Detect bug in FreeBSD 6.0 / ia64.  */
|   int check_SIG_ATOMIC:
|       SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t)
|       && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t)
|       ? 1 : -1;
|   int check_SIZE: SIZE_MAX == TYPE_MAXIMUM (size_t) ? 1 : -1;
|   int check_WCHAR:
|       WCHAR_MIN == TYPE_MINIMUM (wchar_t)
|       && WCHAR_MAX == TYPE_MAXIMUM (wchar_t)
|       ? 1 : -1;
|   /* Detect bug in mingw.  */
|   int check_WINT:
|       WINT_MIN == TYPE_MINIMUM (wint_t)
|       && WINT_MAX == TYPE_MAXIMUM (wint_t)
|       ? 1 : -1;
|
|   /* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others.  */
|   int check_UINT8_C:
|         (-1 < UINT8_C (0)) == (-1 < (uint_least8_t) 0) ? 1 : -1;
|   int check_UINT16_C:
|         (-1 < UINT16_C (0)) == (-1 < (uint_least16_t) 0) ? 1 : -1;
|
|   /* Detect bugs in OpenBSD 3.9 stdint.h.  */
| #ifdef UINT8_MAX
|   int check_uint8: (uint8_t) -1 == UINT8_MAX ? 1 : -1;
| #endif
| #ifdef UINT16_MAX
|   int check_uint16: (uint16_t) -1 == UINT16_MAX ? 1 : -1;
| #endif
| #ifdef UINT32_MAX
|   int check_uint32: (uint32_t) -1 == UINT32_MAX ? 1 : -1;
| #endif
| #ifdef UINT64_MAX
|   int check_uint64: (uint64_t) -1 == UINT64_MAX ? 1 : -1;
| #endif
|   int check_uint_least8: (uint_least8_t) -1 == UINT_LEAST8_MAX ? 1 : -1;
|   int check_uint_least16: (uint_least16_t) -1 == UINT_LEAST16_MAX ? 1 : -1;
|   int check_uint_least32: (uint_least32_t) -1 == UINT_LEAST32_MAX ? 1 : -1;
|   int check_uint_least64: (uint_least64_t) -1 == UINT_LEAST64_MAX ? 1 : -1;
|   int check_uint_fast8: (uint_fast8_t) -1 == UINT_FAST8_MAX ? 1 : -1;
|   int check_uint_fast16: (uint_fast16_t) -1 == UINT_FAST16_MAX ? 1 : -1;
|   int check_uint_fast32: (uint_fast32_t) -1 == UINT_FAST32_MAX ? 1 : -1;
|   int check_uint_fast64: (uint_fast64_t) -1 == UINT_FAST64_MAX ? 1 : -1;
|   int check_uintptr: (uintptr_t) -1 == UINTPTR_MAX ? 1 : -1;
|   int check_uintmax: (uintmax_t) -1 == UINTMAX_MAX ? 1 : -1;
|   int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1;
| };
|
| int
| main ()
| {
|
|   ;
|   return 0;
| }
configure:9079: result: no
~~~


$ grep -rn gl_cv_header_working_stdint_h
config.cache:628:gl_cv_header_working_stdint_h=${gl_cv_header_working_stdint_h=no}
config.log:39493:gl_cv_header_working_stdint_h=no

But, I don't get a replacement:

$ find . -name stdint.h
$

Any hints on where I should be looking next?

Thanks,
Pedro Alves




reply via email to

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