alpinestudios / oogabooga

ooga booga
Other
221 stars 245 forks source link

Add `noreturn` attribute to crash() #4

Closed rciliberto closed 3 months ago

rciliberto commented 3 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.