aboutsummaryrefslogtreecommitdiff
path: root/system/include/libcxx/support/win32/support.h
diff options
context:
space:
mode:
Diffstat (limited to 'system/include/libcxx/support/win32/support.h')
-rw-r--r--system/include/libcxx/support/win32/support.h21
1 files changed, 10 insertions, 11 deletions
diff --git a/system/include/libcxx/support/win32/support.h b/system/include/libcxx/support/win32/support.h
index 0b8a912a..17abb915 100644
--- a/system/include/libcxx/support/win32/support.h
+++ b/system/include/libcxx/support/win32/support.h
@@ -15,26 +15,23 @@
Functions and constants used in libc++ that are missing from the Windows C library.
*/
-#include <__config>
-#include <wchar.h> // mbstate_t
-#include <stdio.h> // _snwprintf
+#include <cwchar> // mbstate_t
+#include <cstdarg> // va_ macros
#define swprintf _snwprintf
#define vswprintf _vsnwprintf
-#define vfscnaf fscanf
-int vasprintf( char **sptr, const char *__restrict fmt , va_list ap );
-int asprintf( char **sptr, const char *__restrict fmt, ...);
-//int vfscanf( FILE *__restrict stream, const char *__restrict format,
-// va_list arg);
+extern "C" {
+int vasprintf( char **sptr, const char *__restrict fmt, va_list ap );
+int asprintf( char **sptr, const char *__restrict fmt, ...);
size_t mbsnrtowcs( wchar_t *__restrict dst, const char **__restrict src,
size_t nmc, size_t len, mbstate_t *__restrict ps );
size_t wcsnrtombs( char *__restrict dst, const wchar_t **__restrict src,
size_t nwc, size_t len, mbstate_t *__restrict ps );
+}
-#if defined(_MSC_VER)
+#if defined(_LIBCPP_MSVCRT)
#define snprintf _snprintf
-
#include <xlocinfo.h>
#define atoll _atoi64
#define strtoll _strtoi64
@@ -85,9 +82,11 @@ _LIBCPP_ALWAYS_INLINE int __builtin_ctz( unsigned int x )
_BitScanReverse(&r, x);
return static_cast<int>(r);
}
+
// sizeof(long) == sizeof(int) on Windows
_LIBCPP_ALWAYS_INLINE int __builtin_ctzl( unsigned long x )
{ return __builtin_ctz( static_cast<int>(x) ); }
+
_LIBCPP_ALWAYS_INLINE int __builtin_ctzll( unsigned long long x )
{
DWORD r = 0;
@@ -110,6 +109,6 @@ _LIBCPP_ALWAYS_INLINE int __builtin_clzll( unsigned long long x )
return static_cast<int>(r);
}
#endif // !__clang__
-#endif // _MSC_VER
+#endif // _LIBCPP_MSVCRT
#endif // _LIBCPP_SUPPORT_WIN32_SUPPORT_H