Call it a bug or not, the following behavior is quite surprising to me and I'm not sure to actually understand what's happening:
void exit(int code)
{
extern void js_exit(int code);
js_exit(code);
}
int accept(void)
{
exit(-1);
}
when compiling this file, I get the following error:
clang --target=wasm32 \
-std=c99 -nostdlib -Wextra -Wall -Werror -Wconversion -funsigned-char -pedantic-errors \
-finput-charset=utf-8 -fexec-charset=utf-8 \
-Os -flto \
-Wl,--no-entry \
-Wl,--allow-undefined-file=/home/src/js_symbols.syms \
-Wl,--import-memory \
-Wl,--export=__heap_base \
-Wl,--export=accept \
/home/src/main.c \
/home/src/std/impl.c \
-o /home/dist/app.wasm
/home/src/main.c:9:1: error: function declared 'noreturn' should not return [-Werror,-Winvalid-noreturn]
9 | }
| ^
1 error generated.
I suspect this is because of the special semantic of the exit function. if I rename the symbol to exot , it works fine (I get another compile error about accept not returning an int, which is fine)
where is the problem exactly? what is clang trying to do?
