Modified: trunk/Source/WTF/wtf/persistence/PersistentCoders.cpp (259813 => 259814)
--- trunk/Source/WTF/wtf/persistence/PersistentCoders.cpp 2020-04-09 19:23:10 UTC (rev 259813)
+++ trunk/Source/WTF/wtf/persistence/PersistentCoders.cpp 2020-04-09 19:33:20 UTC (rev 259814)
@@ -106,7 +106,7 @@
}
template <typename CharacterType>
-static inline bool decodeStringText(Decoder& decoder, uint32_t length, String& result)
+static inline WARN_UNUSED_RETURN bool decodeStringText(Decoder& decoder, uint32_t length, String& result)
{
// Before allocating the string, make sure that the decoder buffer is big enough.
if (!decoder.bufferIsLargeEnoughToContain<CharacterType>(length))
Modified: trunk/Source/WTF/wtf/persistence/PersistentCoders.h (259813 => 259814)
--- trunk/Source/WTF/wtf/persistence/PersistentCoders.h 2020-04-09 19:23:10 UTC (rev 259813)
+++ trunk/Source/WTF/wtf/persistence/PersistentCoders.h 2020-04-09 19:33:20 UTC (rev 259814)
@@ -46,7 +46,7 @@
encoder << pair.first << pair.second;
}
- static bool decode(Decoder& decoder, std::pair<T, U>& pair)
+ static WARN_UNUSED_RETURN bool decode(Decoder& decoder, std::pair<T, U>& pair)
{
T first;
if (!decoder.decode(first))
@@ -74,7 +74,7 @@
encoder << optional.value();
}
- static bool decode(Decoder& decoder, Optional<T>& optional)
+ static WARN_UNUSED_RETURN bool decode(Decoder& decoder, Optional<T>& optional)
{
bool isEngaged;
if (!decoder.decode(isEngaged))
@@ -100,7 +100,7 @@
encoder << pair.key << pair.value;
}
- static bool decode(Decoder& decoder, WTF::KeyValuePair<KeyType, ValueType>& pair)
+ static WARN_UNUSED_RETURN bool decode(Decoder& decoder, WTF::KeyValuePair<KeyType, ValueType>& pair)
{
KeyType key;
if (!decoder.decode(key))
@@ -126,7 +126,7 @@
encoder << vector[i];
}
- static bool decode(Decoder& decoder, Vector<T, inlineCapacity>& vector)
+ static WARN_UNUSED_RETURN bool decode(Decoder& decoder, Vector<T, inlineCapacity>& vector)
{
uint64_t size;
if (!decoder.decode(size))
@@ -154,7 +154,7 @@
encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(vector.data()), vector.size() * sizeof(T));
}
- static bool decode(Decoder& decoder, Vector<T, inlineCapacity>& vector)
+ static WARN_UNUSED_RETURN bool decode(Decoder& decoder, Vector<T, inlineCapacity>& vector)
{
uint64_t decodedSize;
if (!decoder.decode(decodedSize))
@@ -174,7 +174,8 @@
Vector<T, inlineCapacity> temp;
temp.grow(size);
- decoder.decodeFixedLengthData(reinterpret_cast<uint8_t*>(temp.data()), size * sizeof(T));
+ if (!decoder.decodeFixedLengthData(reinterpret_cast<uint8_t*>(temp.data()), size * sizeof(T)))
+ return false;
vector.swap(temp);
return true;
@@ -193,7 +194,7 @@
encoder << *it;
}
- static bool decode(Decoder& decoder, HashMapType& hashMap)
+ static WARN_UNUSED_RETURN bool decode(Decoder& decoder, HashMapType& hashMap)
{
uint64_t hashMapSize;
if (!decoder.decode(hashMapSize))
@@ -230,7 +231,7 @@
encoder << *it;
}
- static bool decode(Decoder& decoder, HashSetType& hashSet)
+ static WARN_UNUSED_RETURN bool decode(Decoder& decoder, HashSetType& hashSet)
{
uint64_t hashSetSize;
if (!decoder.decode(hashSetSize))
@@ -259,7 +260,7 @@
encoder << seconds.value();
}
- static bool decode(Decoder& decoder, Seconds& result)
+ static WARN_UNUSED_RETURN bool decode(Decoder& decoder, Seconds& result)
{
double value;
if (!decoder.decode(value))
@@ -276,7 +277,7 @@
encoder << time.secondsSinceEpoch().value();
}
- static bool decode(Decoder& decoder, WallTime& result)
+ static WARN_UNUSED_RETURN bool decode(Decoder& decoder, WallTime& result)
{
double value;
if (!decoder.decode(value))
@@ -289,22 +290,22 @@
template<> struct Coder<AtomString> {
WTF_EXPORT_PRIVATE static void encode(Encoder&, const AtomString&);
- WTF_EXPORT_PRIVATE static bool decode(Decoder&, AtomString&);
+ WTF_EXPORT_PRIVATE static bool decode(Decoder&, AtomString&) WARN_UNUSED_RETURN;
};
template<> struct Coder<CString> {
WTF_EXPORT_PRIVATE static void encode(Encoder&, const CString&);
- WTF_EXPORT_PRIVATE static bool decode(Decoder&, CString&);
+ WTF_EXPORT_PRIVATE static bool decode(Decoder&, CString&) WARN_UNUSED_RETURN;
};
template<> struct Coder<String> {
WTF_EXPORT_PRIVATE static void encode(Encoder&, const String&);
- WTF_EXPORT_PRIVATE static bool decode(Decoder&, String&);
+ WTF_EXPORT_PRIVATE static bool decode(Decoder&, String&) WARN_UNUSED_RETURN;
};
template<> struct Coder<SHA1::Digest> {
WTF_EXPORT_PRIVATE static void encode(Encoder&, const SHA1::Digest&);
- WTF_EXPORT_PRIVATE static bool decode(Decoder&, SHA1::Digest&);
+ WTF_EXPORT_PRIVATE static bool decode(Decoder&, SHA1::Digest&) WARN_UNUSED_RETURN;
};
}
Modified: trunk/Source/WTF/wtf/persistence/PersistentDecoder.h (259813 => 259814)
--- trunk/Source/WTF/wtf/persistence/PersistentDecoder.h 2020-04-09 19:23:10 UTC (rev 259813)
+++ trunk/Source/WTF/wtf/persistence/PersistentDecoder.h 2020-04-09 19:33:20 UTC (rev 259814)
@@ -41,22 +41,23 @@
size_t length() const { return m_bufferEnd - m_buffer; }
size_t currentOffset() const { return m_bufferPosition - m_buffer; }
- WTF_EXPORT_PRIVATE bool verifyChecksum();
+ WTF_EXPORT_PRIVATE bool verifyChecksum() WARN_UNUSED_RETURN;
- WTF_EXPORT_PRIVATE bool decodeFixedLengthData(uint8_t*, size_t);
+ WTF_EXPORT_PRIVATE bool decodeFixedLengthData(uint8_t*, size_t) WARN_UNUSED_RETURN;
- WTF_EXPORT_PRIVATE bool decode(bool&);
- WTF_EXPORT_PRIVATE bool decode(uint8_t&);
- WTF_EXPORT_PRIVATE bool decode(uint16_t&);
- WTF_EXPORT_PRIVATE bool decode(uint32_t&);
- WTF_EXPORT_PRIVATE bool decode(uint64_t&);
- WTF_EXPORT_PRIVATE bool decode(int16_t&);
- WTF_EXPORT_PRIVATE bool decode(int32_t&);
- WTF_EXPORT_PRIVATE bool decode(int64_t&);
- WTF_EXPORT_PRIVATE bool decode(float&);
- WTF_EXPORT_PRIVATE bool decode(double&);
+ WTF_EXPORT_PRIVATE bool decode(bool&) WARN_UNUSED_RETURN;
+ WTF_EXPORT_PRIVATE bool decode(uint8_t&) WARN_UNUSED_RETURN;
+ WTF_EXPORT_PRIVATE bool decode(uint16_t&) WARN_UNUSED_RETURN;
+ WTF_EXPORT_PRIVATE bool decode(uint32_t&) WARN_UNUSED_RETURN;
+ WTF_EXPORT_PRIVATE bool decode(uint64_t&) WARN_UNUSED_RETURN;
+ WTF_EXPORT_PRIVATE bool decode(int16_t&) WARN_UNUSED_RETURN;
+ WTF_EXPORT_PRIVATE bool decode(int32_t&) WARN_UNUSED_RETURN;
+ WTF_EXPORT_PRIVATE bool decode(int64_t&) WARN_UNUSED_RETURN;
+ WTF_EXPORT_PRIVATE bool decode(float&) WARN_UNUSED_RETURN;
+ WTF_EXPORT_PRIVATE bool decode(double&) WARN_UNUSED_RETURN;
- template<typename E> auto decode(E& e) -> std::enable_if_t<std::is_enum<E>::value, bool>
+ template<typename E> WARN_UNUSED_RETURN
+ auto decode(E& e) -> std::enable_if_t<std::is_enum<E>::value, bool>
{
uint64_t value;
if (!decode(value))
@@ -68,7 +69,8 @@
return true;
}
- template<typename T> bool decodeEnum(T& result)
+ template<typename T> WARN_UNUSED_RETURN
+ bool decodeEnum(T& result)
{
static_assert(sizeof(T) <= 8, "Enum type T must not be larger than 64 bits!");
@@ -80,12 +82,13 @@
return true;
}
- template<typename T> auto decode(T& t) -> std::enable_if_t<!std::is_enum<T>::value, bool>
+ template<typename T> WARN_UNUSED_RETURN
+ auto decode(T& t) -> std::enable_if_t<!std::is_enum<T>::value, bool>
{
return Coder<T>::decode(*this, t);
}
- template<typename T>
+ template<typename T> WARN_UNUSED_RETURN
bool bufferIsLargeEnoughToContain(size_t numElements) const
{
static_assert(std::is_arithmetic<T>::value, "Type T must have a fixed, known encoded size!");
@@ -99,8 +102,8 @@
static constexpr bool isIPCDecoder = false;
private:
- WTF_EXPORT_PRIVATE bool bufferIsLargeEnoughToContain(size_t) const;
- template<typename Type> bool decodeNumber(Type&);
+ WTF_EXPORT_PRIVATE bool bufferIsLargeEnoughToContain(size_t) const WARN_UNUSED_RETURN;
+ template<typename Type> bool decodeNumber(Type&) WARN_UNUSED_RETURN;
const uint8_t* m_buffer;
const uint8_t* m_bufferPosition;