v.markused: mark all `pub` functions on `-shared -skip-unused`
parent
d7a64bbc8a
commit
8193efb379
|
@ -11,20 +11,19 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
fn test_vexe() {
|
fn test_vexe() {
|
||||||
dump(vexe)
|
// dump(vexe)
|
||||||
assert vexe != ''
|
assert vexe != ''
|
||||||
dump(os.executable())
|
// dump(os.executable())
|
||||||
dump(@FILE)
|
// dump(@FILE)
|
||||||
dump(cfolder)
|
// dump(cfolder)
|
||||||
dump(so_ext)
|
// dump(so_ext)
|
||||||
dump(library_file_name)
|
// dump(library_file_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_can_compile_library() {
|
fn test_can_compile_library() {
|
||||||
os.chdir(cfolder)
|
os.chdir(cfolder)
|
||||||
os.rm(library_file_name) or { }
|
os.rm(library_file_name) or {}
|
||||||
res := v_compile('-d no_backtrace -o library -shared modules/library/library.v')
|
v_compile('-d no_backtrace -o library -shared modules/library/library.v')
|
||||||
dump(res)
|
|
||||||
assert os.is_file(library_file_name)
|
assert os.is_file(library_file_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,21 +31,26 @@ fn test_can_compile_main_program() {
|
||||||
os.chdir(cfolder)
|
os.chdir(cfolder)
|
||||||
assert os.is_file(library_file_name)
|
assert os.is_file(library_file_name)
|
||||||
result := v_compile('run use.v')
|
result := v_compile('run use.v')
|
||||||
dump(result)
|
// dump(result)
|
||||||
assert result.output.contains('res: 4')
|
assert result.output.contains('res: 4')
|
||||||
os.rm(library_file_name) or { }
|
os.rm(library_file_name) or {}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn test_can_compile_and_use_library_with_skip_unused() {
|
||||||
|
os.chdir(cfolder)
|
||||||
|
os.rm(library_file_name) or {}
|
||||||
|
v_compile('-skip-unused -d no_backtrace -o library -shared modules/library/library.v')
|
||||||
|
assert os.is_file(library_file_name)
|
||||||
|
result := v_compile('run use.v')
|
||||||
|
assert result.output.contains('res: 4')
|
||||||
|
os.rm(library_file_name) or {}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn v_compile(vopts string) os.Result {
|
fn v_compile(vopts string) os.Result {
|
||||||
cmd := '"$vexe" -showcc $vopts'
|
cmd := '"$vexe" -showcc $vopts'
|
||||||
dump(cmd)
|
// dump(cmd)
|
||||||
res := os.execute_or_panic(cmd)
|
res := os.execute_or_panic(cmd)
|
||||||
dump(res)
|
// dump(res)
|
||||||
// assert res.exit_code == 0
|
assert res.exit_code == 0
|
||||||
$if windows {
|
|
||||||
os.system('dir $cfolder /a')
|
|
||||||
} $else {
|
|
||||||
os.system('ls -al $cfolder')
|
|
||||||
}
|
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,6 +143,10 @@ pub fn mark_used(mut table ast.Table, pref &pref.Preferences, ast_files []ast.Fi
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if mfn.is_pub && pref.is_shared {
|
||||||
|
all_fn_root_names << k
|
||||||
|
continue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if pref.is_debug {
|
if pref.is_debug {
|
||||||
all_fn_root_names << 'panic_debug'
|
all_fn_root_names << 'panic_debug'
|
||||||
|
|
Loading…
Reference in New Issue