Results: Implement namespaced, type-safe results.

Because I was working on multiple things at once, this commit also:
- Adds wrappers for/linker flags to wrap CXX exceptions to make them
  abort. This saves ~0x8000 of memory in every system module.
- Broadly replaces lines of the pattern if (cond) { return ResultX; }
  with R_UNLESS(!cond, ResultX());.
- Reworks the R_TRY_CATCH macros (and the result macros in general).
This commit is contained in:
Michael Scire authored and SciresM committed 2019-12-07 12:41:28 -08:00
1 parent 15773e4755
commit 4059dc6187
169 files changed
+2172 -1868

No files matched your search

+4 -4
View File
@@ -28,7 +28,7 @@ namespace sts::fatal::srv {
u64 lr;
};
bool IsThreadFatalCaller(u32 error_code, u32 debug_handle, u64 thread_id, u64 thread_tls_addr, ThreadContext *thread_ctx) {
bool IsThreadFatalCaller(Result result, u32 debug_handle, u64 thread_id, u64 thread_tls_addr, ThreadContext *thread_ctx) {
/* Verify that the thread is running or waiting. */
{
u64 _;
@@ -71,7 +71,7 @@ namespace sts::fatal::srv {
const struct {
CmifInHeader header;
u32 error_code;
Result result;
} *in_data = decltype(in_data)(request.data.data_words);
static_assert(sizeof(*in_data) == 0x14, "InData!");
@@ -112,7 +112,7 @@ namespace sts::fatal::srv {
return false;
}
if (in_data->error_code != error_code) {
if (in_data->result.GetValue() != result.GetValue()) {
return false;
}
}
@@ -226,7 +226,7 @@ namespace sts::fatal::srv {
continue;
}
if (IsThreadFatalCaller(ctx->error_code, debug_handle.Get(), cur_thread_id, thread_id_to_tls[cur_thread_id], &thread_ctx)) {
if (IsThreadFatalCaller(ctx->result, debug_handle.Get(), cur_thread_id, thread_id_to_tls[cur_thread_id], &thread_ctx)) {
thread_id = cur_thread_id;
found_fatal_caller = true;
break;