mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-11 10:41:30 +00:00
Kernel: Mark Lock getters as [[nodiscard]]
There is no reason to call a getter without observing the result, doing so indicates an error in the code. Mark these methods as [[nodiscard]] to find these cases.
This commit is contained in:
parent
a75d7958cc
commit
0cbede91b8
Notes:
sideshowbarker
2024-07-18 22:16:04 +09:00
Author: https://github.com/bgianfo
Commit: 0cbede91b8
Pull-request: https://github.com/SerenityOS/serenity/pull/5353
1 changed files with 5 additions and 5 deletions
|
@ -58,10 +58,10 @@ public:
|
||||||
void unlock();
|
void unlock();
|
||||||
[[nodiscard]] Mode force_unlock_if_locked(u32&);
|
[[nodiscard]] Mode force_unlock_if_locked(u32&);
|
||||||
void restore_lock(Mode, u32);
|
void restore_lock(Mode, u32);
|
||||||
bool is_locked() const { return m_mode != Mode::Unlocked; }
|
[[nodiscard]] bool is_locked() const { return m_mode != Mode::Unlocked; }
|
||||||
void clear_waiters();
|
void clear_waiters();
|
||||||
|
|
||||||
const char* name() const { return m_name; }
|
[[nodiscard]] const char* name() const { return m_name; }
|
||||||
|
|
||||||
static const char* mode_to_string(Mode mode)
|
static const char* mode_to_string(Mode mode)
|
||||||
{
|
{
|
||||||
|
@ -149,10 +149,10 @@ public:
|
||||||
: m_resource(move(resource))
|
: m_resource(move(resource))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
Lock& lock() { return m_lock; }
|
[[nodiscard]] Lock& lock() { return m_lock; }
|
||||||
T& resource() { return m_resource; }
|
[[nodiscard]] T& resource() { return m_resource; }
|
||||||
|
|
||||||
T lock_and_copy()
|
[[nodiscard]] T lock_and_copy()
|
||||||
{
|
{
|
||||||
LOCKER(m_lock);
|
LOCKER(m_lock);
|
||||||
return m_resource;
|
return m_resource;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue