summaryrefslogtreecommitdiff
path: root/Kernel/KResult.h
diff options
context:
space:
mode:
authorBrian Gianforcaro <b.gianfo@gmail.com>2020-08-05 01:01:56 -0700
committerAndreas Kling <kling@serenityos.org>2020-08-05 10:26:29 +0200
commitea3ee4f3f32f5d425a9533c4ae68815570253e95 (patch)
tree561fb9dc761ff8389da7cef1df8a764725225880 /Kernel/KResult.h
parente8c9b5e8701527402af659da5db4eb483fcc2de8 (diff)
downloadserenity-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.h2
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)