mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
fix Windows warnings
This commit is contained in:

committed by
Alexander Medvednikov

parent
e577b40743
commit
1dadf9d966
@ -103,7 +103,20 @@ fn (v mut V) cc() {
|
||||
}
|
||||
//linux_host := os.user_os() == 'linux'
|
||||
v.log('cc() isprod=$v.pref.is_prod outname=$v.out_name')
|
||||
mut a := [v.pref.cflags, '-std=gnu11', '-w'] // arguments for the C compiler
|
||||
// arguments for the C compiler
|
||||
mut a := [v.pref.cflags, '-std=gnu11',
|
||||
'-Wall',
|
||||
'-Wextra',
|
||||
// TODO : activate -Werror once no warnings remain
|
||||
// '-Werror',
|
||||
// TODO : try and remove the below workaround options when the corresponding
|
||||
// warnings are totally fixed/removed
|
||||
'-Wno-unused-variable',
|
||||
'-Wno-unused-but-set-variable',
|
||||
'-Wno-unused-parameter',
|
||||
'-Wno-unused-result',
|
||||
'-Wno-missing-braces',
|
||||
'-Wno-unused-label']
|
||||
|
||||
if v.pref.is_so {
|
||||
a << '-shared -fPIC '// -Wl,-z,defs'
|
||||
|
@ -89,6 +89,9 @@ c_headers = '
|
||||
|
||||
#ifdef _WIN32
|
||||
#define WINVER 0x0600
|
||||
#ifdef _WIN32_WINNT
|
||||
#undef _WIN32_WINNT
|
||||
#endif
|
||||
#define _WIN32_WINNT 0x0600
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define _UNICODE
|
||||
|
@ -646,9 +646,9 @@ fn (p mut Parser) async_fn_call(f Fn, method_ph int, receiver_var, receiver_type
|
||||
wrapper_name := '${fn_name}_thread_wrapper'
|
||||
mut wrapper_type := 'void*'
|
||||
if p.os == .windows {
|
||||
wrapper_type = 'void* __stdcall'
|
||||
wrapper_type = 'DWORD WINAPI'
|
||||
}
|
||||
wrapper_text := '$wrapper_type $wrapper_name($arg_struct_name * arg) {$fn_name( /*f*/$str_args ); return NULL; }'
|
||||
wrapper_text := '$wrapper_type $wrapper_name($arg_struct_name * arg) {$fn_name( /*f*/$str_args ); return 0; }'
|
||||
p.cgen.register_thread_fn(wrapper_name, wrapper_text, arg_struct)
|
||||
// Create thread object
|
||||
tmp_nr := p.get_tmp_counter()
|
||||
@ -663,7 +663,7 @@ fn (p mut Parser) async_fn_call(f Fn, method_ph int, receiver_var, receiver_type
|
||||
}
|
||||
// Call the wrapper
|
||||
if p.os == .windows {
|
||||
p.genln(' CreateThread(0,0, $wrapper_name, $parg, 0,0);')
|
||||
p.genln(' CreateThread(0,0, (LPTHREAD_START_ROUTINE)$wrapper_name, $parg, 0,0);')
|
||||
}
|
||||
else {
|
||||
p.genln('int $tmp2 = pthread_create(& $thread_name, NULL, (void *)$wrapper_name, $parg);')
|
||||
|
@ -4,7 +4,7 @@ import os
|
||||
|
||||
#flag windows -l shell32
|
||||
#flag windows -l dbghelp
|
||||
// RegOpenKeyExA etc
|
||||
// RegOpenKeyExW etc
|
||||
#flag windows -l advapi32
|
||||
|
||||
struct MsvcResult {
|
||||
|
Reference in New Issue
Block a user