mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:38:12 +00:00
Kernel: Mark kernel smart-pointer classes as [[nodiscard]]
And cast the unused return values to void.
This commit is contained in:
parent
5013a6480d
commit
c6a97ea843
10 changed files with 14 additions and 12 deletions
|
@ -40,7 +40,7 @@ ALWAYS_INLINE void unref_if_not_null(T* ptr)
|
|||
}
|
||||
|
||||
template<typename T>
|
||||
class NonnullRefPtr {
|
||||
class [[nodiscard]] NonnullRefPtr {
|
||||
template<typename U, typename P>
|
||||
friend class RefPtr;
|
||||
template<typename U>
|
||||
|
@ -223,8 +223,10 @@ public:
|
|||
other.exchange(ptr);
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
private:
|
||||
NonnullRefPtr() = delete;
|
||||
// clang-format on
|
||||
|
||||
ALWAYS_INLINE T* as_ptr() const
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue