diff --git a/.travis.yml b/.travis.yml index 78a5c5a31e..83081dcc99 100644 --- a/.travis.yml +++ b/.travis.yml @@ -56,18 +56,10 @@ script: ./make.bat -gcc fi if [[ "${TRAVIS_JOB_NAME}" == "windows_msvc" ]]; then - exit echo "Building V with MSVC" export VFLAGS="-os msvc" ./make.bat -msvc fi - ./v.exe -o v2.exe compiler - ./v2.exe -o v3.exe compiler - ./v3.exe -o v4.exe compiler - ls -la v.exe - ls -la v2.exe - ls -la v3.exe - ls -la v4.exe ### running just repl_test.v produces failing results earlier and is easier to read echo "Running only the repl tests directly..." diff --git a/compiler/cheaders.v b/compiler/cheaders.v index 0705dc4bbc..ee69cae8af 100644 --- a/compiler/cheaders.v +++ b/compiler/cheaders.v @@ -43,6 +43,8 @@ CommonCHeaders = ' #define OPTION_CAST(x) (x) #ifdef _WIN32 +#undef EMPTY_STRUCT_INITIALIZATION +#define EMPTY_STRUCT_INITIALIZATION 0 #define WIN32_LEAN_AND_MEAN #include @@ -61,11 +63,9 @@ CommonCHeaders = ' // MSVC cannot parse some things properly #undef EMPTY_STRUCT_DECLARATION -#undef EMPTY_STRUCT_INITIALIZATION #undef OPTION_CAST #define EMPTY_STRUCT_DECLARATION int ____dummy_variable -#define EMPTY_STRUCT_INITIALIZATION 0 #define OPTION_CAST(x) #endif diff --git a/compiler/fn.v b/compiler/fn.v index f3c0090fa0..4271e7fca6 100644 --- a/compiler/fn.v +++ b/compiler/fn.v @@ -550,6 +550,7 @@ fn (p mut Parser) async_fn_call(f Fn, method_ph int, receiver_var, receiver_type if i < f.args.len - 1 { str_args += ',' } + did_gen_something = true continue } // Set the struct values (args) @@ -565,7 +566,7 @@ fn (p mut Parser) async_fn_call(f Fn, method_ph int, receiver_var, receiver_type if !did_gen_something { // Msvc doesnt like empty struct - arg_struct += 'EMPTY_STRUCT_DECLARATION' + arg_struct += 'EMPTY_STRUCT_DECLARATION;' } arg_struct += '} $arg_struct_name ;' diff --git a/compiler/gen_c.v b/compiler/gen_c.v index a41c876ec9..44bff72f8a 100644 --- a/compiler/gen_c.v +++ b/compiler/gen_c.v @@ -329,9 +329,6 @@ fn (p mut Parser) gen_struct_init(typ string, t Type) bool { } else { p.gen('($typ) {') - if t.fields.len == 1 && t.fields[0].name == '' && t.fields[0].typ.starts_with('EMPTY_STRUCT_DECLARATION') { - p.gen(' EMPTY_STRUCT_INITIALIZATION ') - } } } else { diff --git a/compiler/parser.v b/compiler/parser.v index 57a32412c9..2129467050 100644 --- a/compiler/parser.v +++ b/compiler/parser.v @@ -2835,8 +2835,8 @@ fn (p mut Parser) struct_init(typ string) string { if i != t.fields.len - 1 { p.gen(',') } + did_gen_something = true } - did_gen_something = true } } // Point{3,4} syntax @@ -2870,7 +2870,7 @@ fn (p mut Parser) struct_init(typ string) string { did_gen_something = true } if !did_gen_something { - p.gen('0') + p.gen('EMPTY_STRUCT_INITIALIZATION') } p.gen('}') if ptr && !p.is_js {