mirror of
https://github.com/vlang/v.git
synced 2025-09-13 22:42:26 +03:00
v: prepare for making -W impure-v
the default (#19940)
This commit is contained in:
parent
6cc51f254f
commit
0da00cc457
47 changed files with 33 additions and 24 deletions
4
.github/workflows/linux_ci.yml
vendored
4
.github/workflows/linux_ci.yml
vendored
|
@ -203,8 +203,8 @@ jobs:
|
|||
run: ./v -autofree -o tetris examples/tetris/tetris.v
|
||||
- name: Build blog tutorial with -autofree
|
||||
run: ./v -autofree -o blog tutorials/building_a_simple_web_blog_with_vweb/code/blog
|
||||
- name: Build option_test.v with -autofree
|
||||
run: ./v -autofree vlib/v/tests/option_test.v
|
||||
- name: Build option_test.c.v with -autofree
|
||||
run: ./v -autofree vlib/v/tests/option_test.c.v
|
||||
- name: V self compilation with -parallel-cc
|
||||
run: |
|
||||
./v -o v2 -parallel-cc cmd/v
|
||||
|
|
4
.github/workflows/windows_ci.yml
vendored
4
.github/workflows/windows_ci.yml
vendored
|
@ -41,8 +41,8 @@ jobs:
|
|||
run: .\v.exe test-self
|
||||
# - name: Test
|
||||
# run: .\v.exe test-all
|
||||
- name: Build option_test.v with -autofree
|
||||
run: .\v.exe -autofree vlib/v/tests/option_test.v
|
||||
- name: Build option_test.c.v with -autofree
|
||||
run: .\v.exe -autofree vlib/v/tests/option_test.c.v
|
||||
- name: Test v->js
|
||||
run: ./v -o hi.js examples/hello_v_js.v && node hi.js
|
||||
- name: Test v binaries
|
||||
|
|
|
@ -204,7 +204,7 @@ pub fn new_test_session(_vargs string, will_compile bool) TestSession {
|
|||
skip_files << 'examples/coroutines/coroutines_bench.v'
|
||||
$if msvc {
|
||||
skip_files << 'vlib/v/tests/const_comptime_eval_before_vinit_test.v' // _constructor used
|
||||
skip_files << 'vlib/v/tests/project_with_cpp_code/compiling_cpp_files_with_a_cplusplus_compiler_test.v'
|
||||
skip_files << 'vlib/v/tests/project_with_cpp_code/compiling_cpp_files_with_a_cplusplus_compiler_test.c.v'
|
||||
}
|
||||
$if solaris {
|
||||
skip_files << 'examples/gg/gg2.v'
|
||||
|
|
|
@ -74,7 +74,7 @@ SUBCMD:
|
|||
powershell: [QUERY] - returns PowerShell compatible completion code with completions computed from QUERY"
|
||||
)
|
||||
|
||||
// Snooped from cmd/v/v.v, vlib/v/pref/pref.v
|
||||
// Snooped from cmd/v/v.v, vlib/v/pref/pref.c.v
|
||||
const (
|
||||
auto_complete_commands = [
|
||||
// simple_cmd
|
||||
|
|
|
@ -180,7 +180,7 @@ const (
|
|||
'vlib/v/tests/orm_enum_test.v',
|
||||
'vlib/v/tests/orm_sub_array_struct_test.v',
|
||||
'vlib/v/tests/orm_handle_error_for_select_from_not_created_table_test.v',
|
||||
'vlib/v/tests/project_with_cpp_code/compiling_cpp_files_with_a_cplusplus_compiler_test.v', // fails compilation with: undefined reference to vtable for __cxxabiv1::__function_type_info'
|
||||
'vlib/v/tests/project_with_cpp_code/compiling_cpp_files_with_a_cplusplus_compiler_test.c.v', // fails compilation with: undefined reference to vtable for __cxxabiv1::__function_type_info'
|
||||
]
|
||||
skip_with_werror = [
|
||||
'do_not_remove',
|
||||
|
@ -259,7 +259,7 @@ const (
|
|||
'vlib/v/tests/const_and_global_with_same_name_test.v', // error C2099: initializer is not a constant
|
||||
'vlib/v/tests/sumtype_as_cast_1_test.v', // error: cannot support compound statement expression ({expr; expr; expr;})
|
||||
'vlib/v/tests/sumtype_as_cast_2_test.v', // error: cannot support compound statement expression ({expr; expr; expr;})
|
||||
'vlib/v/tests/project_with_cpp_code/compiling_cpp_files_with_a_cplusplus_compiler_test.v', // TODO
|
||||
'vlib/v/tests/project_with_cpp_code/compiling_cpp_files_with_a_cplusplus_compiler_test.c.v', // TODO
|
||||
]
|
||||
skip_on_windows = [
|
||||
'do_not_remove',
|
||||
|
@ -350,7 +350,7 @@ fn main() {
|
|||
|
||||
$if windows {
|
||||
if github_job == 'tcc' {
|
||||
tsession.skip_files << 'vlib/v/tests/project_with_cpp_code/compiling_cpp_files_with_a_cplusplus_compiler_test.v'
|
||||
tsession.skip_files << 'vlib/v/tests/project_with_cpp_code/compiling_cpp_files_with_a_cplusplus_compiler_test.c.v'
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -308,7 +308,11 @@ pub fn (v &Builder) get_user_files() []string {
|
|||
user_files << os.join_path(preludes_path, 'live_shared.v')
|
||||
}
|
||||
if v.pref.is_test {
|
||||
if v.pref.backend == .js_node {
|
||||
user_files << os.join_path(preludes_path, 'test_runner.v')
|
||||
} else {
|
||||
user_files << os.join_path(preludes_path, 'test_runner.c.v')
|
||||
}
|
||||
//
|
||||
mut v_test_runner_prelude := os.getenv('VTEST_RUNNER')
|
||||
if v.pref.test_runner != '' {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
vlib/v/checker/tests/modules/module_with_redeclaration/redeclare_time_structs.v:1:1: error: project must include a `main` module or be a shared library (compile with `v -shared`)
|
||||
vlib/v/checker/tests/modules/module_with_redeclaration/redeclare_time_structs.c.v:1:1: error: project must include a `main` module or be a shared library (compile with `v -shared`)
|
||||
1 | module module_with_redeclaration
|
||||
| ^
|
||||
2 |
|
||||
|
|
|
@ -7,7 +7,7 @@ import term
|
|||
// This file gets compiled as part of the main program, for
|
||||
// each _test.v file. It implements the default/normal test
|
||||
// output for `v run file_test.v`
|
||||
// See also test_runner.v .
|
||||
// See also test_runner.c.v .
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
fn vtest_init() {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* To verify the effect of "[keep_args_alive]", this attribute may be commented out.
|
||||
* However it is not guaranteed that then this test will fail.
|
||||
* To provoke a failure it seems to be best to use `gcc` with optimization:
|
||||
* `gcc -gc boehm -cc gcc-9 -prod test keep_args_alive_test.v`.
|
||||
* `gcc -gc boehm -cc gcc-9 -prod test keep_args_alive_test.c.v`.
|
||||
* Without optimization, pointer variables may remain on the stack even if
|
||||
* not used any more.
|
||||
*/
|
|
@ -21,7 +21,7 @@ fn main() {
|
|||
//
|
||||
encoded_size := base64.encode_in_buffer(s_original, ebuffer)
|
||||
mut encoded_in_buf := []u8{len: encoded_size}
|
||||
unsafe { C.memcpy(encoded_in_buf.data, ebuffer, encoded_size) }
|
||||
unsafe { vmemcpy(encoded_in_buf.data, ebuffer, encoded_size) }
|
||||
assert input_size * 4 / 3 == encoded_size
|
||||
assert encoded_in_buf[0] == `Y`
|
||||
assert encoded_in_buf[1] == `W`
|
||||
|
@ -38,7 +38,7 @@ fn main() {
|
|||
decoded_size := base64.decode_in_buffer(s_encoded, dbuffer)
|
||||
assert decoded_size == input_size
|
||||
mut decoded_in_buf := []u8{len: decoded_size}
|
||||
unsafe { C.memcpy(decoded_in_buf.data, dbuffer, decoded_size) }
|
||||
unsafe { vmemcpy(decoded_in_buf.data, dbuffer, decoded_size) }
|
||||
assert decoded_in_buf == s_original
|
||||
|
||||
mut s := 0
|
||||
|
|
|
@ -84,7 +84,12 @@ fn test_all() {
|
|||
}
|
||||
}
|
||||
//
|
||||
base_filename := os.file_name(test).replace('.v', '')
|
||||
mut base_filename := os.file_name(test)
|
||||
if base_filename.ends_with('.c.v') {
|
||||
base_filename = base_filename#[..-4]
|
||||
} else if base_filename.ends_with('.v') {
|
||||
base_filename = base_filename#[..-2]
|
||||
}
|
||||
exe_filename := '${wrkdir}/${base_filename}'
|
||||
full_path_to_source_file := os.join_path(vroot, test)
|
||||
compile_cmd := '${os.quoted_path(vexe)} -o ${os.quoted_path(exe_filename)} -cg -cflags ' +
|
||||
|
|
|
@ -16,7 +16,7 @@ fn test_closure_data_is_kept_alive() {
|
|||
for _ in 0 .. 1000 {
|
||||
unsafe {
|
||||
p := malloc(8)
|
||||
C.memset(p, 0x33, 8)
|
||||
vmemset(p, 0x33, 8)
|
||||
}
|
||||
}
|
||||
$if gcboehm ? {
|
|
@ -16,7 +16,7 @@ fn run_test(cc_used string) {
|
|||
else { '' }
|
||||
}
|
||||
|
||||
assert os.system('${os.quoted_path(@VEXE)} ${cc_flag} -o create_win_${cc_used}.dll -shared create_win_dll.v') == 0
|
||||
assert os.system('${os.quoted_path(@VEXE)} ${cc_flag} -o create_win_${cc_used}.dll -shared create_win_dll.c.v') == 0
|
||||
assert os.exists('create_win_${cc_used}.dll')
|
||||
handle := dl.open('create_win_${cc_used}.dll', 0)
|
||||
assert handle != 0
|
||||
|
|
|
@ -12,8 +12,8 @@ mut:
|
|||
}
|
||||
|
||||
pub fn with_cap[T](cap int) Vec[T] {
|
||||
new_data := unsafe { C.malloc(cap * int(sizeof(T))) }
|
||||
unsafe { C.memset(new_data, 0, cap * int(sizeof(T))) }
|
||||
new_data := unsafe { malloc(cap * int(sizeof(T))) }
|
||||
unsafe { vmemset(new_data, 0, cap * int(sizeof(T))) }
|
||||
|
||||
return Vec[T]{
|
||||
data: new_data
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module mod1
|
||||
|
||||
// Note: the function here, overrides the one from wrapper.v
|
||||
// Note: the function here, overrides the one from wrapper.c.v
|
||||
pub fn vadd(a int, b int) int {
|
||||
return 2003
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ pub fn get_cache() &ModFileCacher {
|
|||
// examples/hanoi.v
|
||||
// vlib/v.mod
|
||||
// vlib/v/tests/project_with_c_code/mod1/v.mod
|
||||
// vlib/v/tests/project_with_c_code/mod1/wrapper.v
|
||||
// vlib/v/tests/project_with_c_code/mod1/wrapper.c.v
|
||||
// -----------------
|
||||
// ModFileCacher.get('examples')
|
||||
// => ModFileAndFolder{'', 'examples'}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue