Unverified Commit 4e92d40f authored by boklm's avatar boklm
Browse files

Merge remote-tracking branch 'gk/bug_31596'

parents f08dbd57 3ea80a42
From d9c7a5aa3ac8d29b98f28af71d862c2d3931e7d8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Sun, 1 Sep 2019 06:05:40 +0000
Subject: [PATCH 1/2] This function was moved from inline in header to a
statically linked one in 52a34d52d6f5f1789d329abd4e, where the use of this
define was dropped.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
As this function is statically linked, the caller can't control
and change the behaviour of the function by defining
UCRTBASE_PRINTF_DEFAULT_WIDE in the calling translation unit,
but we should at least use the headers' default value (which currently
is zero).
Signed-off-by: Martin Storsjö <martin@martin.st>
diff --git a/mingw-w64-crt/stdio/ucrt__vsnwprintf.c b/mingw-w64-crt/stdio/ucrt__vsnwprintf.c
index bf9f4de2..c505c31e 100644
--- a/mingw-w64-crt/stdio/ucrt__vsnwprintf.c
+++ b/mingw-w64-crt/stdio/ucrt__vsnwprintf.c
@@ -10,6 +10,6 @@
int __cdecl _vsnwprintf(wchar_t * __restrict__ _Dest,size_t _Count,const wchar_t * __restrict__ _Format,va_list _Args) __MINGW_ATTRIB_DEPRECATED_SEC_WARN
{
- return __stdio_common_vswprintf(UCRTBASE_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION, _Dest, _Count, _Format, NULL, _Args);
+ return __stdio_common_vswprintf(UCRTBASE_PRINTF_DEFAULT_WIDE | UCRTBASE_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION, _Dest, _Count, _Format, NULL, _Args);
}
int __cdecl (*__MINGW_IMP_SYMBOL(_vsnwprintf))(wchar_t *__restrict__, size_t, const wchar_t *__restrict__, va_list) = _vsnwprintf;
--
2.23.0.rc1
From 44d0691f6fa51d2b3a0df911652c801635424e4e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Sun, 1 Sep 2019 06:08:24 +0000
Subject: [PATCH 2/2] When __USE_MINGW_ANSI_STDIO is defined, we still call the
custom implementation bundled in libmingwex, which has the C99 standard
semantics for %s in wide format strings.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This matches how the wide stdio functions behave both when using
msvcrt.dll, and in all versions of MSVC, even the modern ones that
use ucrt.
Signed-off-by: Martin Storsjö <martin@martin.st>
diff --git a/mingw-w64-headers/crt/conio.h b/mingw-w64-headers/crt/conio.h
index 363203c3..a92ee059 100644
--- a/mingw-w64-headers/crt/conio.h
+++ b/mingw-w64-headers/crt/conio.h
@@ -21,12 +21,13 @@
#define UCRTBASE_SCANF_LEGACY_WIDE_SPECIFIERS (0x0002)
#define UCRTBASE_SCANF_LEGACY_MSVCRT_COMPATIBILITY (0x0004)
-// Default wide printfs and scanfs to the standard mode
+// Default wide printfs and scanfs to the legacy wide mode. Only code built
+// with -D__USE_MINGW_ANSI_STDIO=1 will expect the standard behaviour.
#ifndef UCRTBASE_PRINTF_DEFAULT_WIDE
-#define UCRTBASE_PRINTF_DEFAULT_WIDE 0
+#define UCRTBASE_PRINTF_DEFAULT_WIDE UCRTBASE_PRINTF_LEGACY_WIDE_SPECIFIERS
#endif
#ifndef UCRTBASE_SCANF_DEFAULT_WIDE
-#define UCRTBASE_SCANF_DEFAULT_WIDE 0
+#define UCRTBASE_SCANF_DEFAULT_WIDE UCRTBASE_SCANF_LEGACY_WIDE_SPECIFIERS
#endif
#endif
diff --git a/mingw-w64-headers/crt/stdio.h b/mingw-w64-headers/crt/stdio.h
index e183236d..e8d3c857 100644
--- a/mingw-w64-headers/crt/stdio.h
+++ b/mingw-w64-headers/crt/stdio.h
@@ -147,12 +147,13 @@ extern FILE (* __MINGW_IMP_SYMBOL(_iob))[]; /* A pointer to an array of FILE */
#define UCRTBASE_SCANF_LEGACY_WIDE_SPECIFIERS (0x0002)
#define UCRTBASE_SCANF_LEGACY_MSVCRT_COMPATIBILITY (0x0004)
-// Default wide printfs and scanfs to the standard mode
+// Default wide printfs and scanfs to the legacy wide mode. Only code built
+// with -D__USE_MINGW_ANSI_STDIO=1 will expect the standard behaviour.
#ifndef UCRTBASE_PRINTF_DEFAULT_WIDE
-#define UCRTBASE_PRINTF_DEFAULT_WIDE 0
+#define UCRTBASE_PRINTF_DEFAULT_WIDE UCRTBASE_PRINTF_LEGACY_WIDE_SPECIFIERS
#endif
#ifndef UCRTBASE_SCANF_DEFAULT_WIDE
-#define UCRTBASE_SCANF_DEFAULT_WIDE 0
+#define UCRTBASE_SCANF_DEFAULT_WIDE UCRTBASE_SCANF_LEGACY_WIDE_SPECIFIERS
#endif
#endif
diff --git a/mingw-w64-headers/crt/wchar.h b/mingw-w64-headers/crt/wchar.h
index cd26e098..d1348bc2 100644
--- a/mingw-w64-headers/crt/wchar.h
+++ b/mingw-w64-headers/crt/wchar.h
@@ -247,12 +247,13 @@ extern FILE (* __MINGW_IMP_SYMBOL(_iob))[]; /* A pointer to an array of FILE */
#define UCRTBASE_SCANF_LEGACY_WIDE_SPECIFIERS (0x0002)
#define UCRTBASE_SCANF_LEGACY_MSVCRT_COMPATIBILITY (0x0004)
-// Default wide printfs and scanfs to the standard mode
+// Default wide printfs and scanfs to the legacy wide mode. Only code built
+// with -D__USE_MINGW_ANSI_STDIO=1 will expect the standard behaviour.
#ifndef UCRTBASE_PRINTF_DEFAULT_WIDE
-#define UCRTBASE_PRINTF_DEFAULT_WIDE 0
+#define UCRTBASE_PRINTF_DEFAULT_WIDE UCRTBASE_PRINTF_LEGACY_WIDE_SPECIFIERS
#endif
#ifndef UCRTBASE_SCANF_DEFAULT_WIDE
-#define UCRTBASE_SCANF_DEFAULT_WIDE 0
+#define UCRTBASE_SCANF_DEFAULT_WIDE UCRTBASE_SCANF_LEGACY_WIDE_SPECIFIERS
#endif
#endif
--
2.23.0.rc1
......@@ -67,8 +67,7 @@ default_win32_winnt=0x601
cd $builddir/mingw-w64-clang
patch -p1 < $rootdir/mingw-winrt.patch
patch -p1 < $rootdir/31567_1.patch
patch -p1 < $rootdir/31567_2.patch
cd mingw-w64-headers
mkdir build && cd build
../configure --host=[% c("arch") %]-w64-mingw32 \
......
# vim: filetype=yaml sw=2
filename: '[% project %]-[% c("version") %]-[% c("var/build_id") %].tar.gz'
git_url: https://git.code.sf.net/p/mingw-w64/mingw-w64
git_hash: 2d52c4b3433e55b1c454f9567c0ae9adc4b83b41
git_hash: 330025c54b85512d54b6960fad07498365c8fee3
version: '[% c("abbrev") %]'
llvm_version: 8.0.0
gpg_keyring: clang.gpg
......@@ -36,5 +36,3 @@ input_files:
- project: llvm-mingw
name: llvm-mingw
- filename: mingw-winrt.patch
- filename: 31567_1.patch
- filename: 31567_2.patch
# vim: filetype=yaml sw=2
filename: '[% project %]-[% c("version") %]-[% c("var/build_id") %].tar.gz'
git_url: https://git.code.sf.net/p/mingw-w64/mingw-w64
git_hash: 2d52c4b3433e55b1c454f9567c0ae9adc4b83b41
git_hash: 330025c54b85512d54b6960fad07498365c8fee3
version: '[% c("abbrev") %]'
var:
container:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment