include/crt: Ensure declarations of `_*_nolock` match MSVCRT version
Signed-off-by: Liu Hao <lh_mouse@126.com>
diff --git a/mingw-w64-headers/crt/conio.h b/mingw-w64-headers/crt/conio.h
index b28a71c..f7e80b1 100644
--- a/mingw-w64-headers/crt/conio.h
+++ b/mingw-w64-headers/crt/conio.h
@@ -122,10 +122,12 @@
_CRTIMP int __cdecl _putch(int _Ch);
_CRTIMP int __cdecl _ungetch(int _Ch);
+#if __MSVCRT_VERSION__ >= 0x800
_CRTIMP int __cdecl _getch_nolock(void);
_CRTIMP int __cdecl _getche_nolock(void);
_CRTIMP int __cdecl _putch_nolock(int _Ch);
_CRTIMP int __cdecl _ungetch_nolock(int _Ch);
+#endif
#ifndef _WCONIO_DEFINED
#define _WCONIO_DEFINED
@@ -228,11 +230,13 @@
_CRTIMP int __cdecl _cwprintf_p_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,...);
_CRTIMP int __cdecl _vcwprintf_p_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,va_list _ArgList);
#endif
+#if __MSVCRT_VERSION__ >= 0x800
_CRTIMP wint_t __cdecl _putwch_nolock(wchar_t _WCh);
_CRTIMP wint_t __cdecl _getwch_nolock(void);
_CRTIMP wint_t __cdecl _getwche_nolock(void);
_CRTIMP wint_t __cdecl _ungetwch_nolock(wint_t _WCh);
#endif
+#endif
#ifndef NO_OLDNAMES
char *__cdecl cgets(char *_Buffer) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
diff --git a/mingw-w64-headers/crt/crtdbg.h b/mingw-w64-headers/crt/crtdbg.h
index b78dbe7..1b4f37b 100644
--- a/mingw-w64-headers/crt/crtdbg.h
+++ b/mingw-w64-headers/crt/crtdbg.h
@@ -169,8 +169,10 @@
#define _wgetcwd_dbg(s,le,t,f,l) _wgetcwd(s,le)
#define _getdcwd_dbg(d,s,le,t,f,l) _getdcwd(d,s,le)
#define _wgetdcwd_dbg(d,s,le,t,f,l) _wgetdcwd(d,s,le)
+#if __MSVCRT_VERSION__ >= 0x800
#define _getdcwd_lk_dbg(d,s,le,t,f,l) _getdcwd_nolock(d,s,le)
#define _wgetdcwd_lk_dbg(d,s,le,t,f,l) _wgetdcwd_nolock(d,s,le)
+#endif
#define _CrtSetReportHook(f) ((_CRT_REPORT_HOOK)0)
#define _CrtGetReportHook() ((_CRT_REPORT_HOOK)0)
diff --git a/mingw-w64-headers/crt/direct.h b/mingw-w64-headers/crt/direct.h
index 3232902..e6d95f2 100644
--- a/mingw-w64-headers/crt/direct.h
+++ b/mingw-w64-headers/crt/direct.h
@@ -27,7 +27,9 @@
_CRTIMP char *__cdecl _getcwd(char *_DstBuf,int _SizeInBytes);
_CRTIMP char *__cdecl _getdcwd(int _Drive,char *_DstBuf,int _SizeInBytes);
+#if __MSVCRT_VERSION__ >= 0x800
char *__cdecl _getdcwd_nolock(int _Drive,char *_DstBuf,int _SizeInBytes);
+#endif
_CRTIMP int __cdecl _chdir(const char *_Path);
_CRTIMP int __cdecl _mkdir(const char *_Path);
_CRTIMP int __cdecl _rmdir(const char *_Path);
@@ -46,7 +48,9 @@
#define _WDIRECT_DEFINED
_CRTIMP wchar_t *__cdecl _wgetcwd(wchar_t *_DstBuf,int _SizeInWords);
_CRTIMP wchar_t *__cdecl _wgetdcwd(int _Drive,wchar_t *_DstBuf,int _SizeInWords);
+#if __MSVCRT_VERSION__ >= 0x800
wchar_t *__cdecl _wgetdcwd_nolock(int _Drive,wchar_t *_DstBuf,int _SizeInWords);
+#endif
_CRTIMP int __cdecl _wchdir(const wchar_t *_Path);
_CRTIMP int __cdecl _wmkdir(const wchar_t *_Path);
_CRTIMP int __cdecl _wrmdir(const wchar_t *_Path);
diff --git a/mingw-w64-headers/crt/sec_api/stdio_s.h b/mingw-w64-headers/crt/sec_api/stdio_s.h
index ad9b5ba..ee8b381 100644
--- a/mingw-w64-headers/crt/sec_api/stdio_s.h
+++ b/mingw-w64-headers/crt/sec_api/stdio_s.h
@@ -864,7 +864,9 @@
#endif /* _WSTDIO_S_DEFINED */
#endif /* _STDIO_S_DEFINED */
+#if __MSVCRT_VERSION__ >= 0x800
_CRTIMP size_t __cdecl _fread_nolock_s(void *_DstBuf,size_t _DstSize,size_t _ElementSize,size_t _Count,FILE *_File);
+#endif
#ifdef __cplusplus
}
diff --git a/mingw-w64-headers/crt/stdio.h b/mingw-w64-headers/crt/stdio.h
index 2f9d724..89bfa14 100644
--- a/mingw-w64-headers/crt/stdio.h
+++ b/mingw-w64-headers/crt/stdio.h
@@ -1430,9 +1430,11 @@
_CRTIMP int __cdecl _wremove(const wchar_t *_Filename);
_CRTIMP wchar_t *__cdecl _wtmpnam(wchar_t *_Buffer);
+#if __MSVCRT_VERSION__ >= 0x800
_CRTIMP wint_t __cdecl _fgetwc_nolock(FILE *_File);
_CRTIMP wint_t __cdecl _fputwc_nolock(wchar_t _Ch,FILE *_File);
_CRTIMP wint_t __cdecl _ungetwc_nolock(wint_t _Ch,FILE *_File);
+#endif
#undef _CRT_GETPUTWCHAR_NOINLINE
@@ -1446,9 +1448,11 @@
#define getwc(_stm) fgetwc(_stm)
#define putwc(_c,_stm) fputwc(_c,_stm)
+#if __MSVCRT_VERSION__ >= 0x800
#define _putwc_nolock(_c,_stm) _fputwc_nolock(_c,_stm)
#define _getwc_nolock(_c) _fgetwc_nolock(_c)
#endif
+#endif
#define _STDIO_DEFINED
#endif
@@ -1471,6 +1475,7 @@
_CRTIMP void __cdecl _lock_file(FILE *_File);
_CRTIMP void __cdecl _unlock_file(FILE *_File);
+#if __MSVCRT_VERSION__ >= 0x800
_CRTIMP int __cdecl _fclose_nolock(FILE *_File);
_CRTIMP int __cdecl _fflush_nolock(FILE *_File);
_CRTIMP size_t __cdecl _fread_nolock(void * __restrict__ _DstBuf,size_t _ElementSize,size_t _Count,FILE * __restrict__ _File);
@@ -1480,6 +1485,7 @@
__MINGW_EXTENSION _CRTIMP __int64 __cdecl _ftelli64_nolock(FILE *_File);
_CRTIMP size_t __cdecl _fwrite_nolock(const void * __restrict__ _DstBuf,size_t _Size,size_t _Count,FILE * __restrict__ _File);
_CRTIMP int __cdecl _ungetc_nolock(int _Ch,FILE *_File);
+#endif
#if !defined(NO_OLDNAMES) || !defined(_POSIX)
#define P_tmpdir _P_tmpdir
diff --git a/mingw-w64-headers/crt/tchar.h b/mingw-w64-headers/crt/tchar.h
index c82634a..9fa2a03 100644
--- a/mingw-w64-headers/crt/tchar.h
+++ b/mingw-w64-headers/crt/tchar.h
@@ -190,35 +190,24 @@
#define _sntscanf_l _snwscanf_l
#define _fgettc fgetwc
-#define _fgettc_nolock _fgetwc_nolock
#define _fgettchar _fgetwchar
#define _fgetts fgetws
#define _fputtc fputwc
-#define _fputtc_nolock _fputwc_nolock
#define _fputtchar _fputwchar
#define _fputts fputws
#define _cputts _cputws
#define _cgetts _cgetws
#define _gettc getwc
-#define _gettc_nolock _getwc_nolock
#define _gettch _getwch
-#define _gettch_nolock _getwch_nolock
#define _gettche _getwche
-#define _gettche_nolock _getwche_nolock
#define _gettchar getwchar
-#define _gettchar_nolock _getwchar_nolock
#define _getts _getws
#define _puttc putwc
-#define _puttc_nolock _putwc_nolock
#define _puttchar putwchar
-#define _puttchar_nolock _putwchar_nolock
#define _puttch _putwch
-#define _puttch_nolock _putwch_nolock
#define _putts _putws
#define _ungettc ungetwc
-#define _ungettc_nolock _ungetwc_nolock
#define _ungettch _ungetwch
-#define _ungettch_nolock _ungetwch_nolock
#define _tcstod wcstod
#define _tcstol wcstol
@@ -334,7 +323,6 @@
#define _tchdir _wchdir
#define _tgetcwd _wgetcwd
#define _tgetdcwd _wgetdcwd
-#define _tgetdcwd_nolock _wgetdcwd_nolock
#define _tmkdir _wmkdir
#define _trmdir _wrmdir
@@ -566,35 +554,24 @@
#define _sntscanf_l _snscanf_l
#define _fgettc fgetc
-#define _fgettc_nolock _fgetc_nolock
#define _fgettchar _fgetchar
#define _fgetts fgets
#define _fputtc fputc
-#define _fputtc_nolock _fputc_nolock
#define _fputtchar _fputchar
#define _fputts fputs
#define _cputts _cputs
#define _gettc getc
-#define _gettc_nolock _getc_nolock
#define _gettch _getch
-#define _gettch_nolock _getch_nolock
#define _gettche _getche
-#define _gettche_nolock _getche_nolock
#define _gettchar getchar
-#define _gettchar_nolock _getchar_nolock
#define _getts gets
#define _cgetts _cgets
#define _puttc putc
-#define _puttc_nolock _putc_nolock
#define _puttchar putchar
-#define _puttchar_nolock _putchar_nolock
#define _puttch _putch
-#define _puttch_nolock _putch_nolock
#define _putts puts
#define _ungettc ungetc
-#define _ungettc_nolock _ungetc_nolock
#define _ungettch _ungetch
-#define _ungettch_nolock _ungetch_nolock
#define _tcstod strtod
#define _tcstol strtol
@@ -670,7 +647,6 @@
#define _tchdir _chdir
#define _tgetcwd _getcwd
#define _tgetdcwd _getdcwd
-#define _tgetdcwd_nolock _getdcwd_nolock
#define _tmkdir _mkdir
#define _trmdir _rmdir
@@ -747,6 +723,33 @@
#define _tsetlocale setlocale
+#if __MSVCRT_VERSION__ >= 0x800
+#define _fgettc_nolock _fgetwc_nolock
+#define _fputtc_nolock _fputwc_nolock
+#define _gettc_nolock _getwc_nolock
+#define _gettch_nolock _getwch_nolock
+#define _gettche_nolock _getwche_nolock
+#define _gettchar_nolock _getwchar_nolock
+#define _puttc_nolock _putwc_nolock
+#define _puttchar_nolock _putwchar_nolock
+#define _puttch_nolock _putwch_nolock
+#define _ungettc_nolock _ungetwc_nolock
+#define _ungettch_nolock _ungetwch_nolock
+#define _tgetdcwd_nolock _wgetdcwd_nolock
+#define _fgettc_nolock _fgetc_nolock
+#define _fputtc_nolock _fputc_nolock
+#define _gettc_nolock _getc_nolock
+#define _gettch_nolock _getch_nolock
+#define _gettche_nolock _getche_nolock
+#define _gettchar_nolock _getchar_nolock
+#define _puttc_nolock _putc_nolock
+#define _puttchar_nolock _putchar_nolock
+#define _puttch_nolock _putch_nolock
+#define _ungettc_nolock _ungetc_nolock
+#define _ungettch_nolock _ungetch_nolock
+#define _tgetdcwd_nolock _getdcwd_nolock
+#endif
+
#endif /* __CYGWIN__ */
#ifdef _MBCS
diff --git a/mingw-w64-headers/crt/wchar.h b/mingw-w64-headers/crt/wchar.h
index e466b52..3dc6ca4 100644
--- a/mingw-w64-headers/crt/wchar.h
+++ b/mingw-w64-headers/crt/wchar.h
@@ -292,7 +292,9 @@
_CRTIMP wchar_t *__cdecl _wgetcwd(wchar_t *_DstBuf,int _SizeInWords);
_CRTIMP wchar_t *__cdecl _wgetdcwd(int _Drive,wchar_t *_DstBuf,int _SizeInWords);
+#if __MSVCRT_VERSION__ >= 0x800
wchar_t *__cdecl _wgetdcwd_nolock(int _Drive,wchar_t *_DstBuf,int _SizeInWords);
+#endif
_CRTIMP int __cdecl _wchdir(const wchar_t *_Path);
_CRTIMP int __cdecl _wmkdir(const wchar_t *_Path);
_CRTIMP int __cdecl _wrmdir(const wchar_t *_Path);
@@ -444,11 +446,13 @@
_CRTIMP int __cdecl _vcwprintf_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,va_list _ArgList);
_CRTIMP int __cdecl _cwprintf_p_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,...);
_CRTIMP int __cdecl _vcwprintf_p_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,va_list _ArgList);
+#if __MSVCRT_VERSION__ >= 0x800
wint_t __cdecl _putwch_nolock(wchar_t _WCh);
wint_t __cdecl _getwch_nolock(void);
wint_t __cdecl _getwche_nolock(void);
wint_t __cdecl _ungetwch_nolock(wint_t _WCh);
#endif
+#endif
#ifdef _UCRT
int __cdecl __stdio_common_vswprintf_p(unsigned __int64 _Options, wchar_t *_Str, size_t _Len, const wchar_t *_Format, _locale_t _Locale, va_list _ArgList);
@@ -1219,9 +1223,11 @@
#endif
_CRTIMP int __cdecl _wremove(const wchar_t *_Filename);
_CRTIMP wchar_t *__cdecl _wtmpnam(wchar_t *_Buffer);
+#if __MSVCRT_VERSION__ >= 0x800
_CRTIMP wint_t __cdecl _fgetwc_nolock(FILE *_File);
_CRTIMP wint_t __cdecl _fputwc_nolock(wchar_t _Ch,FILE *_File);
_CRTIMP wint_t __cdecl _ungetwc_nolock(wint_t _Ch,FILE *_File);
+#endif
#undef _CRT_GETPUTWCHAR_NOINLINE
@@ -1235,9 +1241,11 @@
#define getwc(_stm) fgetwc(_stm)
#define putwc(_c,_stm) fputwc(_c,_stm)
+#if __MSVCRT_VERSION__ >= 0x800
#define _putwc_nolock(_c,_stm) _fputwc_nolock(_c,_stm)
#define _getwc_nolock(_c) _fgetwc_nolock(_c)
#endif
+#endif
#ifndef _WSTDLIB_DEFINED
#define _WSTDLIB_DEFINED