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.
This commit is contained in:
Brian Gianforcaro 2020-08-05 01:01:56 -07:00 committed by Andreas Kling
parent e8c9b5e870
commit ea3ee4f3f3
Notes: sideshowbarker 2024-07-19 04:17:34 +09:00

View file

@ -61,7 +61,7 @@ private:
};
template<typename T>
class alignas(T) KResultOr {
class alignas(T) [[nodiscard]] KResultOr {
public:
KResultOr(KResult error)
: m_error(error)