mirror of
https://git.code.sf.net/p/mingw-w64/mingw-w64
synced 2024-11-23 01:44:43 +08:00
crt: Add support for C95 wcstok() function for non-UCRT import libraries
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. Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
parent
cf5c50cce0
commit
bafccb49a0
@ -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=\
|
||||
@ -746,7 +749,8 @@ src_pre_msvcr80=\
|
||||
misc/wctob.c \
|
||||
stdio/_fstat64i32.c \
|
||||
stdio/fseeki64.c \
|
||||
stdio/mingw_lock.c
|
||||
stdio/mingw_lock.c \
|
||||
string/wcstok.c
|
||||
|
||||
src_pre_msvcr100=\
|
||||
misc/imaxdiv.c
|
||||
|
@ -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
|
||||
|
@ -2310,7 +2310,7 @@ wcsstr
|
||||
wcstod
|
||||
wcstof
|
||||
wcstoimax
|
||||
wcstok
|
||||
_wcstok == wcstok ; provide nonstandard function "wcstok" in the DLL, under the name "_wcstok" to match UCRT, the C95+ compatible "wcstok" is 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"
|
||||
|
@ -1117,7 +1117,7 @@ wcsrchr
|
||||
wcsspn
|
||||
wcsstr
|
||||
wcstod
|
||||
wcstok
|
||||
_wcstok == wcstok ; provide nonstandard function "wcstok" in the DLL, under the name "_wcstok" to match UCRT, the C95+ compatible "wcstok" is 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
|
||||
|
@ -607,7 +607,7 @@ wcsrchr
|
||||
wcsspn
|
||||
wcsstr
|
||||
wcstod
|
||||
wcstok
|
||||
_wcstok == wcstok ; provide nonstandard function "wcstok" in the DLL, under the name "_wcstok" to match UCRT, the C95+ compatible "wcstok" is provided by mingw-w64
|
||||
wcstol
|
||||
wcstombs
|
||||
wcstoul
|
||||
|
@ -1885,7 +1885,7 @@ wcsrtombs_s
|
||||
wcsspn
|
||||
wcsstr
|
||||
wcstod
|
||||
wcstok
|
||||
_wcstok == wcstok ; provide nonstandard function "wcstok" in the DLL, under the name "_wcstok" to match UCRT, the C95+ compatible "wcstok" is 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"
|
||||
|
@ -1948,7 +1948,7 @@ wcsrtombs_s
|
||||
wcsspn
|
||||
wcsstr
|
||||
wcstod
|
||||
wcstok
|
||||
_wcstok == wcstok ; provide nonstandard function "wcstok" in the DLL, under the name "_wcstok" to match UCRT, the C95+ compatible "wcstok" is 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"
|
||||
|
@ -2014,7 +2014,7 @@ wcsrtombs_s
|
||||
wcsspn
|
||||
wcsstr
|
||||
wcstod
|
||||
wcstok
|
||||
_wcstok == wcstok ; provide nonstandard function "wcstok" in the DLL, under the name "_wcstok" to match UCRT, the C95+ compatible "wcstok" is 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"
|
||||
|
@ -2081,7 +2081,7 @@ wcsrtombs_s
|
||||
wcsspn
|
||||
wcsstr
|
||||
wcstod
|
||||
wcstok
|
||||
_wcstok == wcstok ; provide nonstandard function "wcstok" in the DLL, under the name "_wcstok" to match UCRT, the C95+ compatible "wcstok" is 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"
|
||||
|
@ -2275,7 +2275,7 @@ wcsstr
|
||||
wcstod
|
||||
wcstof
|
||||
wcstoimax
|
||||
wcstok
|
||||
_wcstok == wcstok ; provide nonstandard function "wcstok" in the DLL, under the name "_wcstok" to match UCRT, the C95+ compatible "wcstok" is 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"
|
||||
|
@ -2342,7 +2342,7 @@ wcsstr
|
||||
wcstod
|
||||
wcstof
|
||||
wcstoimax
|
||||
wcstok
|
||||
_wcstok == wcstok ; provide nonstandard function "wcstok" in the DLL, under the name "_wcstok" to match UCRT, the C95+ compatible "wcstok" is 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"
|
||||
|
@ -1641,7 +1641,7 @@ wcsrchr
|
||||
wcsspn
|
||||
wcsstr
|
||||
wcstod
|
||||
wcstok
|
||||
_wcstok == wcstok ; provide nonstandard function "wcstok" in the DLL, under the name "_wcstok" to match UCRT, the C95+ compatible "wcstok" is provided by mingw-w64
|
||||
wcstol
|
||||
wcstombs
|
||||
wcstoul
|
||||
|
@ -891,7 +891,7 @@ wcsrchr
|
||||
wcsspn
|
||||
wcsstr
|
||||
wcstod
|
||||
wcstok
|
||||
_wcstok == wcstok ; provide nonstandard function "wcstok" in the DLL, under the name "_wcstok" to match UCRT, the C95+ compatible "wcstok" is provided by mingw-w64
|
||||
wcstol
|
||||
wcstombs
|
||||
wcstoul
|
||||
|
@ -935,7 +935,7 @@ wcsrchr
|
||||
wcsspn
|
||||
wcsstr
|
||||
wcstod
|
||||
wcstok
|
||||
_wcstok == wcstok ; provide nonstandard function "wcstok" in the DLL, under the name "_wcstok" to match UCRT, the C95+ compatible "wcstok" is provided by mingw-w64
|
||||
wcstol
|
||||
wcstombs
|
||||
wcstoul
|
||||
|
@ -885,7 +885,7 @@ wcsrchr
|
||||
wcsspn
|
||||
wcsstr
|
||||
wcstod
|
||||
wcstok
|
||||
_wcstok == wcstok ; provide nonstandard function "wcstok" in the DLL, under the name "_wcstok" to match UCRT, the C95+ compatible "wcstok" is provided by mingw-w64
|
||||
wcstol
|
||||
wcstombs
|
||||
wcstoul
|
||||
|
@ -929,7 +929,7 @@ wcsrchr
|
||||
wcsspn
|
||||
wcsstr
|
||||
wcstod
|
||||
wcstok
|
||||
_wcstok == wcstok ; provide nonstandard function "wcstok" in the DLL, under the name "_wcstok" to match UCRT, the C95+ compatible "wcstok" is provided by mingw-w64
|
||||
wcstol
|
||||
wcstombs
|
||||
wcstoul
|
||||
|
@ -1519,7 +1519,7 @@ wcsrtombs_s
|
||||
wcsspn
|
||||
wcsstr
|
||||
wcstod
|
||||
wcstok
|
||||
_wcstok == wcstok ; provide nonstandard function "wcstok" in the DLL, under the name "_wcstok" to match UCRT, the C95+ compatible "wcstok" is provided by wcstok_s alias
|
||||
wcstok_s
|
||||
wcstol
|
||||
wcstombs
|
||||
@ -1553,4 +1553,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"
|
||||
|
@ -1602,7 +1602,7 @@ wcsrtombs_s
|
||||
wcsspn
|
||||
wcsstr
|
||||
wcstod
|
||||
wcstok
|
||||
_wcstok == wcstok ; provide nonstandard function "wcstok" in the DLL, under the name "_wcstok" to match UCRT, the C95+ compatible "wcstok" is provided by wcstok_s alias
|
||||
wcstok_s
|
||||
wcstol
|
||||
wcstombs
|
||||
@ -1631,4 +1631,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"
|
||||
|
@ -1517,7 +1517,7 @@ wcsrtombs_s
|
||||
wcsspn
|
||||
wcsstr
|
||||
wcstod
|
||||
wcstok
|
||||
_wcstok == wcstok ; provide nonstandard function "wcstok" in the DLL, under the name "_wcstok" to match UCRT, the C95+ compatible "wcstok" is provided by wcstok_s alias
|
||||
wcstok_s
|
||||
wcstol
|
||||
wcstombs
|
||||
@ -1538,4 +1538,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"
|
||||
|
@ -1589,7 +1589,7 @@ wcsrtombs_s
|
||||
wcsspn
|
||||
wcsstr
|
||||
wcstod
|
||||
wcstok
|
||||
_wcstok == wcstok ; provide nonstandard function "wcstok" in the DLL, under the name "_wcstok" to match UCRT, the C95+ compatible "wcstok" is provided by wcstok_s alias
|
||||
wcstok_s
|
||||
wcstol
|
||||
wcstombs
|
||||
@ -1610,4 +1610,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"
|
||||
|
@ -1285,7 +1285,7 @@ wcsrchr
|
||||
wcsspn
|
||||
wcsstr
|
||||
wcstod
|
||||
wcstok
|
||||
_wcstok == wcstok ; provide nonstandard function "wcstok" in the DLL, under the name "_wcstok" to match UCRT, the C95+ compatible "wcstok" is provided by mingw-w64
|
||||
wcstol
|
||||
wcstombs
|
||||
wcstoul
|
||||
|
@ -1509,7 +1509,7 @@ wcsrchr
|
||||
wcsspn
|
||||
wcsstr
|
||||
wcstod
|
||||
wcstok
|
||||
_wcstok == wcstok ; provide nonstandard function "wcstok" in the DLL, under the name "_wcstok" to match UCRT, the C95+ compatible "wcstok" is provided by mingw-w64
|
||||
wcstol
|
||||
wcstombs
|
||||
wcstoul
|
||||
|
@ -1609,7 +1609,7 @@ wcsrchr
|
||||
wcsspn
|
||||
wcsstr
|
||||
wcstod
|
||||
wcstok
|
||||
_wcstok == wcstok ; provide nonstandard function "wcstok" in the DLL, under the name "_wcstok" to match UCRT, the C95+ compatible "wcstok" is provided by mingw-w64
|
||||
wcstol
|
||||
wcstombs
|
||||
wcstoul
|
||||
|
@ -835,7 +835,7 @@ wcsrchr
|
||||
wcsspn
|
||||
wcsstr
|
||||
wcstod
|
||||
wcstok
|
||||
_wcstok == wcstok ; provide nonstandard function "wcstok" in the DLL, under the name "_wcstok" to match UCRT, the C95+ compatible "wcstok" is provided by mingw-w64
|
||||
wcstol
|
||||
wcstombs
|
||||
wcstoul
|
||||
|
@ -1847,7 +1847,7 @@ wcsrtombs_s
|
||||
wcsspn
|
||||
wcsstr
|
||||
wcstod
|
||||
wcstok
|
||||
_wcstok == wcstok ; provide nonstandard function "wcstok" in the DLL, under the name "_wcstok" to match UCRT, the C95+ compatible "wcstok" is 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"
|
||||
|
@ -1912,7 +1912,7 @@ wcsrtombs_s
|
||||
wcsspn
|
||||
wcsstr
|
||||
wcstod
|
||||
wcstok
|
||||
_wcstok == wcstok ; provide nonstandard function "wcstok" in the DLL, under the name "_wcstok" to match UCRT, the C95+ compatible "wcstok" is 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"
|
||||
|
@ -1971,7 +1971,7 @@ wcsrtombs_s
|
||||
wcsspn
|
||||
wcsstr
|
||||
wcstod
|
||||
wcstok
|
||||
_wcstok == wcstok ; provide nonstandard function "wcstok" in the DLL, under the name "_wcstok" to match UCRT, the C95+ compatible "wcstok" is 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"
|
||||
|
@ -2036,7 +2036,7 @@ wcsrtombs_s
|
||||
wcsspn
|
||||
wcsstr
|
||||
wcstod
|
||||
wcstok
|
||||
_wcstok == wcstok ; provide nonstandard function "wcstok" in the DLL, under the name "_wcstok" to match UCRT, the C95+ compatible "wcstok" is 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"
|
||||
|
@ -2231,7 +2231,7 @@ wcsstr
|
||||
wcstod
|
||||
wcstof
|
||||
wcstoimax
|
||||
wcstok
|
||||
_wcstok == wcstok ; provide nonstandard function "wcstok" in the DLL, under the name "_wcstok" to match UCRT, the C95+ compatible "wcstok" is 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"
|
||||
|
@ -2296,7 +2296,7 @@ wcsstr
|
||||
wcstod
|
||||
wcstof
|
||||
wcstoimax
|
||||
wcstok
|
||||
_wcstok == wcstok ; provide nonstandard function "wcstok" in the DLL, under the name "_wcstok" to match UCRT, the C95+ compatible "wcstok" is 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"
|
||||
|
@ -1467,7 +1467,7 @@ wcsrtombs_s
|
||||
wcsspn
|
||||
wcsstr
|
||||
wcstod
|
||||
wcstok
|
||||
_wcstok == wcstok ; provide nonstandard function "wcstok" in the DLL, under the name "_wcstok" to match UCRT, the C95+ compatible "wcstok" is 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"
|
||||
|
@ -1544,7 +1544,7 @@ wcsrtombs_s
|
||||
wcsspn
|
||||
wcsstr
|
||||
wcstod
|
||||
wcstok
|
||||
_wcstok == wcstok ; provide nonstandard function "wcstok" in the DLL, under the name "_wcstok" to match UCRT, the C95+ compatible "wcstok" is 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"
|
||||
|
@ -1465,7 +1465,7 @@ wcsrtombs_s
|
||||
wcsspn
|
||||
wcsstr
|
||||
wcstod
|
||||
wcstok
|
||||
_wcstok == wcstok ; provide nonstandard function "wcstok" in the DLL, under the name "_wcstok" to match UCRT, the C95+ compatible "wcstok" is provided by wcstok_s alias
|
||||
wcstok_s
|
||||
wcstol
|
||||
wcstombs
|
||||
@ -1486,4 +1486,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"
|
||||
|
@ -1531,7 +1531,7 @@ wcsrtombs_s
|
||||
wcsspn
|
||||
wcsstr
|
||||
wcstod
|
||||
wcstok
|
||||
_wcstok == wcstok ; provide nonstandard function "wcstok" in the DLL, under the name "_wcstok" to match UCRT, the C95+ compatible "wcstok" is provided by wcstok_s alias
|
||||
wcstok_s
|
||||
wcstol
|
||||
wcstombs
|
||||
@ -1552,4 +1552,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"
|
||||
|
@ -1958,7 +1958,7 @@ wcsrtombs_s
|
||||
wcsspn
|
||||
wcsstr
|
||||
wcstod
|
||||
wcstok
|
||||
_wcstok == wcstok ; provide nonstandard function "wcstok" in the DLL, under the name "_wcstok" to match UCRT, the C95+ compatible "wcstok" is 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"
|
||||
|
@ -2023,7 +2023,7 @@ wcsrtombs_s
|
||||
wcsspn
|
||||
wcsstr
|
||||
wcstod
|
||||
wcstok
|
||||
_wcstok == wcstok ; provide nonstandard function "wcstok" in the DLL, under the name "_wcstok" to match UCRT, the C95+ compatible "wcstok" is 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"
|
||||
|
@ -2197,7 +2197,7 @@ wcsstr
|
||||
wcstod
|
||||
wcstof
|
||||
wcstoimax
|
||||
wcstok
|
||||
_wcstok == wcstok ; provide nonstandard function "wcstok" in the DLL, under the name "_wcstok" to match UCRT, the C95+ compatible "wcstok" is 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"
|
||||
|
@ -2262,7 +2262,7 @@ wcsstr
|
||||
wcstod
|
||||
wcstof
|
||||
wcstoimax
|
||||
wcstok
|
||||
_wcstok == wcstok ; provide nonstandard function "wcstok" in the DLL, under the name "_wcstok" to match UCRT, the C95+ compatible "wcstok" is 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"
|
||||
|
14
mingw-w64-crt/string/ucrt__wcstok.c
Normal file
14
mingw-w64-crt/string/ucrt__wcstok.c
Normal file
@ -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;
|
41
mingw-w64-crt/string/wcstok.c
Normal file
41
mingw-w64-crt/string/wcstok.c
Normal file
@ -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);
|
@ -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_DEPRECATED_WCSTOK) && defined(__cplusplus)
|
||||
extern "C++" 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;
|
||||
|
@ -1214,10 +1214,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_DEPRECATED_WCSTOK) && defined(__cplusplus)
|
||||
extern "C++" 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;
|
||||
|
Loading…
Reference in New Issue
Block a user