diff options
| author | Tharo <17233964+Thar0@users.noreply.github.com> | 2024-12-22 23:24:47 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-22 15:24:47 -0800 |
| commit | 2a152a9676ed57b7b913ad80b556b5e569ada908 (patch) | |
| tree | 19cc3a7881fa0efe4c68f368f651e5ffb20e1b4a /include | |
| parent | 16d8f4870dcc0d564c6554171dbe697db68c933c (diff) | |
Apply the NORETURN attribute to functions that do not return (#1768)
* Apply the NORETURN attribute to functions that do not return
* Add NORETURN to debug.c functions
Diffstat (limited to 'include')
| -rw-r--r-- | include/attributes.h | 6 | ||||
| -rw-r--r-- | include/fault.h | 5 | ||||
| -rw-r--r-- | include/functions.h | 2 | ||||
| -rw-r--r-- | include/libu64/debug.h | 6 |
4 files changed, 14 insertions, 5 deletions
diff --git a/include/attributes.h b/include/attributes.h index 9b3832fcb..2c555930e 100644 --- a/include/attributes.h +++ b/include/attributes.h @@ -14,4 +14,10 @@ #define NO_REORDER __attribute__((no_reorder)) #define SECTION_DATA __attribute__((section(".data"))) +#ifdef __GNUC__ +#define UNREACHABLE() __builtin_unreachable() +#else +#define UNREACHABLE() +#endif + #endif diff --git a/include/fault.h b/include/fault.h index 8ddd759c6..d7fb2228a 100644 --- a/include/fault.h +++ b/include/fault.h @@ -2,6 +2,7 @@ #define FAULT_H #include "ultra64.h" +#include "attributes.h" #include "stdarg.h" #include "stdint.h" @@ -60,8 +61,8 @@ void Fault_Init(void); // Fatal Errors -void Fault_AddHungupAndCrashImpl(const char* exp1, const char* exp2); -void Fault_AddHungupAndCrash(const char* file, s32 line); +NORETURN void Fault_AddHungupAndCrashImpl(const char* exp1, const char* exp2); +NORETURN void Fault_AddHungupAndCrash(const char* file, s32 line); // Client Registration diff --git a/include/functions.h b/include/functions.h index e379137ae..419c39213 100644 --- a/include/functions.h +++ b/include/functions.h @@ -25,7 +25,7 @@ void Room_Draw(PlayState* play, Room* room, u32 flags); void Room_FinishRoomChange(PlayState* play, RoomContext* roomCtx); -void func_80183070(void); +NORETURN void func_80183070(void); AudioTask* AudioThread_Update(void); void AudioThread_QueueCmdF32(u32 opArgs, f32 data); diff --git a/include/libu64/debug.h b/include/libu64/debug.h index 5bcae690c..98edb407d 100644 --- a/include/libu64/debug.h +++ b/include/libu64/debug.h @@ -1,7 +1,9 @@ #ifndef LIBU64_DEBUG_H #define LIBU64_DEBUG_H -void _dbg_hungup(const char* file, int lineNum); -void Reset(void); +#include "../attributes.h" + +NORETURN void _dbg_hungup(const char* file, int lineNum); +NORETURN void Reset(void); #endif |
