diff options
author | Brian Gianforcaro <b.gianfo@gmail.com> | 2020-08-05 01:01:56 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-08-05 10:26:29 +0200 |
commit | ea3ee4f3f32f5d425a9533c4ae68815570253e95 (patch) | |
tree | 561fb9dc761ff8389da7cef1df8a764725225880 /Kernel/KResult.h | |
parent | e8c9b5e8701527402af659da5db4eb483fcc2de8 (diff) | |
download | serenity-ea3ee4f3f32f5d425a9533c4ae68815570253e95.zip |
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.
Diffstat (limited to 'Kernel/KResult.h')
-rw-r--r-- | Kernel/KResult.h | 2 |
1 files changed, 1 insertions, 1 deletions
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<typename T> -class alignas(T) KResultOr { +class alignas(T) [[nodiscard]] KResultOr { public: KResultOr(KResult error) : m_error(error) |