From ea3ee4f3f32f5d425a9533c4ae68815570253e95 Mon Sep 17 00:00:00 2001 From: Brian Gianforcaro Date: Wed, 5 Aug 2020 01:01:56 -0700 Subject: [PATCH] Kernel: Decorate KResultOr with [[nodiscard]] to catch misbehaving callers The [[nodiscard]] decorator enables us to have the compile emit a warning anytime the decorated type or function's return value isn't observed. It's very useful for catching error checking bugs in systems which use C style error handling. --- Kernel/KResult.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kernel/KResult.h b/Kernel/KResult.h index 35f9a28ea2..3d821c4260 100644 --- a/Kernel/KResult.h +++ b/Kernel/KResult.h @@ -61,7 +61,7 @@ private: }; template -class alignas(T) KResultOr { +class alignas(T) [[nodiscard]] KResultOr { public: KResultOr(KResult error) : m_error(error)