1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

all: support [noreturn] fn abc() { for{} }, mark panic/1 and exit/1with it too. (#10654)

This commit is contained in:
Delyan Angelov
2021-07-04 20:24:19 +03:00
committed by GitHub
parent b0b4b8e65b
commit 6aecda3be8
23 changed files with 318 additions and 22 deletions

View File

@ -140,6 +140,7 @@ pub fn write(fd i64, buf &byte, count u64) i64 {
return x
}
[noreturn]
fn bare_panic(msg string) {
println('V panic' + msg)
exit(1)
@ -150,6 +151,7 @@ fn bare_backtrace() string {
}
[export: 'exit']
[noreturn]
fn __exit(code int) {
sys_exit(code)
}

View File

@ -303,8 +303,10 @@ fn sys_execve(filename &byte, argv []&byte, envp []&byte) int {
}
// 60 sys_exit
[noreturn]
fn sys_exit(ec int) {
sys_call1(60, u64(ec))
for {}
}
// 102 sys_getuid