mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
Change CGen so that v.c is compileable with msvc
This commit is contained in:
committed by
Alexander Medvednikov
parent
41f4ec5a3b
commit
049d78a78d
@@ -189,6 +189,10 @@ fn (v mut V) compile() {
|
||||
#include <stdarg.h> // for va_list
|
||||
#include <inttypes.h> // int64_t etc
|
||||
|
||||
#define STRUCT_DEFAULT_VALUE {}
|
||||
#define EMPTY_STRUCT_DECLARATION
|
||||
#define EMPTY_STRUCT_INIT
|
||||
#define OPTION_CAST(x) (x)
|
||||
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
@@ -201,6 +205,15 @@ fn (v mut V) compile() {
|
||||
#ifdef _MSC_VER
|
||||
// On MSVC these are the same (as long as /volatile:ms is passed)
|
||||
#define _Atomic volatile
|
||||
|
||||
// MSVC can\'t parse some things properly
|
||||
#undef STRUCT_DEFAULT_VALUE
|
||||
#define STRUCT_DEFAULT_VALUE {0}
|
||||
#undef EMPTY_STRUCT_DECLARATION
|
||||
#define EMPTY_STRUCT_DECLARATION void *____dummy_variable;
|
||||
#undef EMPTY_STRUCT_INIT
|
||||
#define EMPTY_STRUCT_INIT 0
|
||||
#define OPTION_CAST(x)
|
||||
#endif
|
||||
|
||||
void pthread_mutex_lock(HANDLE *m) {
|
||||
|
||||
Reference in New Issue
Block a user