All non-UCRT crt library versions provide wcstok symbol which is not C95+
compatible. Its function prototype is missing the third argument. In UCRT
version this function without third argument is named _wcstok(). So rename
wcstok symbol to _wcstok in all non-UCRT import libraries for compatibility
with UCRT.

msvcr80+ provides wcstok_s symbol which is C95+ compatible wcstok()
function. msvcr80+ wcstok_s() function has same function prototype as C95+
wcstok() and the only difference between MS wcstok_s and C95 wcstok is that
MS wcstok_s validates parameters and sets errno. C95 version has undefined
behavior when called with invalid parameters (e.g. Linux version crashes).

So add appropriate aliases of wcstok_s in msvcr80+ import libraries to have
C95+ compatible wcstok() function under the correct C95 name wcstok.

For pre-msvcr80 import libraries, provide mingw-w64 implementation of
wcstok_s() and C95+ wcstok() functions. So when linking with any crt
library, the wcstok symbol resolve to the correct C95 compatible wcstok()
function. mingw-w64 implementation of wcstok is copied from musl libc which
is very compact and some parts from musl libc are already used in mingw-w64.

Update header files to reflect these changes. With this change, C95+
compatible wcstok() function is available for all builds, not only UCRT as
it was before this change.

For compatibility with C99, add missing restrict keyword for last wcstok()
argument in header files.

mingw-w64 is currently missing MS _wcstok() function for UCRT builds.
So provide it into UCRT import libraries.

Visual Studio 2015+ redefines wcstok() to _wcstok() when macro
_CRT_NON_CONFORMING_WCSTOK is defined. And in C++ mode it provides
overloaded C++ function wcstok() with two arguments unless the macro
_CRT_NO_INLINE_DEPRECATED_WCSTOK is defined. It is documented on:
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/strtok-strtok-l-wcstok-wcstok-l-mbstok-mbstok-l

Implement same logic for _CRT_NON_CONFORMING_WCSTOK to get the old behavior
by default. And provides C++ inline two-argument function unless define
_CRT_NO_INLINE_DEPRECATED_WCSTOK is set.

With this change mingw-w64 always provides C95+ compatible wcstok()
function and MS two-arg _wcstok() function in all CRT import libraries.
Also every CRT import library provides MS wcstok_s() function.
---
 mingw-w64-crt/Makefile.am                    | 27 ++++++++-----
 mingw-w64-crt/def-include/crt-aliases.def.in |  5 +++
 mingw-w64-crt/lib-common/msvcr120_app.def.in |  3 +-
 mingw-w64-crt/lib-common/msvcrt.def.in       |  7 +++-
 mingw-w64-crt/lib32/crtdll.def.in            |  2 +-
 mingw-w64-crt/lib32/msvcr100.def.in          |  3 +-
 mingw-w64-crt/lib32/msvcr100d.def.in         |  3 +-
 mingw-w64-crt/lib32/msvcr110.def.in          |  3 +-
 mingw-w64-crt/lib32/msvcr110d.def.in         |  3 +-
 mingw-w64-crt/lib32/msvcr120.def.in          |  3 +-
 mingw-w64-crt/lib32/msvcr120d.def.in         |  3 +-
 mingw-w64-crt/lib32/msvcr40d.def.in          |  2 +-
 mingw-w64-crt/lib32/msvcr70.def.in           |  2 +-
 mingw-w64-crt/lib32/msvcr70d.def.in          |  2 +-
 mingw-w64-crt/lib32/msvcr71.def.in           |  2 +-
 mingw-w64-crt/lib32/msvcr71d.def.in          |  2 +-
 mingw-w64-crt/lib32/msvcr80.def.in           |  3 +-
 mingw-w64-crt/lib32/msvcr80d.def.in          |  3 +-
 mingw-w64-crt/lib32/msvcr90.def.in           |  3 +-
 mingw-w64-crt/lib32/msvcr90d.def.in          |  3 +-
 mingw-w64-crt/lib32/msvcrt10.def.in          |  2 +-
 mingw-w64-crt/lib32/msvcrt20.def.in          |  2 +-
 mingw-w64-crt/lib32/msvcrt40.def.in          |  2 +-
 mingw-w64-crt/lib32/msvcrtd.def.in           |  2 +-
 mingw-w64-crt/lib64/msvcr100.def.in          |  3 +-
 mingw-w64-crt/lib64/msvcr100d.def.in         |  3 +-
 mingw-w64-crt/lib64/msvcr110.def.in          |  3 +-
 mingw-w64-crt/lib64/msvcr110d.def.in         |  3 +-
 mingw-w64-crt/lib64/msvcr120.def.in          |  3 +-
 mingw-w64-crt/lib64/msvcr120d.def.in         |  3 +-
 mingw-w64-crt/lib64/msvcr80.def.in           |  3 +-
 mingw-w64-crt/lib64/msvcr80d.def.in          |  3 +-
 mingw-w64-crt/lib64/msvcr90.def.in           |  3 +-
 mingw-w64-crt/lib64/msvcr90d.def.in          |  3 +-
 mingw-w64-crt/libarm32/msvcr110.def.in       |  3 +-
 mingw-w64-crt/libarm32/msvcr110d.def.in      |  3 +-
 mingw-w64-crt/libarm32/msvcr120.def.in       |  3 +-
 mingw-w64-crt/libarm32/msvcr120d.def.in      |  3 +-
 mingw-w64-crt/string/ucrt__wcstok.c          | 14 +++++++
 mingw-w64-crt/string/wcstok.c                | 41 ++++++++++++++++++++
 mingw-w64-headers/crt/string.h               | 11 ++++--
 mingw-w64-headers/crt/wchar.h                | 11 ++++--
 42 files changed, 157 insertions(+), 54 deletions(-)
 create mode 100644 mingw-w64-crt/string/ucrt__wcstok.c
 create mode 100644 mingw-w64-crt/string/wcstok.c

diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index 7db657ed7991..2ad143f29963 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -391,7 +391,8 @@ src_ucrtbase=\
   stdio/ucrt_vscanf.c \
   stdio/ucrt_vsnprintf.c \
   stdio/ucrt_vsprintf.c \
-  stdio/ucrt_vsscanf.c
+  stdio/ucrt_vsscanf.c \
+  string/ucrt__wcstok.c
 
 # Files included in libucrtapp.a
 src_ucrtapp=\
@@ -482,7 +483,8 @@ src_msvcrt32=\
   misc/wctob.c \
   stdio/_fstat64i32.c \
   stdio/_scprintf.c \
-  stdio/_vscprintf.c
+  stdio/_vscprintf.c \
+  string/wcstok.c
 
 # Files included in libmsvcrt-os.a (for msvcrt.dll) on x86_64
 src_msvcrt64=\
@@ -527,7 +529,8 @@ src_msvcrt64=\
   misc/wassert.c \
   misc/wcrtomb.c \
   misc/wcsnlen.c \
-  misc/wctob.c
+  misc/wctob.c \
+  string/wcstok.c
 
 # Files included in libmsvcrt-os.a (for msvcrt.dll) on arm32
 src_msvcrtarm32=\
@@ -745,7 +748,8 @@ src_crtdll=\
   stdio/fseeki64.c \
   stdio/iob_func.c \
   stdio/mingw_dummy__lock.c \
-  stdio/mingw_lock.c
+  stdio/mingw_lock.c \
+  string/wcstok.c
 
 src_msvcrt10=\
   misc/crtdll__getmainargs.c \
@@ -811,7 +815,8 @@ src_msvcrt10=\
   stdio/fseeki64.c \
   stdio/iob_func.c \
   stdio/mingw_dummy__lock.c \
-  stdio/mingw_lock.c
+  stdio/mingw_lock.c \
+  string/wcstok.c
 
 src_msvcrt20=\
   misc/msvcrt20__getmainargs.c \
@@ -857,7 +862,8 @@ src_msvcrt20=\
   stdio/fsetpos.c \
   stdio/fseeki64.c \
   stdio/mingw_dummy__lock.c \
-  stdio/mingw_lock.c
+  stdio/mingw_lock.c \
+  string/wcstok.c
 
 src_msvcrt40=\
   misc/___mb_cur_max_func.c \
@@ -896,7 +902,8 @@ src_msvcrt40=\
   stdio/atoll.c \
   stdio/fseeki64.c \
   stdio/mingw_dummy__lock.c \
-  stdio/mingw_lock.c
+  stdio/mingw_lock.c \
+  string/wcstok.c
 
 src_msvcr70=\
   misc/__p__osplatform.c \
@@ -922,7 +929,8 @@ src_msvcr70=\
   misc/wctype.c \
   stdio/_fstat64i32.c \
   stdio/fseeki64.c \
-  stdio/mingw_lock.c
+  stdio/mingw_lock.c \
+  string/wcstok.c
 
 src_msvcr71=\
   misc/__p__osplatform.c \
@@ -948,7 +956,8 @@ src_msvcr71=\
   misc/wctype.c \
   stdio/_fstat64i32.c \
   stdio/fseeki64.c \
-  stdio/mingw_lock.c
+  stdio/mingw_lock.c \
+  string/wcstok.c
 
 src_msvcr80=\
   misc/imaxdiv.c \
diff --git a/mingw-w64-crt/def-include/crt-aliases.def.in 
b/mingw-w64-crt/def-include/crt-aliases.def.in
index 4cb8e7042f68..e9bfa8630c45 100644
--- a/mingw-w64-crt/def-include/crt-aliases.def.in
+++ b/mingw-w64-crt/def-include/crt-aliases.def.in
@@ -230,6 +230,11 @@ ADD_UNDERSCORE(y0)
 ADD_UNDERSCORE(y1)
 ADD_UNDERSCORE(yn)
 
+; This is list of symbol aliases for C95 functions
+#ifdef USE_WCSTOK_S_FOR_WCSTOK
+wcstok == wcstok_s
+#endif
+
 ; This is list of symbol aliases for C99 functions
 ; ADD_UNDERSCORE(logb)
 #ifdef WITH_NEXTAFTER_ALIAS
diff --git a/mingw-w64-crt/lib-common/msvcr120_app.def.in 
b/mingw-w64-crt/lib-common/msvcr120_app.def.in
index 4508a43f3370..eadcda310ad8 100644
--- a/mingw-w64-crt/lib-common/msvcr120_app.def.in
+++ b/mingw-w64-crt/lib-common/msvcr120_app.def.in
@@ -2310,7 +2310,7 @@ wcsstr
 wcstod
 wcstof
 wcstoimax
-wcstok
+_wcstok == wcstok ; rename wcstok to _wcstok for compatibility with UCRT, real 
C95+ compatible wcstok provided by wcstok_s alias
 wcstok_s
 wcstol
 F_ARM32(wcstold) ; Can't use long double functions from the CRT on x86
@@ -2334,4 +2334,5 @@ wscanf
 wscanf_s
 
 #define CRTAPP
+#define USE_WCSTOK_S_FOR_WCSTOK
 #include "crt-aliases.def.in"
diff --git a/mingw-w64-crt/lib-common/msvcrt.def.in 
b/mingw-w64-crt/lib-common/msvcrt.def.in
index 6359a7953516..c87a3bdcca33 100644
--- a/mingw-w64-crt/lib-common/msvcrt.def.in
+++ b/mingw-w64-crt/lib-common/msvcrt.def.in
@@ -1117,7 +1117,7 @@ wcsrchr
 wcsspn
 wcsstr
 wcstod
-wcstok
+_wcstok == wcstok ; rename wcstok to _wcstok for compatibility with UCRT, real 
C95+ compatible wcstok provided by mingw-w64 or by wcstok_s alias
 wcstol
 wcstombs
 wcstoul
@@ -1845,7 +1845,7 @@ wcsncpy_s
 F_ARM_ANY(wcsnlen) ; i386 and x64 wcsnlen replaced by emu
 F_ARM_ANY(wcsrtombs) ; i386 and x64 wcsrtombs replaced by emu
 wcsrtombs_s
-wcstok_s
+F_ARM_ANY(wcstok_s) ; i386 and x64 wcstok_s replaced by emu
 wcstombs_s
 F_ARM_ANY(wctob) ; i386 and x64 wctob replaced by emu
 wctomb_s
@@ -1923,6 +1923,9 @@ F_I386(_libm_sse2_tan_precise)
 ; i386 strtoll, strtoull, strtoimax, strtoumax, wcstoll, wcstoull, wcstoimax 
and wcstoumax aliases provided by emu
 #define WITH_STRTO64_ALIAS
 #endif
+#if defined(DEF_ARM32) || defined(DEF_ARM64)
+#define USE_WCSTOK_S_FOR_WCSTOK
+#endif
 #include "crt-aliases.def.in"
 
 ; This is list of additional symbol aliases not available in any CRT library
diff --git a/mingw-w64-crt/lib32/crtdll.def.in 
b/mingw-w64-crt/lib32/crtdll.def.in
index 0956c86709f7..65b70362bd02 100644
--- a/mingw-w64-crt/lib32/crtdll.def.in
+++ b/mingw-w64-crt/lib32/crtdll.def.in
@@ -607,7 +607,7 @@ wcsrchr
 wcsspn
 wcsstr
 wcstod
-wcstok
+_wcstok == wcstok ; rename wcstok to _wcstok for compatibility with UCRT, real 
C95+ compatible wcstok provided by mingw-w64
 wcstol
 wcstombs
 wcstoul
diff --git a/mingw-w64-crt/lib32/msvcr100.def.in 
b/mingw-w64-crt/lib32/msvcr100.def.in
index 03929c7195db..b1cbaac3c2e2 100644
--- a/mingw-w64-crt/lib32/msvcr100.def.in
+++ b/mingw-w64-crt/lib32/msvcr100.def.in
@@ -1885,7 +1885,7 @@ wcsrtombs_s
 wcsspn
 wcsstr
 wcstod
-wcstok
+_wcstok == wcstok ; rename wcstok to _wcstok for compatibility with UCRT, real 
C95+ compatible wcstok provided by wcstok_s alias
 wcstok_s
 wcstol
 wcstombs
@@ -1909,4 +1909,5 @@ wscanf_s
 #define WITH_IMAXDIV_ALIAS
 #define WITH_STRTO64_ALIAS
 #define WITH_STRTO64_L_ALIAS
+#define USE_WCSTOK_S_FOR_WCSTOK
 #include "crt-aliases.def.in"
diff --git a/mingw-w64-crt/lib32/msvcr100d.def.in 
b/mingw-w64-crt/lib32/msvcr100d.def.in
index 30a730754426..59ff020d4556 100644
--- a/mingw-w64-crt/lib32/msvcr100d.def.in
+++ b/mingw-w64-crt/lib32/msvcr100d.def.in
@@ -1948,7 +1948,7 @@ wcsrtombs_s
 wcsspn
 wcsstr
 wcstod
-wcstok
+_wcstok == wcstok ; rename wcstok to _wcstok for compatibility with UCRT, real 
C95+ compatible wcstok provided by wcstok_s alias
 wcstok_s
 wcstol
 wcstombs
@@ -1972,4 +1972,5 @@ wscanf_s
 #define WITH_IMAXDIV_ALIAS
 #define WITH_STRTO64_ALIAS
 #define WITH_STRTO64_L_ALIAS
+#define USE_WCSTOK_S_FOR_WCSTOK
 #include "crt-aliases.def.in"
diff --git a/mingw-w64-crt/lib32/msvcr110.def.in 
b/mingw-w64-crt/lib32/msvcr110.def.in
index 089a865ea43c..b4889fa79de5 100644
--- a/mingw-w64-crt/lib32/msvcr110.def.in
+++ b/mingw-w64-crt/lib32/msvcr110.def.in
@@ -2014,7 +2014,7 @@ wcsrtombs_s
 wcsspn
 wcsstr
 wcstod
-wcstok
+_wcstok == wcstok ; rename wcstok to _wcstok for compatibility with UCRT, real 
C95+ compatible wcstok provided by wcstok_s alias
 wcstok_s
 wcstol
 wcstombs
@@ -2057,4 +2057,5 @@ __crtSetThreadStackGuarantee
 #define WITH_IMAXDIV_ALIAS
 #define WITH_STRTO64_ALIAS
 #define WITH_STRTO64_L_ALIAS
+#define USE_WCSTOK_S_FOR_WCSTOK
 #include "crt-aliases.def.in"
diff --git a/mingw-w64-crt/lib32/msvcr110d.def.in 
b/mingw-w64-crt/lib32/msvcr110d.def.in
index c68ee7b8439c..aa01d0b2b021 100644
--- a/mingw-w64-crt/lib32/msvcr110d.def.in
+++ b/mingw-w64-crt/lib32/msvcr110d.def.in
@@ -2081,7 +2081,7 @@ wcsrtombs_s
 wcsspn
 wcsstr
 wcstod
-wcstok
+_wcstok == wcstok ; rename wcstok to _wcstok for compatibility with UCRT, real 
C95+ compatible wcstok provided by wcstok_s alias
 wcstok_s
 wcstol
 wcstombs
@@ -2124,4 +2124,5 @@ __crtSetThreadStackGuarantee
 #define WITH_IMAXDIV_ALIAS
 #define WITH_STRTO64_ALIAS
 #define WITH_STRTO64_L_ALIAS
+#define USE_WCSTOK_S_FOR_WCSTOK
 #include "crt-aliases.def.in"
diff --git a/mingw-w64-crt/lib32/msvcr120.def.in 
b/mingw-w64-crt/lib32/msvcr120.def.in
index 25a271b510d3..f390148889d5 100644
--- a/mingw-w64-crt/lib32/msvcr120.def.in
+++ b/mingw-w64-crt/lib32/msvcr120.def.in
@@ -2275,7 +2275,7 @@ wcsstr
 wcstod
 wcstof
 wcstoimax
-wcstok
+_wcstok == wcstok ; rename wcstok to _wcstok for compatibility with UCRT, real 
C95+ compatible wcstok provided by wcstok_s alias
 wcstok_s
 wcstol
 ; wcstold ; Can't use long double functions from the CRT on x86
@@ -2298,4 +2298,5 @@ wprintf_s
 wscanf
 wscanf_s
 
+#define USE_WCSTOK_S_FOR_WCSTOK
 #include "crt-aliases.def.in"
diff --git a/mingw-w64-crt/lib32/msvcr120d.def.in 
b/mingw-w64-crt/lib32/msvcr120d.def.in
index e1bb5f459e23..78ffafba026a 100644
--- a/mingw-w64-crt/lib32/msvcr120d.def.in
+++ b/mingw-w64-crt/lib32/msvcr120d.def.in
@@ -2342,7 +2342,7 @@ wcsstr
 wcstod
 wcstof
 wcstoimax
-wcstok
+_wcstok == wcstok ; rename wcstok to _wcstok for compatibility with UCRT, real 
C95+ compatible wcstok provided by wcstok_s alias
 wcstok_s
 wcstol
 ; wcstold ; Can't use long double functions from the CRT on x86
@@ -2365,4 +2365,5 @@ wprintf_s
 wscanf
 wscanf_s
 
+#define USE_WCSTOK_S_FOR_WCSTOK
 #include "crt-aliases.def.in"
diff --git a/mingw-w64-crt/lib32/msvcr40d.def.in 
b/mingw-w64-crt/lib32/msvcr40d.def.in
index 544816d7047f..fc3537f75668 100644
--- a/mingw-w64-crt/lib32/msvcr40d.def.in
+++ b/mingw-w64-crt/lib32/msvcr40d.def.in
@@ -1641,7 +1641,7 @@ wcsrchr
 wcsspn
 wcsstr
 wcstod
-wcstok
+_wcstok == wcstok ; rename wcstok to _wcstok for compatibility with UCRT, real 
C95+ compatible wcstok provided by mingw-w64
 wcstol
 wcstombs
 wcstoul
diff --git a/mingw-w64-crt/lib32/msvcr70.def.in 
b/mingw-w64-crt/lib32/msvcr70.def.in
index 689f8f7a37c6..1d89fb91e31a 100644
--- a/mingw-w64-crt/lib32/msvcr70.def.in
+++ b/mingw-w64-crt/lib32/msvcr70.def.in
@@ -891,7 +891,7 @@ wcsrchr
 wcsspn
 wcsstr
 wcstod
-wcstok
+_wcstok == wcstok ; rename wcstok to _wcstok for compatibility with UCRT, real 
C95+ compatible wcstok provided by mingw-w64
 wcstol
 wcstombs
 wcstoul
diff --git a/mingw-w64-crt/lib32/msvcr70d.def.in 
b/mingw-w64-crt/lib32/msvcr70d.def.in
index 910b883212e2..40b4b2399908 100644
--- a/mingw-w64-crt/lib32/msvcr70d.def.in
+++ b/mingw-w64-crt/lib32/msvcr70d.def.in
@@ -935,7 +935,7 @@ wcsrchr
 wcsspn
 wcsstr
 wcstod
-wcstok
+_wcstok == wcstok ; rename wcstok to _wcstok for compatibility with UCRT, real 
C95+ compatible wcstok provided by mingw-w64
 wcstol
 wcstombs
 wcstoul
diff --git a/mingw-w64-crt/lib32/msvcr71.def.in 
b/mingw-w64-crt/lib32/msvcr71.def.in
index 7904cf8f90f8..ab1b75e281dc 100644
--- a/mingw-w64-crt/lib32/msvcr71.def.in
+++ b/mingw-w64-crt/lib32/msvcr71.def.in
@@ -885,7 +885,7 @@ wcsrchr
 wcsspn
 wcsstr
 wcstod
-wcstok
+_wcstok == wcstok ; rename wcstok to _wcstok for compatibility with UCRT, real 
C95+ compatible wcstok provided by mingw-w64
 wcstol
 wcstombs
 wcstoul
diff --git a/mingw-w64-crt/lib32/msvcr71d.def.in 
b/mingw-w64-crt/lib32/msvcr71d.def.in
index d6bf80eefaf6..bacc8827be37 100644
--- a/mingw-w64-crt/lib32/msvcr71d.def.in
+++ b/mingw-w64-crt/lib32/msvcr71d.def.in
@@ -929,7 +929,7 @@ wcsrchr
 wcsspn
 wcsstr
 wcstod
-wcstok
+_wcstok == wcstok ; rename wcstok to _wcstok for compatibility with UCRT, real 
C95+ compatible wcstok provided by mingw-w64
 wcstol
 wcstombs
 wcstoul
diff --git a/mingw-w64-crt/lib32/msvcr80.def.in 
b/mingw-w64-crt/lib32/msvcr80.def.in
index a9a83d3d18fe..722b901912bc 100644
--- a/mingw-w64-crt/lib32/msvcr80.def.in
+++ b/mingw-w64-crt/lib32/msvcr80.def.in
@@ -1519,7 +1519,7 @@ wcsrtombs_s
 wcsspn
 wcsstr
 wcstod
-wcstok
+_wcstok == wcstok ; rename wcstok to _wcstok for compatibility with UCRT, real 
C95+ compatible wcstok provided by wcstok_s alias
 wcstok_s
 wcstol
 wcstombs
@@ -1554,4 +1554,5 @@ fread_s
 #define WITH_LLABS_ALIAS
 #define WITH_STRTO64_ALIAS
 #define WITH_STRTO64_L_ALIAS
+#define USE_WCSTOK_S_FOR_WCSTOK
 #include "crt-aliases.def.in"
diff --git a/mingw-w64-crt/lib32/msvcr80d.def.in 
b/mingw-w64-crt/lib32/msvcr80d.def.in
index 96e77b274711..b1ea5754f99b 100644
--- a/mingw-w64-crt/lib32/msvcr80d.def.in
+++ b/mingw-w64-crt/lib32/msvcr80d.def.in
@@ -1602,7 +1602,7 @@ wcsrtombs_s
 wcsspn
 wcsstr
 wcstod
-wcstok
+_wcstok == wcstok ; rename wcstok to _wcstok for compatibility with UCRT, real 
C95+ compatible wcstok provided by wcstok_s alias
 wcstok_s
 wcstol
 wcstombs
@@ -1632,4 +1632,5 @@ fread_s
 #define WITH_LLABS_ALIAS
 #define WITH_STRTO64_ALIAS
 #define WITH_STRTO64_L_ALIAS
+#define USE_WCSTOK_S_FOR_WCSTOK
 #include "crt-aliases.def.in"
diff --git a/mingw-w64-crt/lib32/msvcr90.def.in 
b/mingw-w64-crt/lib32/msvcr90.def.in
index 01f7cfa6f14c..9ecc3fa8e221 100644
--- a/mingw-w64-crt/lib32/msvcr90.def.in
+++ b/mingw-w64-crt/lib32/msvcr90.def.in
@@ -1517,7 +1517,7 @@ wcsrtombs_s
 wcsspn
 wcsstr
 wcstod
-wcstok
+_wcstok == wcstok ; rename wcstok to _wcstok for compatibility with UCRT, real 
C95+ compatible wcstok provided by wcstok_s alias
 wcstok_s
 wcstol
 wcstombs
@@ -1539,4 +1539,5 @@ wscanf_s
 #define WITH_LLABS_ALIAS
 #define WITH_STRTO64_ALIAS
 #define WITH_STRTO64_L_ALIAS
+#define USE_WCSTOK_S_FOR_WCSTOK
 #include "crt-aliases.def.in"
diff --git a/mingw-w64-crt/lib32/msvcr90d.def.in 
b/mingw-w64-crt/lib32/msvcr90d.def.in
index c3f4767fae77..451921fd1479 100644
--- a/mingw-w64-crt/lib32/msvcr90d.def.in
+++ b/mingw-w64-crt/lib32/msvcr90d.def.in
@@ -1589,7 +1589,7 @@ wcsrtombs_s
 wcsspn
 wcsstr
 wcstod
-wcstok
+_wcstok == wcstok ; rename wcstok to _wcstok for compatibility with UCRT, real 
C95+ compatible wcstok provided by wcstok_s alias
 wcstok_s
 wcstol
 wcstombs
@@ -1611,4 +1611,5 @@ wscanf_s
 #define WITH_LLABS_ALIAS
 #define WITH_STRTO64_ALIAS
 #define WITH_STRTO64_L_ALIAS
+#define USE_WCSTOK_S_FOR_WCSTOK
 #include "crt-aliases.def.in"
diff --git a/mingw-w64-crt/lib32/msvcrt10.def.in 
b/mingw-w64-crt/lib32/msvcrt10.def.in
index d353493c9437..74ab872cbb0b 100644
--- a/mingw-w64-crt/lib32/msvcrt10.def.in
+++ b/mingw-w64-crt/lib32/msvcrt10.def.in
@@ -1285,7 +1285,7 @@ wcsrchr
 wcsspn
 wcsstr
 wcstod
-wcstok
+_wcstok == wcstok ; rename wcstok to _wcstok for compatibility with UCRT, real 
C95+ compatible wcstok provided by mingw-w64
 wcstol
 wcstombs
 wcstoul
diff --git a/mingw-w64-crt/lib32/msvcrt20.def.in 
b/mingw-w64-crt/lib32/msvcrt20.def.in
index 9c1bafb21a5d..df06a313cd88 100644
--- a/mingw-w64-crt/lib32/msvcrt20.def.in
+++ b/mingw-w64-crt/lib32/msvcrt20.def.in
@@ -1509,7 +1509,7 @@ wcsrchr
 wcsspn
 wcsstr
 wcstod
-wcstok
+_wcstok == wcstok ; rename wcstok to _wcstok for compatibility with UCRT, real 
C95+ compatible wcstok provided by mingw-w64
 wcstol
 wcstombs
 wcstoul
diff --git a/mingw-w64-crt/lib32/msvcrt40.def.in 
b/mingw-w64-crt/lib32/msvcrt40.def.in
index 3122f0e1e0f7..476e4edc673c 100644
--- a/mingw-w64-crt/lib32/msvcrt40.def.in
+++ b/mingw-w64-crt/lib32/msvcrt40.def.in
@@ -1609,7 +1609,7 @@ wcsrchr
 wcsspn
 wcsstr
 wcstod
-wcstok
+_wcstok == wcstok ; rename wcstok to _wcstok for compatibility with UCRT, real 
C95+ compatible wcstok provided by mingw-w64
 wcstol
 wcstombs
 wcstoul
diff --git a/mingw-w64-crt/lib32/msvcrtd.def.in 
b/mingw-w64-crt/lib32/msvcrtd.def.in
index 04426ad23572..2cfd2fc9af41 100644
--- a/mingw-w64-crt/lib32/msvcrtd.def.in
+++ b/mingw-w64-crt/lib32/msvcrtd.def.in
@@ -835,7 +835,7 @@ wcsrchr
 wcsspn
 wcsstr
 wcstod
-wcstok
+_wcstok == wcstok ; rename wcstok to _wcstok for compatibility with UCRT, real 
C95+ compatible wcstok provided by mingw-w64
 wcstol
 wcstombs
 wcstoul
diff --git a/mingw-w64-crt/lib64/msvcr100.def.in 
b/mingw-w64-crt/lib64/msvcr100.def.in
index f1f680fdcf6f..1f490cbec309 100644
--- a/mingw-w64-crt/lib64/msvcr100.def.in
+++ b/mingw-w64-crt/lib64/msvcr100.def.in
@@ -1847,7 +1847,7 @@ wcsrtombs_s
 wcsspn
 wcsstr
 wcstod
-wcstok
+_wcstok == wcstok ; rename wcstok to _wcstok for compatibility with UCRT, real 
C95+ compatible wcstok provided by wcstok_s alias
 wcstok_s
 wcstol
 wcstombs
@@ -1871,4 +1871,5 @@ wscanf_s
 #define WITH_IMAXDIV_ALIAS
 #define WITH_STRTO64_ALIAS
 #define WITH_STRTO64_L_ALIAS
+#define USE_WCSTOK_S_FOR_WCSTOK
 #include "crt-aliases.def.in"
diff --git a/mingw-w64-crt/lib64/msvcr100d.def.in 
b/mingw-w64-crt/lib64/msvcr100d.def.in
index d4d4040a4a55..d582d06b777e 100644
--- a/mingw-w64-crt/lib64/msvcr100d.def.in
+++ b/mingw-w64-crt/lib64/msvcr100d.def.in
@@ -1912,7 +1912,7 @@ wcsrtombs_s
 wcsspn
 wcsstr
 wcstod
-wcstok
+_wcstok == wcstok ; rename wcstok to _wcstok for compatibility with UCRT, real 
C95+ compatible wcstok provided by wcstok_s alias
 wcstok_s
 wcstol
 wcstombs
@@ -1936,4 +1936,5 @@ wscanf_s
 #define WITH_IMAXDIV_ALIAS
 #define WITH_STRTO64_ALIAS
 #define WITH_STRTO64_L_ALIAS
+#define USE_WCSTOK_S_FOR_WCSTOK
 #include "crt-aliases.def.in"
diff --git a/mingw-w64-crt/lib64/msvcr110.def.in 
b/mingw-w64-crt/lib64/msvcr110.def.in
index e7c3570b69f8..a3723a55e221 100644
--- a/mingw-w64-crt/lib64/msvcr110.def.in
+++ b/mingw-w64-crt/lib64/msvcr110.def.in
@@ -1971,7 +1971,7 @@ wcsrtombs_s
 wcsspn
 wcsstr
 wcstod
-wcstok
+_wcstok == wcstok ; rename wcstok to _wcstok for compatibility with UCRT, real 
C95+ compatible wcstok provided by wcstok_s alias
 wcstok_s
 wcstol
 wcstombs
@@ -2014,4 +2014,5 @@ __crtSetThreadStackGuarantee
 #define WITH_IMAXDIV_ALIAS
 #define WITH_STRTO64_ALIAS
 #define WITH_STRTO64_L_ALIAS
+#define USE_WCSTOK_S_FOR_WCSTOK
 #include "crt-aliases.def.in"
diff --git a/mingw-w64-crt/lib64/msvcr110d.def.in 
b/mingw-w64-crt/lib64/msvcr110d.def.in
index e401c9d39c3d..b9ab59a70b41 100644
--- a/mingw-w64-crt/lib64/msvcr110d.def.in
+++ b/mingw-w64-crt/lib64/msvcr110d.def.in
@@ -2036,7 +2036,7 @@ wcsrtombs_s
 wcsspn
 wcsstr
 wcstod
-wcstok
+_wcstok == wcstok ; rename wcstok to _wcstok for compatibility with UCRT, real 
C95+ compatible wcstok provided by wcstok_s alias
 wcstok_s
 wcstol
 wcstombs
@@ -2079,4 +2079,5 @@ __crtSetThreadStackGuarantee
 #define WITH_IMAXDIV_ALIAS
 #define WITH_STRTO64_ALIAS
 #define WITH_STRTO64_L_ALIAS
+#define USE_WCSTOK_S_FOR_WCSTOK
 #include "crt-aliases.def.in"
diff --git a/mingw-w64-crt/lib64/msvcr120.def.in 
b/mingw-w64-crt/lib64/msvcr120.def.in
index 0762aab04c09..9f3f623ea32d 100644
--- a/mingw-w64-crt/lib64/msvcr120.def.in
+++ b/mingw-w64-crt/lib64/msvcr120.def.in
@@ -2231,7 +2231,7 @@ wcsstr
 wcstod
 wcstof
 wcstoimax
-wcstok
+_wcstok == wcstok ; rename wcstok to _wcstok for compatibility with UCRT, real 
C95+ compatible wcstok provided by wcstok_s alias
 wcstok_s
 wcstol
 ; wcstold ; Can't use long double functions from the CRT on x86
@@ -2254,4 +2254,5 @@ wprintf_s
 wscanf
 wscanf_s
 
+#define USE_WCSTOK_S_FOR_WCSTOK
 #include "crt-aliases.def.in"
diff --git a/mingw-w64-crt/lib64/msvcr120d.def.in 
b/mingw-w64-crt/lib64/msvcr120d.def.in
index 3af9c66c010b..84318c242e8d 100644
--- a/mingw-w64-crt/lib64/msvcr120d.def.in
+++ b/mingw-w64-crt/lib64/msvcr120d.def.in
@@ -2296,7 +2296,7 @@ wcsstr
 wcstod
 wcstof
 wcstoimax
-wcstok
+_wcstok == wcstok ; rename wcstok to _wcstok for compatibility with UCRT, real 
C95+ compatible wcstok provided by wcstok_s alias
 wcstok_s
 wcstol
 ; wcstold ; Can't use long double functions from the CRT on x86
@@ -2319,4 +2319,5 @@ wprintf_s
 wscanf
 wscanf_s
 
+#define USE_WCSTOK_S_FOR_WCSTOK
 #include "crt-aliases.def.in"
diff --git a/mingw-w64-crt/lib64/msvcr80.def.in 
b/mingw-w64-crt/lib64/msvcr80.def.in
index 1e66668f96d9..f574e0c24de4 100644
--- a/mingw-w64-crt/lib64/msvcr80.def.in
+++ b/mingw-w64-crt/lib64/msvcr80.def.in
@@ -1467,7 +1467,7 @@ wcsrtombs_s
 wcsspn
 wcsstr
 wcstod
-wcstok
+_wcstok == wcstok ; rename wcstok to _wcstok for compatibility with UCRT, real 
C95+ compatible wcstok provided by wcstok_s alias
 wcstok_s
 wcstol
 wcstombs
@@ -1501,4 +1501,5 @@ fread_s
 #define WITH_LLABS_ALIAS
 #define WITH_STRTO64_ALIAS
 #define WITH_STRTO64_L_ALIAS
+#define USE_WCSTOK_S_FOR_WCSTOK
 #include "crt-aliases.def.in"
diff --git a/mingw-w64-crt/lib64/msvcr80d.def.in 
b/mingw-w64-crt/lib64/msvcr80d.def.in
index 3228febcfd44..ed4b88cda370 100644
--- a/mingw-w64-crt/lib64/msvcr80d.def.in
+++ b/mingw-w64-crt/lib64/msvcr80d.def.in
@@ -1544,7 +1544,7 @@ wcsrtombs_s
 wcsspn
 wcsstr
 wcstod
-wcstok
+_wcstok == wcstok ; rename wcstok to _wcstok for compatibility with UCRT, real 
C95+ compatible wcstok provided by wcstok_s alias
 wcstok_s
 wcstol
 wcstombs
@@ -1573,4 +1573,5 @@ fread_s
 #define WITH_LLABS_ALIAS
 #define WITH_STRTO64_ALIAS
 #define WITH_STRTO64_L_ALIAS
+#define USE_WCSTOK_S_FOR_WCSTOK
 #include "crt-aliases.def.in"
diff --git a/mingw-w64-crt/lib64/msvcr90.def.in 
b/mingw-w64-crt/lib64/msvcr90.def.in
index 591ac9fd2964..dfe063e43cbf 100644
--- a/mingw-w64-crt/lib64/msvcr90.def.in
+++ b/mingw-w64-crt/lib64/msvcr90.def.in
@@ -1465,7 +1465,7 @@ wcsrtombs_s
 wcsspn
 wcsstr
 wcstod
-wcstok
+_wcstok == wcstok ; rename wcstok to _wcstok for compatibility with UCRT, real 
C95+ compatible wcstok provided by wcstok_s alias
 wcstok_s
 wcstol
 wcstombs
@@ -1487,4 +1487,5 @@ wscanf_s
 #define WITH_LLABS_ALIAS
 #define WITH_STRTO64_ALIAS
 #define WITH_STRTO64_L_ALIAS
+#define USE_WCSTOK_S_FOR_WCSTOK
 #include "crt-aliases.def.in"
diff --git a/mingw-w64-crt/lib64/msvcr90d.def.in 
b/mingw-w64-crt/lib64/msvcr90d.def.in
index 5b2532e1bc65..bcf30f183c7a 100644
--- a/mingw-w64-crt/lib64/msvcr90d.def.in
+++ b/mingw-w64-crt/lib64/msvcr90d.def.in
@@ -1531,7 +1531,7 @@ wcsrtombs_s
 wcsspn
 wcsstr
 wcstod
-wcstok
+_wcstok == wcstok ; rename wcstok to _wcstok for compatibility with UCRT, real 
C95+ compatible wcstok provided by wcstok_s alias
 wcstok_s
 wcstol
 wcstombs
@@ -1553,4 +1553,5 @@ wscanf_s
 #define WITH_LLABS_ALIAS
 #define WITH_STRTO64_ALIAS
 #define WITH_STRTO64_L_ALIAS
+#define USE_WCSTOK_S_FOR_WCSTOK
 #include "crt-aliases.def.in"
diff --git a/mingw-w64-crt/libarm32/msvcr110.def.in 
b/mingw-w64-crt/libarm32/msvcr110.def.in
index d0af03fad6ce..3eb0a7a546f8 100644
--- a/mingw-w64-crt/libarm32/msvcr110.def.in
+++ b/mingw-w64-crt/libarm32/msvcr110.def.in
@@ -1958,7 +1958,7 @@ wcsrtombs_s
 wcsspn
 wcsstr
 wcstod
-wcstok
+_wcstok == wcstok ; rename wcstok to _wcstok for compatibility with UCRT, real 
C95+ compatible wcstok provided by wcstok_s alias
 wcstok_s
 wcstol
 wcstombs
@@ -2001,4 +2001,5 @@ __crtSetThreadStackGuarantee
 #define WITH_IMAXDIV_ALIAS
 #define WITH_STRTO64_ALIAS
 #define WITH_STRTO64_L_ALIAS
+#define USE_WCSTOK_S_FOR_WCSTOK
 #include "crt-aliases.def.in"
diff --git a/mingw-w64-crt/libarm32/msvcr110d.def.in 
b/mingw-w64-crt/libarm32/msvcr110d.def.in
index 2dd7f38bb0cc..99ed884b238b 100644
--- a/mingw-w64-crt/libarm32/msvcr110d.def.in
+++ b/mingw-w64-crt/libarm32/msvcr110d.def.in
@@ -2023,7 +2023,7 @@ wcsrtombs_s
 wcsspn
 wcsstr
 wcstod
-wcstok
+_wcstok == wcstok ; rename wcstok to _wcstok for compatibility with UCRT, real 
C95+ compatible wcstok provided by wcstok_s alias
 wcstok_s
 wcstol
 wcstombs
@@ -2066,4 +2066,5 @@ __crtSetThreadStackGuarantee
 #define WITH_IMAXDIV_ALIAS
 #define WITH_STRTO64_ALIAS
 #define WITH_STRTO64_L_ALIAS
+#define USE_WCSTOK_S_FOR_WCSTOK
 #include "crt-aliases.def.in"
diff --git a/mingw-w64-crt/libarm32/msvcr120.def.in 
b/mingw-w64-crt/libarm32/msvcr120.def.in
index c32ad49472ac..97edb83ddd6b 100644
--- a/mingw-w64-crt/libarm32/msvcr120.def.in
+++ b/mingw-w64-crt/libarm32/msvcr120.def.in
@@ -2197,7 +2197,7 @@ wcsstr
 wcstod
 wcstof
 wcstoimax
-wcstok
+_wcstok == wcstok ; rename wcstok to _wcstok for compatibility with UCRT, real 
C95+ compatible wcstok provided by wcstok_s alias
 wcstok_s
 wcstol
 wcstold
@@ -2220,4 +2220,5 @@ wprintf_s
 wscanf
 wscanf_s
 
+#define USE_WCSTOK_S_FOR_WCSTOK
 #include "crt-aliases.def.in"
diff --git a/mingw-w64-crt/libarm32/msvcr120d.def.in 
b/mingw-w64-crt/libarm32/msvcr120d.def.in
index b30ad0e6b8fa..55ba37b2db32 100644
--- a/mingw-w64-crt/libarm32/msvcr120d.def.in
+++ b/mingw-w64-crt/libarm32/msvcr120d.def.in
@@ -2262,7 +2262,7 @@ wcsstr
 wcstod
 wcstof
 wcstoimax
-wcstok
+_wcstok == wcstok ; rename wcstok to _wcstok for compatibility with UCRT, real 
C95+ compatible wcstok provided by wcstok_s alias
 wcstok_s
 wcstol
 wcstold
@@ -2285,4 +2285,5 @@ wprintf_s
 wscanf
 wscanf_s
 
+#define USE_WCSTOK_S_FOR_WCSTOK
 #include "crt-aliases.def.in"
diff --git a/mingw-w64-crt/string/ucrt__wcstok.c 
b/mingw-w64-crt/string/ucrt__wcstok.c
new file mode 100644
index 000000000000..67c4936dac98
--- /dev/null
+++ b/mingw-w64-crt/string/ucrt__wcstok.c
@@ -0,0 +1,14 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+
+#include <wchar.h>
+
+wchar_t *__cdecl _wcstok(wchar_t *restrict str, const wchar_t *restrict delim)
+{
+  /* NULL as a third param can be specified only for UCRT version of wcstok() 
*/
+  return wcstok(str, delim, NULL);
+}
+wchar_t *(__cdecl *__MINGW_IMP_SYMBOL(_wcstok))(wchar_t *restrict, const 
wchar_t *restrict) = _wcstok;
diff --git a/mingw-w64-crt/string/wcstok.c b/mingw-w64-crt/string/wcstok.c
new file mode 100644
index 000000000000..598d8ed57bf2
--- /dev/null
+++ b/mingw-w64-crt/string/wcstok.c
@@ -0,0 +1,41 @@
+/*
+    Copyright © 2005-2020 Rich Felker, et al.
+
+    Permission is hereby granted, free of charge, to any person obtaining
+    a copy of this software and associated documentation files (the
+    "Software"), to deal in the Software without restriction, including
+    without limitation the rights to use, copy, modify, merge, publish,
+    distribute, sublicense, and/or sell copies of the Software, and to
+    permit persons to whom the Software is furnished to do so, subject to
+    the following conditions:
+
+    The above copyright notice and this permission notice shall be
+    included in all copies or substantial portions of the Software.
+
+    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+    IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+    CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+    TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+    SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <errno.h>
+#include <wchar.h>
+
+wchar_t *__cdecl wcstok_s(wchar_t *restrict s, const wchar_t *restrict sep, 
wchar_t **restrict p)
+{
+  if (!p || !sep) { errno = EINVAL; return NULL; } /* added for wcstok_s */
+  if (!s && !(s = *p)) { errno = EINVAL; return NULL; }
+  s += wcsspn(s, sep);
+  if (!*s) return *p = NULL;
+  *p = s + wcscspn(s, sep);
+  if (**p) *(*p)++ = 0;
+  else *p = 0;
+  return s;
+}
+wchar_t *(__cdecl *__MINGW_IMP_SYMBOL(wcstok_s))(wchar_t *restrict, const 
wchar_t *restrict, wchar_t **restrict) = wcstok_s;
+
+wchar_t * __attribute__ ((alias ("wcstok_s"))) __cdecl wcstok (wchar_t 
*restrict, const wchar_t *restrict, wchar_t **restrict);
+extern wchar_t * (__cdecl * __attribute__((alias 
(__MINGW64_STRINGIFY(__MINGW_IMP_SYMBOL(wcstok_s))))) 
__MINGW_IMP_SYMBOL(wcstok))(wchar_t *restrict, const wchar_t *restrict, wchar_t 
**restrict);
diff --git a/mingw-w64-headers/crt/string.h b/mingw-w64-headers/crt/string.h
index c160c3c9b7e6..7a5999e59018 100644
--- a/mingw-w64-headers/crt/string.h
+++ b/mingw-w64-headers/crt/string.h
@@ -144,10 +144,13 @@ extern "C" {
   _CONST_RETURN wchar_t *__cdecl wcsrchr(const wchar_t *_Str,wchar_t _Ch);
   size_t __cdecl wcsspn(const wchar_t *_Str,const wchar_t *_Control);
   _CONST_RETURN wchar_t *__cdecl wcsstr(const wchar_t *_Str,const wchar_t 
*_SubStr);
-#if defined(_UCRT)
-  wchar_t *__cdecl wcstok(wchar_t * __restrict__ _Str,const wchar_t * 
__restrict__ _Delim,wchar_t **_Ptr) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
-#else
-  wchar_t *__cdecl wcstok(wchar_t * __restrict__ _Str,const wchar_t * 
__restrict__ _Delim) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
+  wchar_t *__cdecl wcstok(wchar_t * __restrict__ _Str,const wchar_t * 
__restrict__ _Delim,wchar_t ** __restrict__ _Ptr) 
__MINGW_ATTRIB_DEPRECATED_SEC_WARN;
+  wchar_t *__cdecl _wcstok(wchar_t * __restrict__ _Str,const wchar_t * 
__restrict__ _Delim) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
+#if defined(_CRT_NON_CONFORMING_WCSTOK) && !defined(__cplusplus)
+  #define wcstok _wcstok
+#endif
+#if !defined(__CRT__NO_INLINE) && !defined(_CRT_NO_INLINE_DEPRECATED_WCSTOK) 
&& defined(__cplusplus)
+  __CRT_INLINE wchar_t *__cdecl wcstok(wchar_t * __restrict__ _Str,const 
wchar_t * __restrict__ _Delim) { return _wcstok(_Str, _Delim); }
 #endif
   _CRTIMP wchar_t *__cdecl _wcserror(int _ErrNum) 
__MINGW_ATTRIB_DEPRECATED_SEC_WARN;
   _CRTIMP wchar_t *__cdecl __wcserror(const wchar_t *_Str) 
__MINGW_ATTRIB_DEPRECATED_SEC_WARN;
diff --git a/mingw-w64-headers/crt/wchar.h b/mingw-w64-headers/crt/wchar.h
index 717e470c1dc0..37c27d96a51b 100644
--- a/mingw-w64-headers/crt/wchar.h
+++ b/mingw-w64-headers/crt/wchar.h
@@ -1207,10 +1207,13 @@ __MINGW_ASM_CALL(__mingw_vsnwprintf);
   _CONST_RETURN wchar_t *__cdecl wcsrchr(const wchar_t *_Str,wchar_t _Ch);
   size_t __cdecl wcsspn(const wchar_t *_Str,const wchar_t *_Control);
   _CONST_RETURN wchar_t *__cdecl wcsstr(const wchar_t *_Str,const wchar_t 
*_SubStr);
-#if defined(_UCRT)
-  wchar_t *__cdecl wcstok(wchar_t * __restrict__ _Str,const wchar_t * 
__restrict__ _Delim,wchar_t **_Ptr) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
-#else
-  wchar_t *__cdecl wcstok(wchar_t * __restrict__ _Str,const wchar_t * 
__restrict__ _Delim) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
+  wchar_t *__cdecl wcstok(wchar_t * __restrict__ _Str,const wchar_t * 
__restrict__ _Delim,wchar_t ** __restrict__ _Ptr) 
__MINGW_ATTRIB_DEPRECATED_SEC_WARN;
+  wchar_t *__cdecl _wcstok(wchar_t * __restrict__ _Str,const wchar_t * 
__restrict__ _Delim) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
+#if defined(_CRT_NON_CONFORMING_WCSTOK) && !defined(__cplusplus)
+  #define wcstok _wcstok
+#endif
+#if !defined(__CRT__NO_INLINE) && !defined(_CRT_NO_INLINE_DEPRECATED_WCSTOK) 
&& defined(__cplusplus)
+  __CRT_INLINE wchar_t *__cdecl wcstok(wchar_t * __restrict__ _Str,const 
wchar_t * __restrict__ _Delim) { return _wcstok(_Str, _Delim); }
 #endif
   _CRTIMP wchar_t *__cdecl _wcserror(int _ErrNum) 
__MINGW_ATTRIB_DEPRECATED_SEC_WARN;
   _CRTIMP wchar_t *__cdecl __wcserror(const wchar_t *_Str) 
__MINGW_ATTRIB_DEPRECATED_SEC_WARN;
-- 
2.20.1



_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to