summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2023-11-04 01:22:37 +0100
committerMoonchild <moonchild@palemoon.org>2023-11-08 13:47:10 +0100
commit080c8cc1347937f274e2d7cdab5aea31f00c608f (patch)
treea3bed160ce812f0e7b2792b5079666feb83fd417
parent8e81d25f5d50df77fb587da3d18abe6a7fa24e73 (diff)
downloaduxp-080c8cc1347937f274e2d7cdab5aea31f00c608f.tar.gz
Issue #2342: Use [[nodiscard]] in /ipc
-rw-r--r--ipc/chromium/src/base/pickle.h45
-rw-r--r--ipc/mscom/COMPtrHolder.h2
2 files changed, 24 insertions, 23 deletions
diff --git a/ipc/chromium/src/base/pickle.h b/ipc/chromium/src/base/pickle.h
index 3d197c1c6b..5adaf87fc6 100644
--- a/ipc/chromium/src/base/pickle.h
+++ b/ipc/chromium/src/base/pickle.h
@@ -1,5 +1,6 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2023, Moonchild Productions.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -92,32 +93,32 @@ class Pickle {
// the Pickle, initialize *iter to NULL. If successful, these methods return
// true. Otherwise, false is returned to indicate that the result could not
// be extracted.
- MOZ_MUST_USE bool ReadBool(PickleIterator* iter, bool* result) const;
- MOZ_MUST_USE bool ReadInt16(PickleIterator* iter, int16_t* result) const;
- MOZ_MUST_USE bool ReadUInt16(PickleIterator* iter, uint16_t* result) const;
- MOZ_MUST_USE bool ReadShort(PickleIterator* iter, short* result) const;
- MOZ_MUST_USE bool ReadInt(PickleIterator* iter, int* result) const;
- MOZ_MUST_USE bool ReadLong(PickleIterator* iter, long* result) const;
- MOZ_MUST_USE bool ReadULong(PickleIterator* iter, unsigned long* result) const;
- MOZ_MUST_USE bool ReadSize(PickleIterator* iter, size_t* result) const;
- MOZ_MUST_USE bool ReadInt32(PickleIterator* iter, int32_t* result) const;
- MOZ_MUST_USE bool ReadUInt32(PickleIterator* iter, uint32_t* result) const;
- MOZ_MUST_USE bool ReadInt64(PickleIterator* iter, int64_t* result) const;
- MOZ_MUST_USE bool ReadUInt64(PickleIterator* iter, uint64_t* result) const;
- MOZ_MUST_USE bool ReadDouble(PickleIterator* iter, double* result) const;
- MOZ_MUST_USE bool ReadIntPtr(PickleIterator* iter, intptr_t* result) const;
- MOZ_MUST_USE bool ReadUnsignedChar(PickleIterator* iter, unsigned char* result) const;
- MOZ_MUST_USE bool ReadString(PickleIterator* iter, std::string* result) const;
- MOZ_MUST_USE bool ReadWString(PickleIterator* iter, std::wstring* result) const;
- MOZ_MUST_USE bool ReadBytesInto(PickleIterator* iter, void* data, uint32_t length) const;
- MOZ_MUST_USE bool ExtractBuffers(PickleIterator* iter, size_t length, BufferList* buffers,
- uint32_t alignment = sizeof(memberAlignmentType)) const;
+ [[nodiscard]] bool ReadBool(PickleIterator* iter, bool* result) const;
+ [[nodiscard]] bool ReadInt16(PickleIterator* iter, int16_t* result) const;
+ [[nodiscard]] bool ReadUInt16(PickleIterator* iter, uint16_t* result) const;
+ [[nodiscard]] bool ReadShort(PickleIterator* iter, short* result) const;
+ [[nodiscard]] bool ReadInt(PickleIterator* iter, int* result) const;
+ [[nodiscard]] bool ReadLong(PickleIterator* iter, long* result) const;
+ [[nodiscard]] bool ReadULong(PickleIterator* iter, unsigned long* result) const;
+ [[nodiscard]] bool ReadSize(PickleIterator* iter, size_t* result) const;
+ [[nodiscard]] bool ReadInt32(PickleIterator* iter, int32_t* result) const;
+ [[nodiscard]] bool ReadUInt32(PickleIterator* iter, uint32_t* result) const;
+ [[nodiscard]] bool ReadInt64(PickleIterator* iter, int64_t* result) const;
+ [[nodiscard]] bool ReadUInt64(PickleIterator* iter, uint64_t* result) const;
+ [[nodiscard]] bool ReadDouble(PickleIterator* iter, double* result) const;
+ [[nodiscard]] bool ReadIntPtr(PickleIterator* iter, intptr_t* result) const;
+ [[nodiscard]] bool ReadUnsignedChar(PickleIterator* iter, unsigned char* result) const;
+ [[nodiscard]] bool ReadString(PickleIterator* iter, std::string* result) const;
+ [[nodiscard]] bool ReadWString(PickleIterator* iter, std::wstring* result) const;
+ [[nodiscard]] bool ReadBytesInto(PickleIterator* iter, void* data, uint32_t length) const;
+ [[nodiscard]] bool ExtractBuffers(PickleIterator* iter, size_t length, BufferList* buffers,
+ uint32_t alignment = sizeof(memberAlignmentType)) const;
// Safer version of ReadInt() checks for the result not being negative.
// Use it for reading the object sizes.
- MOZ_MUST_USE bool ReadLength(PickleIterator* iter, int* result) const;
+ [[nodiscard]] bool ReadLength(PickleIterator* iter, int* result) const;
- MOZ_MUST_USE bool ReadSentinel(PickleIterator* iter, uint32_t sentinel) const
+ [[nodiscard]] bool ReadSentinel(PickleIterator* iter, uint32_t sentinel) const
#ifdef MOZ_PICKLE_SENTINEL_CHECKING
;
#else
diff --git a/ipc/mscom/COMPtrHolder.h b/ipc/mscom/COMPtrHolder.h
index 311e761532..febe10f461 100644
--- a/ipc/mscom/COMPtrHolder.h
+++ b/ipc/mscom/COMPtrHolder.h
@@ -37,7 +37,7 @@ public:
return mPtr.get();
}
- MOZ_MUST_USE Interface* Release()
+ [[nodiscard]] Interface* Release()
{
return mPtr.release();
}