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 2019-10-24 01:40:44 -07:00 committed by SciresM
parent 15773e4755
commit 4059dc6187
169 changed files with 2172 additions and 1868 deletions

View file

@ -142,17 +142,14 @@ namespace sts::boot2 {
void LaunchTitle(os::ProcessId *out_process_id, const ncm::TitleLocation &loc, u32 launch_flags) {
os::ProcessId process_id = os::InvalidProcessId;
switch (pm::shell::LaunchTitle(&process_id, loc, launch_flags)) {
case ResultKernelResourceExhausted:
case ResultKernelOutOfMemory:
case ResultKernelLimitReached:
STS_ASSERT(false);
default:
/* We don't care about other issues. */
break;
/* Launch, lightly validate result. */
{
const auto launch_result = pm::shell::LaunchTitle(&process_id, loc, launch_flags);
STS_ASSERT(!(svc::ResultOutOfResource::Includes(launch_result)));
STS_ASSERT(!(svc::ResultOutOfMemory::Includes(launch_result)));
STS_ASSERT(!(svc::ResultLimitReached::Includes(launch_result)));
}
if (out_process_id) {
*out_process_id = process_id;
}