compiler: fix msvc empty struct & enable travis msvc
parent
5f43a61e0d
commit
cbd4478b5e
|
@ -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..."
|
||||
|
|
|
@ -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 <windows.h>
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
|
|
@ -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 ;'
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -2835,10 +2835,10 @@ fn (p mut Parser) struct_init(typ string) string {
|
|||
if i != t.fields.len - 1 {
|
||||
p.gen(',')
|
||||
}
|
||||
}
|
||||
did_gen_something = true
|
||||
}
|
||||
}
|
||||
}
|
||||
// Point{3,4} syntax
|
||||
else {
|
||||
mut T := p.table.find_type(typ)
|
||||
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue