alpinestudios / oogabooga

ooga booga
Other
223 stars 247 forks source link

Add `noreturn` attribute to crash() #4

Closed rciliberto closed 4 months ago

rciliberto commented 4 months ago

If my understanding is correct, since crash() stops the program via __builtin_trap(), adding the noreturn attribute would allow the compiler to optimize in certain cases. Consider the case of an assert() on a pointer. Since assert() uses crash() if the pointer is NULL, this lets the compiler correctly discern that the pointer in any code after the assert will in fact not be null.