[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: stdint and mingw
From: |
Bruno Haible |
Subject: |
Re: stdint and mingw |
Date: |
Wed, 30 May 2007 02:38:43 +0200 |
User-agent: |
KMail/1.5.4 |
Eric Blake wrote:
> mingw has wint_t as unsigned int, but defined WINT_MAX as 0xffff to match
> WCHAR_MAX. Without this patch, stdint.m4 claims mingw's header is C99
> compliant, then crashes the m4 testsuite (now that m4 uses the gnulib unit
> tests) when encountering the invalid WINT_MAX. With this patch,
> test-stdint.c
> passes once again on mingw. Is this patch okay to apply?
Well, I prefer to avoid signed integer overflow, as in WINT_MAX + 1, since
we know by now the trouble that it can cause. Can you try this patch instead?
*** m4/stdint.m4 28 Apr 2007 18:05:58 -0000 1.29
--- m4/stdint.m4 30 May 2007 00:31:37 -0000
***************
*** 147,153 ****
int check_SIG_ATOMIC: SIG_ATOMIC_MIN <= (sig_atomic_t) 0 && (sig_atomic_t)
0 < SIG_ATOMIC_MAX ? 1 : -1;
int check_SIZE: (size_t) 0 < SIZE_MAX ? 1 : -1;
int check_WCHAR: WCHAR_MIN <= (wchar_t) 0 && (wchar_t) 0 < WCHAR_MAX ? 1 :
-1;
! int check_WINT: WINT_MIN <= (wint_t) 0 && (wint_t) 0 < WINT_MAX ? 1 : -1;
/* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others. */
int check_UINT8_C:
--- 147,155 ----
int check_SIG_ATOMIC: SIG_ATOMIC_MIN <= (sig_atomic_t) 0 && (sig_atomic_t)
0 < SIG_ATOMIC_MAX ? 1 : -1;
int check_SIZE: (size_t) 0 < SIZE_MAX ? 1 : -1;
int check_WCHAR: WCHAR_MIN <= (wchar_t) 0 && (wchar_t) 0 < WCHAR_MAX ? 1 :
-1;
! int check_WINT: WINT_MIN <= (wint_t) 0 && (wint_t) 0 < WINT_MAX
! && (WINT_MIN < (wint_t) 0 || (wint_t) -1 == (wint_t)
WINT_MAX)
! ? 1 : -1;
/* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others. */
int check_UINT8_C:
(The copy of mingw that I have doesn't have the problem that you encountered,
therefore I cannot test it.)
> Other holdups in releasing m4 1.4.10:
> - mingw's atof/strtod does not parse infinity or nan, but gnulib's strtod
> module does not yet provide this capability either. I hope to work on this
> soon, if no one beats me to it.
>
> - gnulib's unistd module does not provide the types gid_t, uid_t, or
> useconds_t, all of which are undefined in mingw, but Bruno's recent testsuite
> additions means that test-unistd.c crashes on mingw in trying to use these
> types.
Two other ones:
- The recent #include_next patch is broken.
- test-stdint fails on FreeBSD 6.0 / ia64. It fails in the lines
verify (TYPE_MINIMUM (sig_atomic_t) == SIG_ATOMIC_MIN);
verify (TYPE_MAXIMUM (sig_atomic_t) == SIG_ATOMIC_MAX);
because sig_atomic_t = long but SIG_ATOMIC_MIN and SIG_ATOMIC_MAX are
defined (in /usr/include/stdint.h) to 32-bit values.
Where can we have a snapshot for testing m4-1.4.10-pre?
Bruno