summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-09-06 22:25:02 +0200
committerAndreas Kling <kling@serenityos.org>2021-09-07 01:18:02 +0200
commit4b4e1d1c900cb9fcb2e856dff0f42542e0c3568d (patch)
tree5def1ed01e668140787e85545782ae1ca382c1ca /Kernel
parente6929835d2438fff5f10da11537dd7d1eb225a80 (diff)
downloadserenity-4b4e1d1c900cb9fcb2e856dff0f42542e0c3568d.zip
Kernel: Remove redundant [[nodiscard]] on KResult return values
Both KResult and KResultOr are [[nodiscard]] at the class level, so there's no need to have functions return `[[nodiscard]] KResult`.
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/API/KResult.h4
-rw-r--r--Kernel/Coredump.h2
-rw-r--r--Kernel/Devices/AsyncDeviceRequest.h4
-rw-r--r--Kernel/DoubleBuffer.h12
-rw-r--r--Kernel/KString.h2
-rw-r--r--Kernel/StdLib.cpp2
-rw-r--r--Kernel/StdLib.h6
-rw-r--r--Kernel/UserOrKernelBuffer.h10
8 files changed, 21 insertions, 21 deletions
diff --git a/Kernel/API/KResult.h b/Kernel/API/KResult.h
index 2ddf0f95d0..aa5334f76f 100644
--- a/Kernel/API/KResult.h
+++ b/Kernel/API/KResult.h
@@ -141,7 +141,7 @@ public:
return m_error;
}
- [[nodiscard]] KResult result() const { return m_is_error ? m_error : KSuccess; }
+ KResult result() const { return m_is_error ? m_error : KSuccess; }
[[nodiscard]] ALWAYS_INLINE T& value() &
{
@@ -167,7 +167,7 @@ public:
return released_value;
}
- [[nodiscard]] KResult release_error()
+ KResult release_error()
{
VERIFY(m_is_error);
return m_error;
diff --git a/Kernel/Coredump.h b/Kernel/Coredump.h
index 9a653219e9..11b7e65588 100644
--- a/Kernel/Coredump.h
+++ b/Kernel/Coredump.h
@@ -18,7 +18,7 @@ public:
static KResultOr<NonnullOwnPtr<Coredump>> try_create(NonnullRefPtr<Process>, StringView output_path);
~Coredump() = default;
- [[nodiscard]] KResult write();
+ KResult write();
private:
Coredump(NonnullRefPtr<Process>, NonnullRefPtr<FileDescription>);
diff --git a/Kernel/Devices/AsyncDeviceRequest.h b/Kernel/Devices/AsyncDeviceRequest.h
index ef0f86aa52..2afbce1838 100644
--- a/Kernel/Devices/AsyncDeviceRequest.h
+++ b/Kernel/Devices/AsyncDeviceRequest.h
@@ -90,7 +90,7 @@ public:
}
template<size_t BUFFER_BYTES, typename... Args>
- [[nodiscard]] KResultOr<size_t> write_to_buffer_buffered(UserOrKernelBuffer& buffer, Args... args)
+ KResultOr<size_t> write_to_buffer_buffered(UserOrKernelBuffer& buffer, Args... args)
{
if (in_target_context(buffer))
return buffer.write_buffered<BUFFER_BYTES>(forward<Args>(args)...);
@@ -108,7 +108,7 @@ public:
}
template<size_t BUFFER_BYTES, typename... Args>
- [[nodiscard]] KResultOr<size_t> read_from_buffer_buffered(const UserOrKernelBuffer& buffer, Args... args)
+ KResultOr<size_t> read_from_buffer_buffered(const UserOrKernelBuffer& buffer, Args... args)
{
if (in_target_context(buffer))
return buffer.read_buffered<BUFFER_BYTES>(forward<Args>(args)...);
diff --git a/Kernel/DoubleBuffer.h b/Kernel/DoubleBuffer.h
index 0fd1899dc4..5e87b1afa3 100644
--- a/Kernel/DoubleBuffer.h
+++ b/Kernel/DoubleBuffer.h
@@ -17,19 +17,19 @@ namespace Kernel {
class DoubleBuffer {
public:
[[nodiscard]] static OwnPtr<DoubleBuffer> try_create(size_t capacity = 65536);
- [[nodiscard]] KResultOr<size_t> write(const UserOrKernelBuffer&, size_t);
- [[nodiscard]] KResultOr<size_t> write(const u8* data, size_t size)
+ KResultOr<size_t> write(const UserOrKernelBuffer&, size_t);
+ KResultOr<size_t> write(const u8* data, size_t size)
{
return write(UserOrKernelBuffer::for_kernel_buffer(const_cast<u8*>(data)), size);
}
- [[nodiscard]] KResultOr<size_t> read(UserOrKernelBuffer&, size_t);
- [[nodiscard]] KResultOr<size_t> read(u8* data, size_t size)
+ KResultOr<size_t> read(UserOrKernelBuffer&, size_t);
+ KResultOr<size_t> read(u8* data, size_t size)
{
auto buffer = UserOrKernelBuffer::for_kernel_buffer(data);
return read(buffer, size);
}
- [[nodiscard]] KResultOr<size_t> peek(UserOrKernelBuffer&, size_t);
- [[nodiscard]] KResultOr<size_t> peek(u8* data, size_t size)
+ KResultOr<size_t> peek(UserOrKernelBuffer&, size_t);
+ KResultOr<size_t> peek(u8* data, size_t size)
{
auto buffer = UserOrKernelBuffer::for_kernel_buffer(data);
return peek(buffer, size);
diff --git a/Kernel/KString.h b/Kernel/KString.h
index 2f157dfbec..0a06e5478b 100644
--- a/Kernel/KString.h
+++ b/Kernel/KString.h
@@ -23,7 +23,7 @@ public:
void operator delete(void*);
- [[nodiscard]] KResultOr<NonnullOwnPtr<KString>> try_clone() const;
+ KResultOr<NonnullOwnPtr<KString>> try_clone() const;
[[nodiscard]] bool is_empty() const { return m_length == 0; }
[[nodiscard]] size_t length() const { return m_length; }
diff --git a/Kernel/StdLib.cpp b/Kernel/StdLib.cpp
index 68f4baa142..edfe4bfc5a 100644
--- a/Kernel/StdLib.cpp
+++ b/Kernel/StdLib.cpp
@@ -193,7 +193,7 @@ KResult copy_from_user(void* dest_ptr, void const* src_ptr, size_t n)
return KSuccess;
}
-[[nodiscard]] KResult memset_user(void* dest_ptr, int c, size_t n)
+KResult memset_user(void* dest_ptr, int c, size_t n)
{
bool is_user = Kernel::Memory::is_user_range(VirtualAddress(dest_ptr), n);
if (!is_user)
diff --git a/Kernel/StdLib.h b/Kernel/StdLib.h
index 65fc93aece..a2e1bbbb47 100644
--- a/Kernel/StdLib.h
+++ b/Kernel/StdLib.h
@@ -34,9 +34,9 @@ KResultOr<Time> copy_time_from_user(Userspace<T*>);
[[nodiscard]] Optional<u32> user_atomic_fetch_or_relaxed(volatile u32* var, u32 val);
[[nodiscard]] Optional<u32> user_atomic_fetch_xor_relaxed(volatile u32* var, u32 val);
-[[nodiscard]] KResult copy_to_user(void*, const void*, size_t);
-[[nodiscard]] KResult copy_from_user(void*, const void*, size_t);
-[[nodiscard]] KResult memset_user(void*, int, size_t);
+KResult copy_to_user(void*, const void*, size_t);
+KResult copy_from_user(void*, const void*, size_t);
+KResult memset_user(void*, int, size_t);
extern "C" {
diff --git a/Kernel/UserOrKernelBuffer.h b/Kernel/UserOrKernelBuffer.h
index 41970e424d..555262f10f 100644
--- a/Kernel/UserOrKernelBuffer.h
+++ b/Kernel/UserOrKernelBuffer.h
@@ -54,7 +54,7 @@ public:
return offset_buffer;
}
- [[nodiscard]] KResultOr<NonnullOwnPtr<KString>> try_copy_into_kstring(size_t) const;
+ KResultOr<NonnullOwnPtr<KString>> try_copy_into_kstring(size_t) const;
[[nodiscard]] bool write(const void* src, size_t offset, size_t len);
[[nodiscard]] bool write(const void* src, size_t len)
{
@@ -82,7 +82,7 @@ public:
}
template<size_t BUFFER_BYTES, typename F>
- [[nodiscard]] KResultOr<size_t> write_buffered(size_t offset, size_t len, F f)
+ KResultOr<size_t> write_buffered(size_t offset, size_t len, F f)
{
if (!m_buffer)
return EFAULT;
@@ -113,13 +113,13 @@ public:
return nwritten;
}
template<size_t BUFFER_BYTES, typename F>
- [[nodiscard]] KResultOr<size_t> write_buffered(size_t len, F f)
+ KResultOr<size_t> write_buffered(size_t len, F f)
{
return write_buffered<BUFFER_BYTES, F>(0, len, f);
}
template<size_t BUFFER_BYTES, typename F>
- [[nodiscard]] KResultOr<size_t> read_buffered(size_t offset, size_t len, F f) const
+ KResultOr<size_t> read_buffered(size_t offset, size_t len, F f) const
{
if (!m_buffer)
return EFAULT;
@@ -149,7 +149,7 @@ public:
return nread;
}
template<size_t BUFFER_BYTES, typename F>
- [[nodiscard]] KResultOr<size_t> read_buffered(size_t len, F f) const
+ KResultOr<size_t> read_buffered(size_t len, F f) const
{
return read_buffered<BUFFER_BYTES, F>(0, len, f);
}