In the user.h
https://github.com/mit-pdos/xv6-riscv/blob/a1da53a5a12e21b44a2c79d962a437fa2107627c/user/user.h#L6
exit is only syscall defined this way
int exit(int) __attribute__((noreturn));
why this is needed for the exit function declaration?
I don't think the noreturn
attribute is strictly required, but it helps.
The noreturn
attribute tells the compiler that the exit
function will never return. In theory, this allows the compiler to better understand the possible code paths of any code that calls exit
, so it can display more accurate warnings and optimize the code better.