mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:38:11 +00:00
Kernel: Mark UserOrKernelBuffer and it's getters as [[nodicard]]
`UserOrKernelBuffer` objects should always be observed when created, in turn there is no reason to call a getter without observing the result. Doing either of these indicates an error in the code. Mark these methods as [[nodiscard]] to find these cases.
This commit is contained in:
parent
01a66efe9d
commit
a75d7958cc
1 changed files with 5 additions and 5 deletions
|
@ -36,7 +36,7 @@
|
|||
|
||||
namespace Kernel {
|
||||
|
||||
class UserOrKernelBuffer {
|
||||
class [[nodiscard]] UserOrKernelBuffer {
|
||||
public:
|
||||
UserOrKernelBuffer() = delete;
|
||||
|
||||
|
@ -61,10 +61,10 @@ public:
|
|||
return UserOrKernelBuffer(const_cast<u8*>((const u8*)userspace.unsafe_userspace_ptr()));
|
||||
}
|
||||
|
||||
bool is_kernel_buffer() const;
|
||||
const void* user_or_kernel_ptr() const { return m_buffer; }
|
||||
[[nodiscard]] bool is_kernel_buffer() const;
|
||||
[[nodiscard]] const void* user_or_kernel_ptr() const { return m_buffer; }
|
||||
|
||||
UserOrKernelBuffer offset(ssize_t offset) const
|
||||
[[nodiscard]] UserOrKernelBuffer offset(ssize_t offset) const
|
||||
{
|
||||
if (!m_buffer)
|
||||
return *this;
|
||||
|
@ -74,7 +74,7 @@ public:
|
|||
return offset_buffer;
|
||||
}
|
||||
|
||||
String copy_into_string(size_t size) const;
|
||||
[[nodiscard]] String copy_into_string(size_t size) const;
|
||||
[[nodiscard]] bool write(const void* src, size_t offset, size_t len);
|
||||
[[nodiscard]] bool write(const void* src, size_t len)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue