[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
mbsinit: fix compilation error in mingw-w64 7.0 with _UCRT defined
From: |
Bruno Haible |
Subject: |
mbsinit: fix compilation error in mingw-w64 7.0 with _UCRT defined |
Date: |
Tue, 17 Dec 2019 10:46:51 +0100 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-166-generic; KDE/5.18.0; x86_64; ; ) |
Newer mingw-w64 releases can be used in a mode that converges more closely
with recent MSVC libraries. [1][2] In this mode, the gnulib mbsinit override
gives a compilation error. [3]
This patch fixes it. People who want to use this mingw mode and compile
packages from source will need packages (bison, coreutils, cpio, diffutils,
gettext, grep, sed, tar, ...) that include this fix.
[1]
https://stackoverflow.com/questions/57528555/how-do-i-build-against-the-ucrt-with-mingw-w64
[2] http://mingw-w64.org/doku.php
[3] https://savannah.gnu.org/bugs/?57406
2019-12-17 Bruno Haible <address@hidden>
mbsinit: Fix compilation error in mingw-w64 7.0 with _UCRT defined.
Reported by Tom Kacvinsky <address@hidden>
and Martin Storsjö <address@hidden>
in <https://savannah.gnu.org/bugs/?57406>.
* lib/mbsinit.c: Accommodate an MSVC-like mbstate_t definition with
mingw.
diff --git a/lib/mbsinit.c b/lib/mbsinit.c
index 5ecaef7..b42909e 100644
--- a/lib/mbsinit.c
+++ b/lib/mbsinit.c
@@ -56,13 +56,10 @@ mbsinit (const mbstate_t *ps)
{
# if defined _WIN32 && !defined __CYGWIN__
/* Native Windows. */
-# ifdef __MINGW32__
- /* On mingw, 'mbstate_t' is defined as 'int'. */
- return ps == NULL || *ps == 0;
-# else
- /* MSVC defines 'mbstate_t' as an 8-byte struct; the first 4-bytes matter.
*/
+ /* MSVC defines 'mbstate_t' as an 8-byte struct; the first 4 bytes matter.
+ On mingw, 'mbstate_t' is sometimes defined as 'int', sometimes defined as
+ an 8-byte struct, of which the first 4 bytes matter. */
return ps == NULL || *(const unsigned int *)ps == 0;
-# endif
# else
/* Minix, HP-UX 11.00, Solaris 2.6, Interix, ... */
/* Maybe this definition works, maybe not... */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- mbsinit: fix compilation error in mingw-w64 7.0 with _UCRT defined,
Bruno Haible <=