compiler: fix msvc empty struct & enable travis msvc
parent
5f43a61e0d
commit
cbd4478b5e
|
@ -56,18 +56,10 @@ script:
|
||||||
./make.bat -gcc
|
./make.bat -gcc
|
||||||
fi
|
fi
|
||||||
if [[ "${TRAVIS_JOB_NAME}" == "windows_msvc" ]]; then
|
if [[ "${TRAVIS_JOB_NAME}" == "windows_msvc" ]]; then
|
||||||
exit
|
|
||||||
echo "Building V with MSVC"
|
echo "Building V with MSVC"
|
||||||
export VFLAGS="-os msvc"
|
export VFLAGS="-os msvc"
|
||||||
./make.bat -msvc
|
./make.bat -msvc
|
||||||
fi
|
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
|
### running just repl_test.v produces failing results earlier and is easier to read
|
||||||
echo "Running only the repl tests directly..."
|
echo "Running only the repl tests directly..."
|
||||||
|
|
|
@ -43,6 +43,8 @@ CommonCHeaders = '
|
||||||
#define OPTION_CAST(x) (x)
|
#define OPTION_CAST(x) (x)
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
#undef EMPTY_STRUCT_INITIALIZATION
|
||||||
|
#define EMPTY_STRUCT_INITIALIZATION 0
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
|
@ -61,11 +63,9 @@ CommonCHeaders = '
|
||||||
|
|
||||||
// MSVC cannot parse some things properly
|
// MSVC cannot parse some things properly
|
||||||
#undef EMPTY_STRUCT_DECLARATION
|
#undef EMPTY_STRUCT_DECLARATION
|
||||||
#undef EMPTY_STRUCT_INITIALIZATION
|
|
||||||
#undef OPTION_CAST
|
#undef OPTION_CAST
|
||||||
|
|
||||||
#define EMPTY_STRUCT_DECLARATION int ____dummy_variable
|
#define EMPTY_STRUCT_DECLARATION int ____dummy_variable
|
||||||
#define EMPTY_STRUCT_INITIALIZATION 0
|
|
||||||
#define OPTION_CAST(x)
|
#define OPTION_CAST(x)
|
||||||
#endif
|
#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 {
|
if i < f.args.len - 1 {
|
||||||
str_args += ','
|
str_args += ','
|
||||||
}
|
}
|
||||||
|
did_gen_something = true
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// Set the struct values (args)
|
// 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 {
|
if !did_gen_something {
|
||||||
// Msvc doesnt like empty struct
|
// Msvc doesnt like empty struct
|
||||||
arg_struct += 'EMPTY_STRUCT_DECLARATION'
|
arg_struct += 'EMPTY_STRUCT_DECLARATION;'
|
||||||
}
|
}
|
||||||
|
|
||||||
arg_struct += '} $arg_struct_name ;'
|
arg_struct += '} $arg_struct_name ;'
|
||||||
|
|
|
@ -329,9 +329,6 @@ fn (p mut Parser) gen_struct_init(typ string, t Type) bool {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
p.gen('($typ) {')
|
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 {
|
else {
|
||||||
|
|
|
@ -2835,8 +2835,8 @@ fn (p mut Parser) struct_init(typ string) string {
|
||||||
if i != t.fields.len - 1 {
|
if i != t.fields.len - 1 {
|
||||||
p.gen(',')
|
p.gen(',')
|
||||||
}
|
}
|
||||||
|
did_gen_something = true
|
||||||
}
|
}
|
||||||
did_gen_something = true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Point{3,4} syntax
|
// Point{3,4} syntax
|
||||||
|
@ -2870,7 +2870,7 @@ fn (p mut Parser) struct_init(typ string) string {
|
||||||
did_gen_something = true
|
did_gen_something = true
|
||||||
}
|
}
|
||||||
if !did_gen_something {
|
if !did_gen_something {
|
||||||
p.gen('0')
|
p.gen('EMPTY_STRUCT_INITIALIZATION')
|
||||||
}
|
}
|
||||||
p.gen('}')
|
p.gen('}')
|
||||||
if ptr && !p.is_js {
|
if ptr && !p.is_js {
|
||||||
|
|
Loading…
Reference in New Issue