From 0da00cc457215a9269c21b1f95e7691f9df0e64d Mon Sep 17 00:00:00 2001 From: JalonSolov Date: Mon, 20 Nov 2023 02:17:59 -0500 Subject: [PATCH] v: prepare for making `-W impure-v` the default (#19940) --- .github/workflows/linux_ci.yml | 4 ++-- .github/workflows/windows_ci.yml | 4 ++-- cmd/tools/modules/testing/common.v | 2 +- cmd/tools/vcomplete.v | 2 +- cmd/tools/vtest-self.v | 6 +++--- vlib/v/builder/compile.v | 6 +++++- vlib/v/checker/tests/modules/module_with_redeclaration.out | 6 +++--- ...redeclare_time_structs.v => redeclare_time_structs.c.v} | 0 vlib/v/eval/{expr.v => expr.c.v} | 0 vlib/v/gen/native/{readdll.v => readdll.c.v} | 0 vlib/v/gen/native/{stmt.v => stmt.c.v} | 0 vlib/v/live/{common.v => common.c.v} | 0 vlib/v/live/executable/{reloader.v => reloader.c.v} | 0 vlib/v/pref/{pref.v => pref.c.v} | 0 vlib/v/preludes/{test_runner.v => test_runner.c.v} | 0 vlib/v/preludes/test_runner_normal.v | 2 +- .../{keep_args_alive_test.v => keep_args_alive_test.c.v} | 2 +- vlib/v/slow_tests/valgrind/base64.v | 4 ++-- .../valgrind/{free_heap_foos.v => free_heap_foos.c.v} | 0 ...n.v => free_variables_in_reverse_order_of_creation.c.v} | 0 vlib/v/slow_tests/valgrind/valgrind_test.v | 7 ++++++- ...t.v => eq_operator_overload_of_c_struct_alias_test.c.v} | 0 ...ber_generation.v => bench_random_number_generation.c.v} | 0 vlib/v/tests/{c_array_test.v => c_array_test.c.v} | 0 .../c_function_mut_param/{code_test.v => code_test.c.v} | 0 .../{option_args_test.v => option_args_test.c.v} | 0 ...ree_property_test.v => c_struct_free_property_test.c.v} | 0 ...odroot_and_vroot_test.v => vmodroot_and_vroot_test.c.v} | 0 ...e_data_with_gc_test.v => closure_data_with_gc_test.c.v} | 2 +- .../create_dll/{create_win_dll.v => create_win_dll.c.v} | 0 vlib/v/tests/create_dll/create_win_dll_test.v | 2 +- vlib/v/tests/{cstrings_test.v => cstrings_test.c.v} | 0 .../{dump_c_struct_test.v => dump_c_struct_test.c.v} | 0 vlib/v/tests/{fn_test.v => fn_test.c.v} | 0 vlib/v/tests/generics_with_pointer_index_test.v | 4 ++-- vlib/v/tests/modules/sub/{foo.v => foo.c.v} | 0 vlib/v/tests/{option_test.v => option_test.c.v} | 0 ..._interpolation_test.v => string_interpolation_test.c.v} | 0 .../project_with_c_code/mod1/{wrapper.v => wrapper.c.v} | 0 .../project_with_c_code_2/modc/{wrapper.v => wrapper.c.v} | 0 vlib/v/tests/project_with_c_code_3/mod1/wrapper.js.v | 2 +- .../{ctimeifblock.v => ctimeifblock.c.v} | 0 ...compiling_cpp_files_with_a_cplusplus_compiler_test.c.v} | 0 vlib/v/tests/{unsafe_test.v => unsafe_test.c.v} | 0 vlib/v/trace_calls/{tracing_calls.v => tracing_calls.c.v} | 0 vlib/v/util/version/{version.v => version.c.v} | 0 vlib/v/vmod/vmod.v | 2 +- 47 files changed, 33 insertions(+), 24 deletions(-) rename vlib/v/checker/tests/modules/module_with_redeclaration/{redeclare_time_structs.v => redeclare_time_structs.c.v} (100%) rename vlib/v/eval/{expr.v => expr.c.v} (100%) rename vlib/v/gen/native/{readdll.v => readdll.c.v} (100%) rename vlib/v/gen/native/{stmt.v => stmt.c.v} (100%) rename vlib/v/live/{common.v => common.c.v} (100%) rename vlib/v/live/executable/{reloader.v => reloader.c.v} (100%) rename vlib/v/pref/{pref.v => pref.c.v} (100%) rename vlib/v/preludes/{test_runner.v => test_runner.c.v} (100%) rename vlib/v/slow_tests/{keep_args_alive_test.v => keep_args_alive_test.c.v} (96%) rename vlib/v/slow_tests/valgrind/{free_heap_foos.v => free_heap_foos.c.v} (100%) rename vlib/v/slow_tests/valgrind/{free_variables_in_reverse_order_of_creation.v => free_variables_in_reverse_order_of_creation.c.v} (100%) rename vlib/v/tests/aliasing_c_structs/{eq_operator_overload_of_c_struct_alias_test.v => eq_operator_overload_of_c_struct_alias_test.c.v} (100%) rename vlib/v/tests/bench/{bench_random_number_generation.v => bench_random_number_generation.c.v} (100%) rename vlib/v/tests/{c_array_test.v => c_array_test.c.v} (100%) rename vlib/v/tests/c_function_mut_param/{code_test.v => code_test.c.v} (100%) rename vlib/v/tests/c_function_mut_param/{option_args_test.v => option_args_test.c.v} (100%) rename vlib/v/tests/c_struct_free/{c_struct_free_property_test.v => c_struct_free_property_test.c.v} (100%) rename vlib/v/tests/cflags/{vmodroot_and_vroot_test.v => vmodroot_and_vroot_test.c.v} (100%) rename vlib/v/tests/{closure_data_with_gc_test.v => closure_data_with_gc_test.c.v} (93%) rename vlib/v/tests/create_dll/{create_win_dll.v => create_win_dll.c.v} (100%) rename vlib/v/tests/{cstrings_test.v => cstrings_test.c.v} (100%) rename vlib/v/tests/dump_c_structs/{dump_c_struct_test.v => dump_c_struct_test.c.v} (100%) rename vlib/v/tests/{fn_test.v => fn_test.c.v} (100%) rename vlib/v/tests/modules/sub/{foo.v => foo.c.v} (100%) rename vlib/v/tests/{option_test.v => option_test.c.v} (100%) rename vlib/v/tests/printing_c_structs/{string_interpolation_test.v => string_interpolation_test.c.v} (100%) rename vlib/v/tests/project_with_c_code/mod1/{wrapper.v => wrapper.c.v} (100%) rename vlib/v/tests/project_with_c_code_2/modc/{wrapper.v => wrapper.c.v} (100%) rename vlib/v/tests/project_with_c_code_ct_ifs/{ctimeifblock.v => ctimeifblock.c.v} (100%) rename vlib/v/tests/project_with_cpp_code/{compiling_cpp_files_with_a_cplusplus_compiler_test.v => compiling_cpp_files_with_a_cplusplus_compiler_test.c.v} (100%) rename vlib/v/tests/{unsafe_test.v => unsafe_test.c.v} (100%) rename vlib/v/trace_calls/{tracing_calls.v => tracing_calls.c.v} (100%) rename vlib/v/util/version/{version.v => version.c.v} (100%) diff --git a/.github/workflows/linux_ci.yml b/.github/workflows/linux_ci.yml index 63648b6afe..9927db59f6 100644 --- a/.github/workflows/linux_ci.yml +++ b/.github/workflows/linux_ci.yml @@ -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 diff --git a/.github/workflows/windows_ci.yml b/.github/workflows/windows_ci.yml index d79c7487ab..4069c19fa1 100644 --- a/.github/workflows/windows_ci.yml +++ b/.github/workflows/windows_ci.yml @@ -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 diff --git a/cmd/tools/modules/testing/common.v b/cmd/tools/modules/testing/common.v index c3f8c5da4c..c004380757 100644 --- a/cmd/tools/modules/testing/common.v +++ b/cmd/tools/modules/testing/common.v @@ -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' diff --git a/cmd/tools/vcomplete.v b/cmd/tools/vcomplete.v index 477e392dab..9aa7b43d1d 100644 --- a/cmd/tools/vcomplete.v +++ b/cmd/tools/vcomplete.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 diff --git a/cmd/tools/vtest-self.v b/cmd/tools/vtest-self.v index 2d410050eb..2e97a54c03 100644 --- a/cmd/tools/vtest-self.v +++ b/cmd/tools/vtest-self.v @@ -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' } } diff --git a/vlib/v/builder/compile.v b/vlib/v/builder/compile.v index 717c9b6f79..2fbc6b14e9 100644 --- a/vlib/v/builder/compile.v +++ b/vlib/v/builder/compile.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 { - user_files << os.join_path(preludes_path, 'test_runner.v') + 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 != '' { diff --git a/vlib/v/checker/tests/modules/module_with_redeclaration.out b/vlib/v/checker/tests/modules/module_with_redeclaration.out index 0f4635087a..73d3d60eff 100644 --- a/vlib/v/checker/tests/modules/module_with_redeclaration.out +++ b/vlib/v/checker/tests/modules/module_with_redeclaration.out @@ -1,5 +1,5 @@ -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 | - 3 | import sokol.memory + 2 | + 3 | import sokol.memory \ No newline at end of file diff --git a/vlib/v/checker/tests/modules/module_with_redeclaration/redeclare_time_structs.v b/vlib/v/checker/tests/modules/module_with_redeclaration/redeclare_time_structs.c.v similarity index 100% rename from vlib/v/checker/tests/modules/module_with_redeclaration/redeclare_time_structs.v rename to vlib/v/checker/tests/modules/module_with_redeclaration/redeclare_time_structs.c.v diff --git a/vlib/v/eval/expr.v b/vlib/v/eval/expr.c.v similarity index 100% rename from vlib/v/eval/expr.v rename to vlib/v/eval/expr.c.v diff --git a/vlib/v/gen/native/readdll.v b/vlib/v/gen/native/readdll.c.v similarity index 100% rename from vlib/v/gen/native/readdll.v rename to vlib/v/gen/native/readdll.c.v diff --git a/vlib/v/gen/native/stmt.v b/vlib/v/gen/native/stmt.c.v similarity index 100% rename from vlib/v/gen/native/stmt.v rename to vlib/v/gen/native/stmt.c.v diff --git a/vlib/v/live/common.v b/vlib/v/live/common.c.v similarity index 100% rename from vlib/v/live/common.v rename to vlib/v/live/common.c.v diff --git a/vlib/v/live/executable/reloader.v b/vlib/v/live/executable/reloader.c.v similarity index 100% rename from vlib/v/live/executable/reloader.v rename to vlib/v/live/executable/reloader.c.v diff --git a/vlib/v/pref/pref.v b/vlib/v/pref/pref.c.v similarity index 100% rename from vlib/v/pref/pref.v rename to vlib/v/pref/pref.c.v diff --git a/vlib/v/preludes/test_runner.v b/vlib/v/preludes/test_runner.c.v similarity index 100% rename from vlib/v/preludes/test_runner.v rename to vlib/v/preludes/test_runner.c.v diff --git a/vlib/v/preludes/test_runner_normal.v b/vlib/v/preludes/test_runner_normal.v index ec7842c419..3a01856047 100644 --- a/vlib/v/preludes/test_runner_normal.v +++ b/vlib/v/preludes/test_runner_normal.v @@ -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() { diff --git a/vlib/v/slow_tests/keep_args_alive_test.v b/vlib/v/slow_tests/keep_args_alive_test.c.v similarity index 96% rename from vlib/v/slow_tests/keep_args_alive_test.v rename to vlib/v/slow_tests/keep_args_alive_test.c.v index 8fb5320c11..93a036896d 100644 --- a/vlib/v/slow_tests/keep_args_alive_test.v +++ b/vlib/v/slow_tests/keep_args_alive_test.c.v @@ -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. */ diff --git a/vlib/v/slow_tests/valgrind/base64.v b/vlib/v/slow_tests/valgrind/base64.v index 20c7dc0e4b..23ab8efe3b 100644 --- a/vlib/v/slow_tests/valgrind/base64.v +++ b/vlib/v/slow_tests/valgrind/base64.v @@ -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 diff --git a/vlib/v/slow_tests/valgrind/free_heap_foos.v b/vlib/v/slow_tests/valgrind/free_heap_foos.c.v similarity index 100% rename from vlib/v/slow_tests/valgrind/free_heap_foos.v rename to vlib/v/slow_tests/valgrind/free_heap_foos.c.v diff --git a/vlib/v/slow_tests/valgrind/free_variables_in_reverse_order_of_creation.v b/vlib/v/slow_tests/valgrind/free_variables_in_reverse_order_of_creation.c.v similarity index 100% rename from vlib/v/slow_tests/valgrind/free_variables_in_reverse_order_of_creation.v rename to vlib/v/slow_tests/valgrind/free_variables_in_reverse_order_of_creation.c.v diff --git a/vlib/v/slow_tests/valgrind/valgrind_test.v b/vlib/v/slow_tests/valgrind/valgrind_test.v index 7a93aa6514..e9339fb690 100644 --- a/vlib/v/slow_tests/valgrind/valgrind_test.v +++ b/vlib/v/slow_tests/valgrind/valgrind_test.v @@ -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 ' + diff --git a/vlib/v/tests/aliasing_c_structs/eq_operator_overload_of_c_struct_alias_test.v b/vlib/v/tests/aliasing_c_structs/eq_operator_overload_of_c_struct_alias_test.c.v similarity index 100% rename from vlib/v/tests/aliasing_c_structs/eq_operator_overload_of_c_struct_alias_test.v rename to vlib/v/tests/aliasing_c_structs/eq_operator_overload_of_c_struct_alias_test.c.v diff --git a/vlib/v/tests/bench/bench_random_number_generation.v b/vlib/v/tests/bench/bench_random_number_generation.c.v similarity index 100% rename from vlib/v/tests/bench/bench_random_number_generation.v rename to vlib/v/tests/bench/bench_random_number_generation.c.v diff --git a/vlib/v/tests/c_array_test.v b/vlib/v/tests/c_array_test.c.v similarity index 100% rename from vlib/v/tests/c_array_test.v rename to vlib/v/tests/c_array_test.c.v diff --git a/vlib/v/tests/c_function_mut_param/code_test.v b/vlib/v/tests/c_function_mut_param/code_test.c.v similarity index 100% rename from vlib/v/tests/c_function_mut_param/code_test.v rename to vlib/v/tests/c_function_mut_param/code_test.c.v diff --git a/vlib/v/tests/c_function_mut_param/option_args_test.v b/vlib/v/tests/c_function_mut_param/option_args_test.c.v similarity index 100% rename from vlib/v/tests/c_function_mut_param/option_args_test.v rename to vlib/v/tests/c_function_mut_param/option_args_test.c.v diff --git a/vlib/v/tests/c_struct_free/c_struct_free_property_test.v b/vlib/v/tests/c_struct_free/c_struct_free_property_test.c.v similarity index 100% rename from vlib/v/tests/c_struct_free/c_struct_free_property_test.v rename to vlib/v/tests/c_struct_free/c_struct_free_property_test.c.v diff --git a/vlib/v/tests/cflags/vmodroot_and_vroot_test.v b/vlib/v/tests/cflags/vmodroot_and_vroot_test.c.v similarity index 100% rename from vlib/v/tests/cflags/vmodroot_and_vroot_test.v rename to vlib/v/tests/cflags/vmodroot_and_vroot_test.c.v diff --git a/vlib/v/tests/closure_data_with_gc_test.v b/vlib/v/tests/closure_data_with_gc_test.c.v similarity index 93% rename from vlib/v/tests/closure_data_with_gc_test.v rename to vlib/v/tests/closure_data_with_gc_test.c.v index c2bc9541ff..f436d3845f 100644 --- a/vlib/v/tests/closure_data_with_gc_test.v +++ b/vlib/v/tests/closure_data_with_gc_test.c.v @@ -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 ? { diff --git a/vlib/v/tests/create_dll/create_win_dll.v b/vlib/v/tests/create_dll/create_win_dll.c.v similarity index 100% rename from vlib/v/tests/create_dll/create_win_dll.v rename to vlib/v/tests/create_dll/create_win_dll.c.v diff --git a/vlib/v/tests/create_dll/create_win_dll_test.v b/vlib/v/tests/create_dll/create_win_dll_test.v index 6b368c3ed3..160469056c 100644 --- a/vlib/v/tests/create_dll/create_win_dll_test.v +++ b/vlib/v/tests/create_dll/create_win_dll_test.v @@ -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 diff --git a/vlib/v/tests/cstrings_test.v b/vlib/v/tests/cstrings_test.c.v similarity index 100% rename from vlib/v/tests/cstrings_test.v rename to vlib/v/tests/cstrings_test.c.v diff --git a/vlib/v/tests/dump_c_structs/dump_c_struct_test.v b/vlib/v/tests/dump_c_structs/dump_c_struct_test.c.v similarity index 100% rename from vlib/v/tests/dump_c_structs/dump_c_struct_test.v rename to vlib/v/tests/dump_c_structs/dump_c_struct_test.c.v diff --git a/vlib/v/tests/fn_test.v b/vlib/v/tests/fn_test.c.v similarity index 100% rename from vlib/v/tests/fn_test.v rename to vlib/v/tests/fn_test.c.v diff --git a/vlib/v/tests/generics_with_pointer_index_test.v b/vlib/v/tests/generics_with_pointer_index_test.v index 606b422359..ab31ea5ac6 100644 --- a/vlib/v/tests/generics_with_pointer_index_test.v +++ b/vlib/v/tests/generics_with_pointer_index_test.v @@ -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 diff --git a/vlib/v/tests/modules/sub/foo.v b/vlib/v/tests/modules/sub/foo.c.v similarity index 100% rename from vlib/v/tests/modules/sub/foo.v rename to vlib/v/tests/modules/sub/foo.c.v diff --git a/vlib/v/tests/option_test.v b/vlib/v/tests/option_test.c.v similarity index 100% rename from vlib/v/tests/option_test.v rename to vlib/v/tests/option_test.c.v diff --git a/vlib/v/tests/printing_c_structs/string_interpolation_test.v b/vlib/v/tests/printing_c_structs/string_interpolation_test.c.v similarity index 100% rename from vlib/v/tests/printing_c_structs/string_interpolation_test.v rename to vlib/v/tests/printing_c_structs/string_interpolation_test.c.v diff --git a/vlib/v/tests/project_with_c_code/mod1/wrapper.v b/vlib/v/tests/project_with_c_code/mod1/wrapper.c.v similarity index 100% rename from vlib/v/tests/project_with_c_code/mod1/wrapper.v rename to vlib/v/tests/project_with_c_code/mod1/wrapper.c.v diff --git a/vlib/v/tests/project_with_c_code_2/modc/wrapper.v b/vlib/v/tests/project_with_c_code_2/modc/wrapper.c.v similarity index 100% rename from vlib/v/tests/project_with_c_code_2/modc/wrapper.v rename to vlib/v/tests/project_with_c_code_2/modc/wrapper.c.v diff --git a/vlib/v/tests/project_with_c_code_3/mod1/wrapper.js.v b/vlib/v/tests/project_with_c_code_3/mod1/wrapper.js.v index 2897d17af8..826a6fedd7 100644 --- a/vlib/v/tests/project_with_c_code_3/mod1/wrapper.js.v +++ b/vlib/v/tests/project_with_c_code_3/mod1/wrapper.js.v @@ -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 } diff --git a/vlib/v/tests/project_with_c_code_ct_ifs/ctimeifblock.v b/vlib/v/tests/project_with_c_code_ct_ifs/ctimeifblock.c.v similarity index 100% rename from vlib/v/tests/project_with_c_code_ct_ifs/ctimeifblock.v rename to vlib/v/tests/project_with_c_code_ct_ifs/ctimeifblock.c.v diff --git a/vlib/v/tests/project_with_cpp_code/compiling_cpp_files_with_a_cplusplus_compiler_test.v b/vlib/v/tests/project_with_cpp_code/compiling_cpp_files_with_a_cplusplus_compiler_test.c.v similarity index 100% rename from vlib/v/tests/project_with_cpp_code/compiling_cpp_files_with_a_cplusplus_compiler_test.v rename to vlib/v/tests/project_with_cpp_code/compiling_cpp_files_with_a_cplusplus_compiler_test.c.v diff --git a/vlib/v/tests/unsafe_test.v b/vlib/v/tests/unsafe_test.c.v similarity index 100% rename from vlib/v/tests/unsafe_test.v rename to vlib/v/tests/unsafe_test.c.v diff --git a/vlib/v/trace_calls/tracing_calls.v b/vlib/v/trace_calls/tracing_calls.c.v similarity index 100% rename from vlib/v/trace_calls/tracing_calls.v rename to vlib/v/trace_calls/tracing_calls.c.v diff --git a/vlib/v/util/version/version.v b/vlib/v/util/version/version.c.v similarity index 100% rename from vlib/v/util/version/version.v rename to vlib/v/util/version/version.c.v diff --git a/vlib/v/vmod/vmod.v b/vlib/v/vmod/vmod.v index a88d23ae62..24df3772b4 100644 --- a/vlib/v/vmod/vmod.v +++ b/vlib/v/vmod/vmod.v @@ -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'}