Skip to content

Commit 01f108e

Browse files
committed
builtin: fix v -W -Wimpure-v examples/hello_world.v (move ctovstring_impl to builtin.c.v)
1 parent 49e7754 commit 01f108e

3 files changed

Lines changed: 18 additions & 13 deletions

File tree

‎cmd/tools/vtest-all.v‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ fn get_all_commands() []Command {
9090
okmsg: 'V can compile hello world.'
9191
rmfile: 'examples/hello_world'
9292
}
93+
res << Command{
94+
line: '${vexe} -W -Wimpure-v run examples/hello_world.v'
95+
okmsg: 'V can compile hello world with the stricter `-W -Wimpure-v` mode .'
96+
rmfile: 'examples/hello_world'
97+
}
9398
$if linux {
9499
if l2w_crosscc != '' {
95100
res << Command{

‎vlib/builtin/builtin.c.v‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -944,3 +944,16 @@ pub fn arguments() []string {
944944
}
945945
return res
946946
}
947+
948+
// ctovstring_impl is a temporary API, to enable clean CI runs for https://github.com/vlang/v/pull/25264 .
949+
// It will be deleted after the migration to the new `builtin` naming scheme is finished.
950+
@[export: 'builtin__ctovstring']
951+
pub fn ctovstring_impl(s &u8) string {
952+
unsafe {
953+
len := C.strlen(voidptr(s))
954+
return string{
955+
str: memdup(voidptr(s), isize(len))
956+
len: len
957+
}
958+
}
959+
}

‎vlib/builtin/string.v‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3052,16 +3052,3 @@ pub fn (mut ri RunesIterator) next() ?rune {
30523052
}
30533053
return rune(impl_utf8_to_utf32(start, len))
30543054
}
3055-
3056-
// ctovstring_impl is a temporary API, to enable clean CI runs for https://github.com/vlang/v/pull/25264 .
3057-
// It will be deleted after the migration to the new `builtin` naming scheme is finished.
3058-
@[export: 'builtin__ctovstring']
3059-
pub fn ctovstring_impl(s &u8) string {
3060-
unsafe {
3061-
len := C.strlen(voidptr(s))
3062-
return string{
3063-
str: memdup(voidptr(s), isize(len))
3064-
len: len
3065-
}
3066-
}
3067-
}

0 commit comments

Comments
 (0)