Skip to content

Commit 92dd1a5

Browse files
committed
os: use @[noinline] on os.create/1 to workaround a -cc gcc -prod panic (fix #25549)
1 parent d689a4b commit 92dd1a5

File tree

1 file changed

+1
-23
lines changed

1 file changed

+1
-23
lines changed

vlib/os/file.c.v

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -147,30 +147,8 @@ pub fn open(path string) !File {
147147
}
148148

149149
// create creates or opens a file at a specified location and returns a write-only `File` object.
150+
@[noinline]
150151
pub fn create(path string) !File {
151-
/*
152-
// Note: android/termux/bionic is also a kind of linux,
153-
// but linux syscalls there sometimes fail,
154-
// while the libc version should work.
155-
$if linux {
156-
$if !android {
157-
//$if macos {
158-
// fd = C.syscall(398, path.str, 0x601, 0x1b6)
159-
//}
160-
//$if linux {
161-
fd = C.syscall(sys_creat, path.str, 511)
162-
//}
163-
if fd == -1 {
164-
return error('failed to create file "$path"')
165-
}
166-
file = File{
167-
fd: fd
168-
is_opened: true
169-
}
170-
return file
171-
}
172-
}
173-
*/
174152
cfile := vfopen(path, 'wb')!
175153
fd := fileno(cfile)
176154
return File{

0 commit comments

Comments
 (0)