Skip to content

Commit

Permalink
markused: fix veb actions
Browse files Browse the repository at this point in the history
  • Loading branch information
medvednikov committed Nov 26, 2024
1 parent f2387ab commit 7b8089b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
6 changes: 3 additions & 3 deletions vlib/builtin/string.v
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ pub fn tos2(s &u8) string {
// It will panic, when the pointer `s` is 0.
// It is the same as `tos2`, but for &char pointers, avoiding callsite casts.
// See also `tos_clone`.
@[unsafe]
@[markused; unsafe]
pub fn tos3(s &char) string {
if s == 0 {
panic('tos3: nil string')
Expand All @@ -151,7 +151,7 @@ pub fn tos3(s &char) string {
// It returns '', when given a 0 pointer `s`, it does NOT panic.
// It is the same as `tos5`, but for &u8 pointers, avoiding callsite casts.
// See also `tos_clone`.
@[unsafe]
@[markused; unsafe]
pub fn tos4(s &u8) string {
if s == 0 {
return ''
Expand All @@ -168,7 +168,7 @@ pub fn tos4(s &u8) string {
// It returns '', when given a 0 pointer `s`, it does NOT panic.
// It is the same as `tos4`, but for &char pointers, avoiding callsite casts.
// See also `tos_clone`.
@[unsafe]
@[markused; unsafe]
pub fn tos5(s &char) string {
if s == 0 {
return ''
Expand Down
1 change: 1 addition & 0 deletions vlib/v/markused/markused.v
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ pub fn mark_used(mut table ast.Table, mut pref_ pref.Preferences, ast_files []&a
walker.mark_markused_globals() // tagged with `@[markused]`
walker.mark_exported_fns()
walker.mark_root_fns(all_fn_root_names)
walker.mark_veb_actions()

if walker.n_asserts > 0 {
unsafe { walker.fn_decl(mut all_fns['__print_assert_failure']) }
Expand Down
13 changes: 13 additions & 0 deletions vlib/v/markused/walker.v
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,19 @@ pub fn (mut w Walker) mark_root_fns(all_fn_root_names []string) {
}
}

pub fn (mut w Walker) mark_veb_actions() {
for _, mut func in w.all_fns {
if func.return_type == w.table.veb_res_idx_cache {
// if fn_name !in w.used_fns {
$if trace_skip_veb_actions ? {
println('>>>> walking veb action func: ${func.name} ...')
}
w.fn_decl(mut func)
}
//}
}
}

pub fn (mut w Walker) mark_exported_fns() {
for _, mut func in w.all_fns {
if func.is_exported {
Expand Down

0 comments on commit 7b8089b

Please sign in to comment.