v2 / vlib / v / gen / c / testdata / windows_clang_bootstrap_regression.c.must_have
24 lines · 24 sloc · 1.63 KB · 37513121a31460af1448cbe957f474d30e6f0516
Raw
1#if defined(_MSC_VER) && !defined(__clang__)
2#include <stdio.h>
3#elif defined(__MINGW32__) || defined(__MINGW64__) || (defined(__clang__) && (defined(_WIN32) || defined(_WIN64)))
4FILE* __cdecl __acrt_iob_func(unsigned index);
5#define stdout (__acrt_iob_func(1))
6#if (!defined(_MSC_VER) || defined(__clang__)) && !defined(__cplusplus)
7int V_CRT_CALL _fileno(FILE *stream);
8FILE * V_CRT_CALL _wfopen(const unsigned short *filename, const unsigned short *mode);
9int V_CRT_CALL _vscprintf(const char *format, va_list ap);
10int V_CRT_CALL _vsnprintf_s(char *buffer, size_t size, size_t count, const char *format, va_list ap);
11unsigned short * V_CRT_CALL _wgetenv(const unsigned short *varname);
12int V_CRT_CALL _wputenv(const unsigned short *envstring);
13int V_CRT_CALL _wremove(const unsigned short *path);
14#if defined(_MSC_VER) && !defined(__clang__)
15#define C__LONG LONG
16#define v_set_unhandled_exception_filter(handler) SetUnhandledExceptionFilter((LPTOP_LEVEL_EXCEPTION_FILTER)(handler))
17typedef C__LONG (VCALLCONV(stdcall) *TopLevelExceptionFilter)(ExceptionPointers*);
18VV_LOC C__LONG VCALLCONV(stdcall) builtin__unhandled_exception_handler(ExceptionPointers* e);
19v_set_unhandled_exception_filter(builtin__unhandled_exception_handler);
20u32 res = FormatMessageW(
21atomic_compare_exchange_weak_ptr(((voidptr)(&ch->adr_written)), ((voidptr)(&nulladr)), ((isize)(-1)))
22atomic_compare_exchange_strong_ptr(((voidptr)(&ch->write_adr)), ((voidptr)(&wradr)), ((isize)(0)))
23atomic_compare_exchange_weak_ptr(((voidptr)(&ch->adr_written)), ((voidptr)(&nulladr)), ((isize)(wradr)))
24atomic_compare_exchange_weak_ptr(((voidptr)(&ch->adr_read)), ((voidptr)(&nulladr)), ((isize)(rdadr)))
25