headers: crt: split out corecrt_wstdio.h
Note: The diff is huge. It's recommended to compare corecrt_wstdio.h
with original stdio.h and wchar.h to see the changes more clearly.
This commit splits out corecrt_wstdio.h from stdio.h and wchar.h to
deduplicate. The content is mainly moved from wchar.h, with some changes
from stdio.h. It's noteworthy that several functions slightly differ
between stdio.h and wchar.h, which I think mostly is a mistake.
To be more specific, I've found the following major differences:
1. __USE_MINGW_ANSI_STDIO is not combind with !_CRTBLD in wchar.h, but
it is in stdio.h
2. swprintf, vswprintf, snwprintf, vsnwprintf's implemention inside
__USE_MINGW_ANSI_STDIO only exists in stdio.h
3. snwprintf, vsnwprintf's declaration inside !__USE_MINGW_ANSI_STDIO is
guarded stricter in wchar.h and placed differently
4. _swprintf_l's declaration inside !_UCRT only exists in wchar.h
5. _vscwprintf, _swprintf, _vswprintf's declaration only exists in
stdio.h
6. _[v](f,s,)(n,c,)w(printf|scanf)(_p|_l|_p_l)'s' declaration /
implemention only exists in wchar.h
7. _snwscanf is always declared in stdio.h, but in wchar.h it's
implemented if _UCRT and declared otherwise
8. vswscanf is declared with __restrict__ in stdio.h, but without it in
wchar.h
9. __stdio_common_v(f|s)wprintf_p is only declared in wchar.h.
Note that to keep the diff cleaner, I tried to keep most content AS IS,
which means that there's still some duplication / inconsistency between
functions, especially regarding __restrict__.
_STDIO_DEFINED, _STDSTREAM_DEFINED, and _WSTDIO_DEFINED are removed,
since all the content is moved to corecrt_wstdio.h, and they're not used
anywhere else.
This commit uses _CRT_BEGIN_C_HEADER from my previous commit.
Signed-off-by: Zhongteng Gui <dragon-archer@outlook.com>
Co-authored-by: LIU Hao <lh_mouse@126.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
3 files changed