zig/lib/libc/mingw/secapi/vsprintf_s.c
Andrew Kelley 7c93d9aacb mingw-w64: patch to silence implicit-function-declaration warnings
Closes #7356

I did this as a patch to the source rather than passing flags so that
it would intentionally be reverted when we update to the next release of
mingw-w64. At this time if any warnings are still emitted we should find
out why and make sure upstream is aware of the problem.
2020-12-09 16:12:03 -07:00

45 lines
1.3 KiB
C

#include <windows.h>
#include <malloc.h>
#include <errno.h>
#include <msvcrt.h>
#include <stdio.h>
#include <sec_api/stdio_s.h>
static int __cdecl _int_vsprintf_s (char *, size_t, const char *, va_list);
static int __cdecl _stub (char *, size_t, const char *, va_list);
int __cdecl (*__MINGW_IMP_SYMBOL(vsprintf_s))(char *, size_t, const char *, va_list) =
_stub;
static int __cdecl
_stub (char *_DstBuf, size_t _Size, const char *_Format, va_list _ArgList)
{
int __cdecl (*f)(char *, size_t, const char *, va_list) = __MINGW_IMP_SYMBOL(vsprintf_s);
if (f == _stub)
{
f = (int __cdecl (*)(char *, size_t, const char *, va_list))
GetProcAddress (__mingw_get_msvcrt_handle (), "vsprintf_s");
if (!f)
f = _int_vsprintf_s;
__MINGW_IMP_SYMBOL(vsprintf_s) = f;
}
return (*f)(_DstBuf, _Size, _Format, _ArgList);
}
int __cdecl
vsprintf_s (char *_DstBuf, size_t _Size, const char *_Format, va_list _ArgList)
{
return _stub (_DstBuf, _Size, _Format, _ArgList);
}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-function-declaration"
static int __cdecl
_int_vsprintf_s (char *_DstBuf, size_t _Size, const char *_Format, va_list _ArgList)
{
return __ms_vsnprintf (_DstBuf, _Size, _Format, _ArgList);
}
#pragma clang diagnostic pop