1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-04 15:04:31 +00:00

Apply noreturn attribute where applicable (#1532)

This commit is contained in:
Tharo 2023-09-09 15:24:52 +01:00 committed by GitHub
parent bedf07d541
commit 7235af2249
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 30 additions and 18 deletions

View file

@ -3,7 +3,7 @@
u32 gIsCtrlr2Valid = false;
void func_800D31A0(void) {
NORETURN void func_800D31A0(void) {
osSyncPrintf(VT_FGCOL(RED) "\n**** Freeze!! ****\n" VT_RST);
while (true) {
Sleep_Msec(1000);

View file

@ -1304,19 +1304,25 @@ void Fault_HungupFaultClient(const char* exp1, const char* exp2) {
* error occurs. The parameters specify two messages detailing the error, one
* or both may be NULL.
*/
void Fault_AddHungupAndCrashImpl(const char* exp1, const char* exp2) {
NORETURN void Fault_AddHungupAndCrashImpl(const char* exp1, const char* exp2) {
FaultClient client;
s32 pad;
Fault_AddClient(&client, Fault_HungupFaultClient, (void*)exp1, (void*)exp2);
*(u32*)0x11111111 = 0; // trigger an exception via unaligned memory access
// Since the above line triggers an exception and transfers execution to the fault handler
// this function does not return and the rest of the function is unreachable.
#ifdef __GNUC__
__builtin_unreachable();
#endif
}
/**
* Like `Fault_AddHungupAndCrashImpl`, however provides a fixed message containing
* filename and line number
*/
void Fault_AddHungupAndCrash(const char* file, s32 line) {
NORETURN void Fault_AddHungupAndCrash(const char* file, s32 line) {
char msg[256];
sprintf(msg, "HungUp %s:%d", file, line);