diff options
| author | liamwhite <liamwhite@users.noreply.github.com> | 2023-11-11 09:45:29 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-11 09:45:29 -0500 |
| commit | 40d4e9543b5792dfa761b44d4c6017d5692f77a3 (patch) | |
| tree | 019cb6ca42ee3b89b400bb624e933abf695e150c /src/core/hle/result.h | |
| parent | 2f9487cd38aae71187b2f324a45b7e3657f18b48 (diff) | |
| parent | 875246f5b29d1a14e6c08a1631a2acc8c8eb3a19 (diff) | |
Merge pull request #11914 from liamwhite/newer-kpagetable
kernel: add KPageTableBase
Diffstat (limited to 'src/core/hle/result.h')
| -rw-r--r-- | src/core/hle/result.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/core/hle/result.h b/src/core/hle/result.h index dd0b27f47..749f51f69 100644 --- a/src/core/hle/result.h +++ b/src/core/hle/result.h @@ -407,3 +407,34 @@ constexpr inline Result __TmpCurrentResultReference = ResultSuccess; /// Evaluates a boolean expression, and succeeds if that expression is true. #define R_SUCCEED_IF(expr) R_UNLESS(!(expr), ResultSuccess) + +#define R_TRY_CATCH(res_expr) \ + { \ + const auto R_CURRENT_RESULT = (res_expr); \ + if (R_FAILED(R_CURRENT_RESULT)) { \ + if (false) + +#define R_END_TRY_CATCH \ + else if (R_FAILED(R_CURRENT_RESULT)) { \ + R_THROW(R_CURRENT_RESULT); \ + } \ + } \ + } + +#define R_CATCH_ALL() \ + } \ + else if (R_FAILED(R_CURRENT_RESULT)) { \ + if (true) + +#define R_CATCH(res_expr) \ + } \ + else if ((res_expr) == (R_CURRENT_RESULT)) { \ + if (true) + +#define R_CONVERT(catch_type, convert_type) \ + R_CATCH(catch_type) { R_THROW(static_cast<Result>(convert_type)); } + +#define R_CONVERT_ALL(convert_type) \ + R_CATCH_ALL() { R_THROW(static_cast<Result>(convert_type)); } + +#define R_ASSERT(res_expr) ASSERT(R_SUCCEEDED(res_expr)) |
