crt: Use (void*) casts to silence warnings about function pointer casts
Modern GCC and Clang warn for these casts, with warnings like these:
../secapi/_chsize_s.c:20:6: warning: cast from 'FARPROC' (aka 'long long (*)()') to 'errno_t ((*))(int, long long) __attribute__((cdecl))' (aka 'int (*)(int, lo
ng long)') converts to incompatible function type [-Wcast-function-type-mismatch]
20 | f = (errno_t __cdecl (*)(int, long long))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
21 | GetProcAddress (__mingw_get_msvcrt_handle (), "_chsize_s");
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
By casting to (void*) instead, we can let the compiler do the second
cast to the target function type implicitly, and also silencing these
warnings.
Signed-off-by: Martin Storsjö <martin@martin.st>
diff --git a/mingw-w64-crt/secapi/_access_s.c b/mingw-w64-crt/secapi/_access_s.c
index 9be582e..130fdcb 100644
--- a/mingw-w64-crt/secapi/_access_s.c
+++ b/mingw-w64-crt/secapi/_access_s.c
@@ -17,7 +17,7 @@
if (f == _stub)
{
- f = (errno_t __cdecl (*)(const char *, int))
+ f = (void*)
GetProcAddress (__mingw_get_msvcrt_handle (), "_access_s");
if (!f)
f = _int_access_s;
diff --git a/mingw-w64-crt/secapi/_cgets_s.c b/mingw-w64-crt/secapi/_cgets_s.c
index f81623a..6b6917b 100644
--- a/mingw-w64-crt/secapi/_cgets_s.c
+++ b/mingw-w64-crt/secapi/_cgets_s.c
@@ -17,7 +17,7 @@
if (f == _stub)
{
- f = (errno_t __cdecl (*)(char *, size_t, size_t *))
+ f = (void*)
GetProcAddress (__mingw_get_msvcrt_handle (), "_cgets_s");
if (!f)
f = _int_cgets_s;
diff --git a/mingw-w64-crt/secapi/_cgetws_s.c b/mingw-w64-crt/secapi/_cgetws_s.c
index 01ee3d1..42f308d 100644
--- a/mingw-w64-crt/secapi/_cgetws_s.c
+++ b/mingw-w64-crt/secapi/_cgetws_s.c
@@ -17,7 +17,7 @@
if (f == _stub)
{
- f = (errno_t __cdecl (*)(wchar_t *, size_t, size_t *))
+ f = (void*)
GetProcAddress (__mingw_get_msvcrt_handle (), "_cgetws_s");
if (!f)
f = _int_cgetws_s;
diff --git a/mingw-w64-crt/secapi/_chsize_s.c b/mingw-w64-crt/secapi/_chsize_s.c
index cd8d066..2501837 100644
--- a/mingw-w64-crt/secapi/_chsize_s.c
+++ b/mingw-w64-crt/secapi/_chsize_s.c
@@ -17,7 +17,7 @@
if (f == _stub)
{
- f = (errno_t __cdecl (*)(int, long long))
+ f = (void*)
GetProcAddress (__mingw_get_msvcrt_handle (), "_chsize_s");
if (!f)
f = _int_chsize_s;
diff --git a/mingw-w64-crt/secapi/_controlfp_s.c b/mingw-w64-crt/secapi/_controlfp_s.c
index 32be17c..afdcde1 100644
--- a/mingw-w64-crt/secapi/_controlfp_s.c
+++ b/mingw-w64-crt/secapi/_controlfp_s.c
@@ -45,7 +45,7 @@
if (f == _stub)
{
- f = (errno_t __cdecl (*)(unsigned int *, unsigned int, unsigned int))
+ f = (void*)
GetProcAddress (__mingw_get_msvcrt_handle (), "_controlfp_s");
if (!f)
f = _int_controlfp_s;
diff --git a/mingw-w64-crt/secapi/_ctime32_s.c b/mingw-w64-crt/secapi/_ctime32_s.c
index c59ccfc..c5e13ed 100644
--- a/mingw-w64-crt/secapi/_ctime32_s.c
+++ b/mingw-w64-crt/secapi/_ctime32_s.c
@@ -17,7 +17,7 @@
if (f == _stub)
{
- f = (errno_t __cdecl (*)(char *, size_t, const __time32_t *))
+ f = (void*)
GetProcAddress (__mingw_get_msvcrt_handle (), "_ctime32_s");
if (!f)
f = _int_ctime32_s;
diff --git a/mingw-w64-crt/secapi/_ctime64_s.c b/mingw-w64-crt/secapi/_ctime64_s.c
index 833d14a..46b2d9f 100644
--- a/mingw-w64-crt/secapi/_ctime64_s.c
+++ b/mingw-w64-crt/secapi/_ctime64_s.c
@@ -17,7 +17,7 @@
if (f == _stub)
{
- f = (errno_t __cdecl (*)(char *, size_t, const __time64_t *))
+ f = (void*)
GetProcAddress (__mingw_get_msvcrt_handle (), "_ctime64_s");
if (!f)
f = _int_ctime64_s;
diff --git a/mingw-w64-crt/secapi/_gmtime32_s.c b/mingw-w64-crt/secapi/_gmtime32_s.c
index 7139c24..0ef6a22 100644
--- a/mingw-w64-crt/secapi/_gmtime32_s.c
+++ b/mingw-w64-crt/secapi/_gmtime32_s.c
@@ -17,7 +17,7 @@
if (f == _stub)
{
- f = (errno_t __cdecl (*)(struct tm *, const __time32_t *))
+ f = (void*)
GetProcAddress (__mingw_get_msvcrt_handle (), "_gmtime32_s");
if (!f)
f = _int_gmtime32_s;
diff --git a/mingw-w64-crt/secapi/_gmtime64_s.c b/mingw-w64-crt/secapi/_gmtime64_s.c
index c4ca154..de36ffe 100644
--- a/mingw-w64-crt/secapi/_gmtime64_s.c
+++ b/mingw-w64-crt/secapi/_gmtime64_s.c
@@ -17,7 +17,7 @@
if (f == _stub)
{
- f = (errno_t __cdecl (*)(struct tm *, const __time64_t *))
+ f = (void*)
GetProcAddress (__mingw_get_msvcrt_handle (), "_gmtime64_s");
if (!f)
f = _int_gmtime64_s;
diff --git a/mingw-w64-crt/secapi/_localtime32_s.c b/mingw-w64-crt/secapi/_localtime32_s.c
index c8a62f6..9ec3540 100644
--- a/mingw-w64-crt/secapi/_localtime32_s.c
+++ b/mingw-w64-crt/secapi/_localtime32_s.c
@@ -17,7 +17,7 @@
if (f == _stub)
{
- f = (errno_t __cdecl (*)(struct tm *, const __time32_t *))
+ f = (void*)
GetProcAddress (__mingw_get_msvcrt_handle (), "_localtime32_s");
if (!f)
f = _int_localtime32_s;
diff --git a/mingw-w64-crt/secapi/_localtime64_s.c b/mingw-w64-crt/secapi/_localtime64_s.c
index bff0868..58dbb11 100644
--- a/mingw-w64-crt/secapi/_localtime64_s.c
+++ b/mingw-w64-crt/secapi/_localtime64_s.c
@@ -17,7 +17,7 @@
if (f == _stub)
{
- f = (errno_t __cdecl (*)(struct tm *, const __time64_t *))
+ f = (void*)
GetProcAddress (__mingw_get_msvcrt_handle (), "_localtime64_s");
if (!f)
f = _int_localtime64_s;
diff --git a/mingw-w64-crt/secapi/_mktemp_s.c b/mingw-w64-crt/secapi/_mktemp_s.c
index 01484d9..2a72acb 100644
--- a/mingw-w64-crt/secapi/_mktemp_s.c
+++ b/mingw-w64-crt/secapi/_mktemp_s.c
@@ -17,7 +17,7 @@
if (f == _stub)
{
- f = (errno_t __cdecl (*)(char *, size_t))
+ f = (void*)
GetProcAddress (__mingw_get_msvcrt_handle (), "_mktemp_s");
if (!f)
f = _int_mktemp_s;
diff --git a/mingw-w64-crt/secapi/_sopen_s.c b/mingw-w64-crt/secapi/_sopen_s.c
index b4f8f6a..6dc6f17 100644
--- a/mingw-w64-crt/secapi/_sopen_s.c
+++ b/mingw-w64-crt/secapi/_sopen_s.c
@@ -14,7 +14,7 @@
errno_t __cdecl (*f)(int *, const char *, int, int, int) = __MINGW_IMP_SYMBOL(_sopen_s);
if (f == _stub) {
- f = (errno_t __cdecl (*)(int *, const char *, int, int, int))
+ f = (void*)
GetProcAddress (__mingw_get_msvcrt_handle (), "_sopen_s");
if (f == NULL)
f = _int_sopen_s;
diff --git a/mingw-w64-crt/secapi/_strdate_s.c b/mingw-w64-crt/secapi/_strdate_s.c
index b62dec7..944057a 100644
--- a/mingw-w64-crt/secapi/_strdate_s.c
+++ b/mingw-w64-crt/secapi/_strdate_s.c
@@ -17,7 +17,7 @@
if (f == _stub)
{
- f = (errno_t __cdecl (*)(char *, size_t))
+ f = (void*)
GetProcAddress (__mingw_get_msvcrt_handle (), "_strdate_s");
if (!f)
f = _int_strdate_s;
diff --git a/mingw-w64-crt/secapi/_strtime_s.c b/mingw-w64-crt/secapi/_strtime_s.c
index b66e3f9..270ac42 100644
--- a/mingw-w64-crt/secapi/_strtime_s.c
+++ b/mingw-w64-crt/secapi/_strtime_s.c
@@ -17,7 +17,7 @@
if (f == _stub)
{
- f = (errno_t __cdecl (*)(char *, size_t))
+ f = (void*)
GetProcAddress (__mingw_get_msvcrt_handle (), "_strtime_s");
if (!f)
f = _int_strtime_s;
diff --git a/mingw-w64-crt/secapi/_umask_s.c b/mingw-w64-crt/secapi/_umask_s.c
index 75e8ddb..a13140d 100644
--- a/mingw-w64-crt/secapi/_umask_s.c
+++ b/mingw-w64-crt/secapi/_umask_s.c
@@ -17,7 +17,7 @@
if (f == _stub)
{
- f = (errno_t __cdecl (*)(int, int *))
+ f = (void*)
GetProcAddress (__mingw_get_msvcrt_handle (), "_umask_s");
if (!f)
f = _int_umask_s;
diff --git a/mingw-w64-crt/secapi/_vcprintf_s.c b/mingw-w64-crt/secapi/_vcprintf_s.c
index 91f143f..34eb451 100644
--- a/mingw-w64-crt/secapi/_vcprintf_s.c
+++ b/mingw-w64-crt/secapi/_vcprintf_s.c
@@ -17,7 +17,7 @@
if (f == _stub)
{
- f = (int __cdecl (*)(const char *, va_list))
+ f = (void*)
GetProcAddress (__mingw_get_msvcrt_handle (), "_vcprintf_s");
if (!f)
f = _int_vcprintf_s;
diff --git a/mingw-w64-crt/secapi/_vcprintf_s_l.c b/mingw-w64-crt/secapi/_vcprintf_s_l.c
index 787c76b..bad4904 100644
--- a/mingw-w64-crt/secapi/_vcprintf_s_l.c
+++ b/mingw-w64-crt/secapi/_vcprintf_s_l.c
@@ -17,7 +17,7 @@
if (f == _stub)
{
- f = (int __cdecl (*)(const char *, _locale_t, va_list))
+ f = (void*)
GetProcAddress (__mingw_get_msvcrt_handle (), "_vcprintf_s_l");
if (!f)
f = _int_vcprintf_s_l;
diff --git a/mingw-w64-crt/secapi/_vcwprintf_s.c b/mingw-w64-crt/secapi/_vcwprintf_s.c
index 325e866..0cddc52 100644
--- a/mingw-w64-crt/secapi/_vcwprintf_s.c
+++ b/mingw-w64-crt/secapi/_vcwprintf_s.c
@@ -17,7 +17,7 @@
if (f == _stub)
{
- f = (int __cdecl (*)(const wchar_t *, va_list))
+ f = (void*)
GetProcAddress (__mingw_get_msvcrt_handle (), "_vcwprintf_s");
if (!f)
f = _int_vcwprintf_s;
diff --git a/mingw-w64-crt/secapi/_vcwprintf_s_l.c b/mingw-w64-crt/secapi/_vcwprintf_s_l.c
index 4d112a1..978e546 100644
--- a/mingw-w64-crt/secapi/_vcwprintf_s_l.c
+++ b/mingw-w64-crt/secapi/_vcwprintf_s_l.c
@@ -17,7 +17,7 @@
if (f == _stub)
{
- f = (int __cdecl (*)(const wchar_t *, _locale_t, va_list))
+ f = (void*)
GetProcAddress (__mingw_get_msvcrt_handle (), "_vcwprintf_s_l");
if (!f)
f = _int_vcwprintf_s_l;
diff --git a/mingw-w64-crt/secapi/_waccess_s.c b/mingw-w64-crt/secapi/_waccess_s.c
index c4825cf..7957312 100644
--- a/mingw-w64-crt/secapi/_waccess_s.c
+++ b/mingw-w64-crt/secapi/_waccess_s.c
@@ -17,7 +17,7 @@
if (f == _stub)
{
- f = (errno_t __cdecl (*)(const wchar_t *, int))
+ f = (void*)
GetProcAddress (__mingw_get_msvcrt_handle (), "_waccess_s");
if (!f)
f = _int_waccess_s;
diff --git a/mingw-w64-crt/secapi/_wasctime_s.c b/mingw-w64-crt/secapi/_wasctime_s.c
index 6b414ee..fbc2804 100644
--- a/mingw-w64-crt/secapi/_wasctime_s.c
+++ b/mingw-w64-crt/secapi/_wasctime_s.c
@@ -17,7 +17,7 @@
if (f == _stub)
{
- f = (errno_t __cdecl (*)(wchar_t *, size_t, const struct tm *))
+ f = (void*)
GetProcAddress (__mingw_get_msvcrt_handle (), "_wasctime_s");
if (!f)
f = _int_wasctime_s;
diff --git a/mingw-w64-crt/secapi/_wctime32_s.c b/mingw-w64-crt/secapi/_wctime32_s.c
index 27c414b..42d4b8a 100644
--- a/mingw-w64-crt/secapi/_wctime32_s.c
+++ b/mingw-w64-crt/secapi/_wctime32_s.c
@@ -17,7 +17,7 @@
if (f == _stub)
{
- f = (errno_t __cdecl (*)(wchar_t *, size_t, const __time32_t *))
+ f = (void*)
GetProcAddress (__mingw_get_msvcrt_handle (), "_wctime32_s");
if (!f)
f = _int_wctime32_s;
diff --git a/mingw-w64-crt/secapi/_wctime64_s.c b/mingw-w64-crt/secapi/_wctime64_s.c
index bce40fd..860e5b4 100644
--- a/mingw-w64-crt/secapi/_wctime64_s.c
+++ b/mingw-w64-crt/secapi/_wctime64_s.c
@@ -17,7 +17,7 @@
if (f == _stub)
{
- f = (errno_t __cdecl (*)(wchar_t *, size_t, const __time64_t *))
+ f = (void*)
GetProcAddress (__mingw_get_msvcrt_handle (), "_wctime64_s");
if (!f)
f = _int_wctime64_s;
diff --git a/mingw-w64-crt/secapi/_wmktemp_s.c b/mingw-w64-crt/secapi/_wmktemp_s.c
index e13abc7..fc887f3 100644
--- a/mingw-w64-crt/secapi/_wmktemp_s.c
+++ b/mingw-w64-crt/secapi/_wmktemp_s.c
@@ -17,7 +17,7 @@
if (f == _stub)
{
- f = (errno_t __cdecl (*)(wchar_t *, size_t))
+ f = (void*)
GetProcAddress (__mingw_get_msvcrt_handle (), "_wmktemp_s");
if (!f)
f = _int_wmktemp_s;
diff --git a/mingw-w64-crt/secapi/_wstrdate_s.c b/mingw-w64-crt/secapi/_wstrdate_s.c
index e8ec1d4..3cd0c09 100644
--- a/mingw-w64-crt/secapi/_wstrdate_s.c
+++ b/mingw-w64-crt/secapi/_wstrdate_s.c
@@ -17,7 +17,7 @@
if (f == _stub)
{
- f = (errno_t __cdecl (*)(wchar_t *, size_t))
+ f = (void*)
GetProcAddress (__mingw_get_msvcrt_handle (), "_wstrdate_s");
if (!f)
f = _int_wstrdate_s;
diff --git a/mingw-w64-crt/secapi/_wstrtime_s.c b/mingw-w64-crt/secapi/_wstrtime_s.c
index ffb8a3e..a11211c 100644
--- a/mingw-w64-crt/secapi/_wstrtime_s.c
+++ b/mingw-w64-crt/secapi/_wstrtime_s.c
@@ -17,7 +17,7 @@
if (f == _stub)
{
- f = (errno_t __cdecl (*)(wchar_t *, size_t))
+ f = (void*)
GetProcAddress (__mingw_get_msvcrt_handle (), "_wstrtime_s");
if (!f)
f = _int_wstrtime_s;
diff --git a/mingw-w64-crt/secapi/asctime_s.c b/mingw-w64-crt/secapi/asctime_s.c
index aeb16e3..18a7aeb 100644
--- a/mingw-w64-crt/secapi/asctime_s.c
+++ b/mingw-w64-crt/secapi/asctime_s.c
@@ -17,7 +17,7 @@
if (f == _stub)
{
- f = (errno_t __cdecl (*)(char *, size_t, const struct tm *))
+ f = (void*)
GetProcAddress (__mingw_get_msvcrt_handle (), "asctime_s");
if (!f)
f = _int_asctime_s;
diff --git a/mingw-w64-crt/secapi/memcpy_s.c b/mingw-w64-crt/secapi/memcpy_s.c
index 013eff0..a206de3 100644
--- a/mingw-w64-crt/secapi/memcpy_s.c
+++ b/mingw-w64-crt/secapi/memcpy_s.c
@@ -16,7 +16,7 @@
if (f == _stub)
{
- f = (errno_t __cdecl (*)(void *, size_t, const void *, size_t))
+ f = (void*)
GetProcAddress (__mingw_get_msvcrt_handle (), "memcpy_s");
if (!f)
f = _int_memcpy_s;
diff --git a/mingw-w64-crt/secapi/memmove_s.c b/mingw-w64-crt/secapi/memmove_s.c
index dca1dbe..e5cee87 100644
--- a/mingw-w64-crt/secapi/memmove_s.c
+++ b/mingw-w64-crt/secapi/memmove_s.c
@@ -16,7 +16,7 @@
if (f == _stub)
{
- f = (errno_t __cdecl (*)(void *, size_t, const void *, size_t))
+ f = (void*)
GetProcAddress (__mingw_get_msvcrt_handle (), "memmove_s");
if (!f)
f = _int_memmove_s;
diff --git a/mingw-w64-crt/secapi/strerror_s.c b/mingw-w64-crt/secapi/strerror_s.c
index 1216c41..ea7148a 100644
--- a/mingw-w64-crt/secapi/strerror_s.c
+++ b/mingw-w64-crt/secapi/strerror_s.c
@@ -16,7 +16,7 @@
if (f == _stub)
{
- f = (errno_t __cdecl (*)(char *, size_t, int))
+ f = (void*)
GetProcAddress (__mingw_get_msvcrt_handle (), "strerror_s");
if (!f)
{
diff --git a/mingw-w64-crt/secapi/vsprintf_s.c b/mingw-w64-crt/secapi/vsprintf_s.c
index 45dfb14..dbb1c46 100644
--- a/mingw-w64-crt/secapi/vsprintf_s.c
+++ b/mingw-w64-crt/secapi/vsprintf_s.c
@@ -18,7 +18,7 @@
if (f == _stub)
{
- f = (int __cdecl (*)(char *, size_t, const char *, va_list))
+ f = (void*)
GetProcAddress (__mingw_get_msvcrt_handle (), "vsprintf_s");
if (!f)
f = _int_vsprintf_s;
diff --git a/mingw-w64-crt/secapi/wmemcpy_s.c b/mingw-w64-crt/secapi/wmemcpy_s.c
index 8387924..8276f28 100644
--- a/mingw-w64-crt/secapi/wmemcpy_s.c
+++ b/mingw-w64-crt/secapi/wmemcpy_s.c
@@ -17,7 +17,7 @@
if (f == _stub)
{
- f = (errno_t __cdecl (*)(wchar_t *, size_t, const wchar_t *, size_t))
+ f = (void*)
GetProcAddress (__mingw_get_msvcrt_handle (), "wmemcpy_s");
if (!f)
f = _int_wmemcpy_s;
diff --git a/mingw-w64-crt/secapi/wmemmove_s.c b/mingw-w64-crt/secapi/wmemmove_s.c
index 2e0d572..d9f09eb 100644
--- a/mingw-w64-crt/secapi/wmemmove_s.c
+++ b/mingw-w64-crt/secapi/wmemmove_s.c
@@ -17,7 +17,7 @@
if (f == _stub)
{
- f = (errno_t __cdecl (*)(wchar_t *, size_t, const wchar_t *, size_t))
+ f = (void*)
GetProcAddress (__mingw_get_msvcrt_handle (), "wmemmove_s");
if (!f)
f = _int_wmemmove_s;