BAN: TRY and MUST macros use rvalue references

This commit is contained in:
Bananymous 2023-04-19 00:11:15 +03:00
parent 1dc81abca4
commit 115c44630d
1 changed files with 3 additions and 3 deletions

View File

@ -9,12 +9,12 @@
#if defined(__is_kernel)
#include <kernel/Panic.h>
#include <kernel/Errors.h>
#define MUST(expr) ({ auto e = expr; if (e.is_error()) Kernel::panic("{}", e.error()); e.release_value(); })
#define MUST(expr) ({ auto&& e = expr; if (e.is_error()) Kernel::panic("{}", e.error()); e.release_value(); })
#else
#define MUST(expr) ({ auto e = expr; assert(!e.is_error()); e.release_value(); })
#define MUST(expr) ({ auto&& e = expr; assert(!e.is_error()); e.release_value(); })
#endif
#define TRY(expr) ({ auto e = expr; if (e.is_error()) return e.release_error(); e.release_value(); })
#define TRY(expr) ({ auto&& e = expr; if (e.is_error()) return e.release_error(); e.release_value(); })
namespace BAN
{