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:
parent
e8c9b5e870
commit
ea3ee4f3f3
Notes:
sideshowbarker
2024-07-19 04:17:34 +09:00
Author: https://github.com/bgianfo Commit: https://github.com/SerenityOS/serenity/commit/ea3ee4f3f32 Pull-request: https://github.com/SerenityOS/serenity/pull/2999
1 changed files with 1 additions and 1 deletions
|
@ -61,7 +61,7 @@ private:
|
|||
};
|
||||
|
||||
template<typename T>
|
||||
class alignas(T) KResultOr {
|
||||
class alignas(T) [[nodiscard]] KResultOr {
|
||||
public:
|
||||
KResultOr(KResult error)
|
||||
: m_error(error)
|
||||
|
|
Loading…
Add table
Reference in a new issue