1
0
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:
Nicolas Sauzede
2019-11-16 00:30:50 +01:00
committed by Alexander Medvednikov
parent e577b40743
commit 1dadf9d966
13 changed files with 92 additions and 61 deletions

View File

@ -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'

View File

@ -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

View File

@ -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);')

View File

@ -4,7 +4,7 @@ import os
#flag windows -l shell32
#flag windows -l dbghelp
// RegOpenKeyExA etc
// RegOpenKeyExW etc
#flag windows -l advapi32
struct MsvcResult {