Log Message
Follow-up: Add WARN_UNUSED_RETURN to decode methods in Source/WebKit/Platform/IPC <https://webkit.org/b/210316> <rdar://problem/61559305>
Changes based on feedback from Alex Christensen and Darin Adler: - Remove WARN_UNUSED_RETURN from methods returning Optional<>. - Place WARN_UNUSED_RETURN consistently before the return type. * Platform/IPC/ArgumentCoder.h: * Platform/IPC/ArgumentCoders.cpp: * Platform/IPC/ArgumentCoders.h: (IPC::ArgumentCoder<OptionSet<T>>::decode): (IPC::ArgumentCoder<Optional<T>>::decode): (IPC::ArgumentCoder<Box<T>>::decode): (IPC::TupleDecoderImpl::decode): (IPC::TupleDecoderImpl<Type>::decode): (IPC::TupleDecoder::decode): (IPC::TupleDecoder<0>::decode): (IPC::VariantCoder::decode): * Platform/IPC/Attachment.h: * Platform/IPC/DataReference.h: * Platform/IPC/Decoder.h: * Platform/IPC/FormDataReference.h: (IPC::FormDataReference::decode): * Platform/IPC/ImageDataReference.h: (IPC::ImageDataReference::decode): * Platform/IPC/SharedBufferDataReference.h: (IPC::SharedBufferDataReference::decode): * Platform/IPC/StringReference.h:
Modified Paths
- trunk/Source/WebKit/ChangeLog
- trunk/Source/WebKit/Platform/IPC/ArgumentCoder.h
- trunk/Source/WebKit/Platform/IPC/ArgumentCoders.cpp
- trunk/Source/WebKit/Platform/IPC/ArgumentCoders.h
- trunk/Source/WebKit/Platform/IPC/Attachment.h
- trunk/Source/WebKit/Platform/IPC/DataReference.h
- trunk/Source/WebKit/Platform/IPC/Decoder.h
- trunk/Source/WebKit/Platform/IPC/FormDataReference.h
- trunk/Source/WebKit/Platform/IPC/ImageDataReference.h
- trunk/Source/WebKit/Platform/IPC/SharedBufferDataReference.h
- trunk/Source/WebKit/Platform/IPC/StringReference.h
Diff
Modified: trunk/Source/WebKit/ChangeLog (259939 => 259940)
--- trunk/Source/WebKit/ChangeLog 2020-04-12 03:13:17 UTC (rev 259939)
+++ trunk/Source/WebKit/ChangeLog 2020-04-12 04:32:41 UTC (rev 259940)
@@ -1,5 +1,37 @@
2020-04-11 David Kilzer <[email protected]>
+ Follow-up: Add WARN_UNUSED_RETURN to decode methods in Source/WebKit/Platform/IPC
+ <https://webkit.org/b/210316>
+ <rdar://problem/61559305>
+
+ Changes based on feedback from Alex Christensen and Darin Adler:
+ - Remove WARN_UNUSED_RETURN from methods returning Optional<>.
+ - Place WARN_UNUSED_RETURN consistently before the return type.
+
+ * Platform/IPC/ArgumentCoder.h:
+ * Platform/IPC/ArgumentCoders.cpp:
+ * Platform/IPC/ArgumentCoders.h:
+ (IPC::ArgumentCoder<OptionSet<T>>::decode):
+ (IPC::ArgumentCoder<Optional<T>>::decode):
+ (IPC::ArgumentCoder<Box<T>>::decode):
+ (IPC::TupleDecoderImpl::decode):
+ (IPC::TupleDecoderImpl<Type>::decode):
+ (IPC::TupleDecoder::decode):
+ (IPC::TupleDecoder<0>::decode):
+ (IPC::VariantCoder::decode):
+ * Platform/IPC/Attachment.h:
+ * Platform/IPC/DataReference.h:
+ * Platform/IPC/Decoder.h:
+ * Platform/IPC/FormDataReference.h:
+ (IPC::FormDataReference::decode):
+ * Platform/IPC/ImageDataReference.h:
+ (IPC::ImageDataReference::decode):
+ * Platform/IPC/SharedBufferDataReference.h:
+ (IPC::SharedBufferDataReference::decode):
+ * Platform/IPC/StringReference.h:
+
+2020-04-11 David Kilzer <[email protected]>
+
Follow-up: Add WARN_UNUSED_RETURN to decode methods in WebCoreArgumentCoders
<https://webkit.org/b/210322>
<rdar://problem/61565148>
Modified: trunk/Source/WebKit/Platform/IPC/ArgumentCoder.h (259939 => 259940)
--- trunk/Source/WebKit/Platform/IPC/ArgumentCoder.h 2020-04-12 03:13:17 UTC (rev 259939)
+++ trunk/Source/WebKit/Platform/IPC/ArgumentCoder.h 2020-04-12 04:32:41 UTC (rev 259940)
@@ -105,7 +105,7 @@
return U::decode(decoder, u);
}
- template<typename U = T, std::enable_if_t<UsesModernDecoder<U>::argumentCoderValue>* = nullptr> WARN_UNUSED_RETURN
+ template<typename U = T, std::enable_if_t<UsesModernDecoder<U>::argumentCoderValue>* = nullptr>
static Optional<U> decode(Decoder& decoder)
{
return U::decode(decoder);
Modified: trunk/Source/WebKit/Platform/IPC/ArgumentCoders.cpp (259939 => 259940)
--- trunk/Source/WebKit/Platform/IPC/ArgumentCoders.cpp 2020-04-12 03:13:17 UTC (rev 259939)
+++ trunk/Source/WebKit/Platform/IPC/ArgumentCoders.cpp 2020-04-12 04:32:41 UTC (rev 259940)
@@ -131,7 +131,7 @@
encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(string.characters16()), length * sizeof(UChar), alignof(UChar));
}
-template <typename CharacterType> WARN_UNUSED_RETURN
+template <typename CharacterType>
static inline Optional<String> decodeStringText(Decoder& decoder, uint32_t length)
{
// Before allocating the string, make sure that the decoder buffer is big enough.
Modified: trunk/Source/WebKit/Platform/IPC/ArgumentCoders.h (259939 => 259940)
--- trunk/Source/WebKit/Platform/IPC/ArgumentCoders.h 2020-04-12 03:13:17 UTC (rev 259939)
+++ trunk/Source/WebKit/Platform/IPC/ArgumentCoders.h 2020-04-12 04:32:41 UTC (rev 259940)
@@ -68,7 +68,7 @@
return true;
}
- static WARN_UNUSED_RETURN Optional<OptionSet<T>> decode(Decoder& decoder)
+ static Optional<OptionSet<T>> decode(Decoder& decoder)
{
Optional<uint64_t> value;
decoder >> value;
@@ -109,7 +109,7 @@
return true;
}
- static WARN_UNUSED_RETURN Optional<Optional<T>> decode(Decoder& decoder)
+ static Optional<Optional<T>> decode(Decoder& decoder)
{
Optional<bool> isEngaged;
decoder >> isEngaged;
@@ -157,7 +157,7 @@
return true;
}
- static WARN_UNUSED_RETURN Optional<Box<T>> decode(Decoder& decoder)
+ static Optional<Box<T>> decode(Decoder& decoder)
{
Optional<bool> isEngaged;
decoder >> isEngaged;
@@ -195,7 +195,7 @@
return true;
}
- static WARN_UNUSED_RETURN Optional<std::pair<T, U>> decode(Decoder& decoder)
+ static Optional<std::pair<T, U>> decode(Decoder& decoder)
{
Optional<T> first;
decoder >> first;
@@ -241,7 +241,7 @@
template<typename Type, typename... Types>
struct TupleDecoderImpl {
- static WARN_UNUSED_RETURN Optional<std::tuple<Type, Types...>> decode(Decoder& decoder)
+ static Optional<std::tuple<Type, Types...>> decode(Decoder& decoder)
{
Optional<Type> optional;
decoder >> optional;
@@ -258,7 +258,7 @@
template<typename Type>
struct TupleDecoderImpl<Type> {
- static WARN_UNUSED_RETURN Optional<std::tuple<Type>> decode(Decoder& decoder)
+ static Optional<std::tuple<Type>> decode(Decoder& decoder)
{
Optional<Type> optional;
decoder >> optional;
@@ -270,7 +270,7 @@
template<size_t size, typename... Elements>
struct TupleDecoder {
- static WARN_UNUSED_RETURN Optional<std::tuple<Elements...>> decode(Decoder& decoder)
+ static Optional<std::tuple<Elements...>> decode(Decoder& decoder)
{
return TupleDecoderImpl<Elements...>::decode(decoder);
}
@@ -278,7 +278,7 @@
template<>
struct TupleDecoder<0> {
- static WARN_UNUSED_RETURN Optional<std::tuple<>> decode(Decoder&)
+ static Optional<std::tuple<>> decode(Decoder&)
{
return std::make_tuple();
}
@@ -290,7 +290,7 @@
TupleEncoder<sizeof...(Elements), Elements...>::encode(encoder, tuple);
}
- static WARN_UNUSED_RETURN Optional<std::tuple<Elements...>> decode(Decoder& decoder)
+ static Optional<std::tuple<Elements...>> decode(Decoder& decoder)
{
return TupleDecoder<sizeof...(Elements), Elements...>::decode(decoder);
}
@@ -338,7 +338,7 @@
return true;
}
- static WARN_UNUSED_RETURN Optional<Vector<T, inlineCapacity, OverflowHandler, minCapacity>> decode(Decoder& decoder)
+ static Optional<Vector<T, inlineCapacity, OverflowHandler, minCapacity>> decode(Decoder& decoder)
{
uint64_t size;
if (!decoder.decode(size))
@@ -399,7 +399,7 @@
return true;
}
- static WARN_UNUSED_RETURN Optional<Vector<T, inlineCapacity, OverflowHandler, minCapacity>> decode(Decoder& decoder)
+ static Optional<Vector<T, inlineCapacity, OverflowHandler, minCapacity>> decode(Decoder& decoder)
{
uint64_t decodedSize;
if (!decoder.decode(decodedSize)) {
@@ -446,7 +446,7 @@
encoder << *it;
}
- static WARN_UNUSED_RETURN Optional<HashMapType> decode(Decoder& decoder)
+ static Optional<HashMapType> decode(Decoder& decoder)
{
uint32_t hashMapSize;
if (!decoder.decode(hashMapSize))
@@ -511,7 +511,7 @@
return true;
}
- static WARN_UNUSED_RETURN Optional<HashSetType> decode(Decoder& decoder)
+ static Optional<HashSetType> decode(Decoder& decoder)
{
uint64_t hashSetSize;
if (!decoder.decode(hashSetSize))
@@ -598,7 +598,7 @@
encoder << expected.value();
}
- static WARN_UNUSED_RETURN Optional<Expected<ValueType, ErrorType>> decode(Decoder& decoder)
+ static Optional<Expected<ValueType, ErrorType>> decode(Decoder& decoder)
{
Optional<bool> hasValue;
decoder >> hasValue;
@@ -633,7 +633,7 @@
VariantCoder<index - 1, Types...>::encode(encoder, variant, i);
}
- static WARN_UNUSED_RETURN Optional<WTF::Variant<Types...>> decode(Decoder& decoder, unsigned i)
+ static Optional<WTF::Variant<Types...>> decode(Decoder& decoder, unsigned i)
{
if (i == index) {
Optional<typename WTF::variant_alternative<index, WTF::Variant<Types...>>::type> optional;
@@ -654,7 +654,7 @@
encoder << WTF::get<0>(variant);
}
- static WARN_UNUSED_RETURN Optional<WTF::Variant<Types...>> decode(Decoder& decoder, unsigned i)
+ static Optional<WTF::Variant<Types...>> decode(Decoder& decoder, unsigned i)
{
ASSERT_UNUSED(i, !i);
Optional<typename WTF::variant_alternative<0, WTF::Variant<Types...>>::type> optional;
@@ -673,7 +673,7 @@
VariantCoder<sizeof...(Types) - 1, Types...>::encode(encoder, variant, i);
}
- static WARN_UNUSED_RETURN Optional<WTF::Variant<Types...>> decode(Decoder& decoder)
+ static Optional<WTF::Variant<Types...>> decode(Decoder& decoder)
{
Optional<unsigned> i;
decoder >> i;
@@ -685,41 +685,41 @@
template<> struct ArgumentCoder<WallTime> {
static void encode(Encoder&, const WallTime&);
- static bool decode(Decoder&, WallTime&) WARN_UNUSED_RETURN;
- static Optional<WallTime> decode(Decoder&) WARN_UNUSED_RETURN;
+ static WARN_UNUSED_RETURN bool decode(Decoder&, WallTime&);
+ static Optional<WallTime> decode(Decoder&);
};
template<> struct ArgumentCoder<AtomString> {
static void encode(Encoder&, const AtomString&);
- static bool decode(Decoder&, AtomString&) WARN_UNUSED_RETURN;
+ static WARN_UNUSED_RETURN bool decode(Decoder&, AtomString&);
};
template<> struct ArgumentCoder<CString> {
static void encode(Encoder&, const CString&);
- static bool decode(Decoder&, CString&) WARN_UNUSED_RETURN;
+ static WARN_UNUSED_RETURN bool decode(Decoder&, CString&);
};
template<> struct ArgumentCoder<String> {
static void encode(Encoder&, const String&);
- static bool decode(Decoder&, String&) WARN_UNUSED_RETURN;
- static Optional<String> decode(Decoder&) WARN_UNUSED_RETURN;
+ static WARN_UNUSED_RETURN bool decode(Decoder&, String&);
+ static Optional<String> decode(Decoder&);
};
template<> struct ArgumentCoder<SHA1::Digest> {
static void encode(Encoder&, const SHA1::Digest&);
- static bool decode(Decoder&, SHA1::Digest&) WARN_UNUSED_RETURN;
+ static WARN_UNUSED_RETURN bool decode(Decoder&, SHA1::Digest&);
};
#if HAVE(AUDIT_TOKEN)
template<> struct ArgumentCoder<audit_token_t> {
static void encode(Encoder&, const audit_token_t&);
- static bool decode(Decoder&, audit_token_t&) WARN_UNUSED_RETURN;
+ static WARN_UNUSED_RETURN bool decode(Decoder&, audit_token_t&);
};
#endif
template<> struct ArgumentCoder<Monostate> {
static void encode(Encoder&, const Monostate&);
- static Optional<Monostate> decode(Decoder&) WARN_UNUSED_RETURN;
+ static Optional<Monostate> decode(Decoder&);
};
} // namespace IPC
Modified: trunk/Source/WebKit/Platform/IPC/Attachment.h (259939 => 259940)
--- trunk/Source/WebKit/Platform/IPC/Attachment.h 2020-04-12 03:13:17 UTC (rev 259939)
+++ trunk/Source/WebKit/Platform/IPC/Attachment.h 2020-04-12 04:32:41 UTC (rev 259940)
@@ -86,7 +86,7 @@
#endif
void encode(Encoder&) const;
- static bool decode(Decoder&, Attachment&) WARN_UNUSED_RETURN;
+ static WARN_UNUSED_RETURN bool decode(Decoder&, Attachment&);
private:
Type m_type;
Modified: trunk/Source/WebKit/Platform/IPC/DataReference.h (259939 => 259940)
--- trunk/Source/WebKit/Platform/IPC/DataReference.h 2020-04-12 03:13:17 UTC (rev 259939)
+++ trunk/Source/WebKit/Platform/IPC/DataReference.h 2020-04-12 04:32:41 UTC (rev 259940)
@@ -68,7 +68,7 @@
}
void encode(Encoder&) const;
- static bool decode(Decoder&, DataReference&) WARN_UNUSED_RETURN;
+ static WARN_UNUSED_RETURN bool decode(Decoder&, DataReference&);
private:
const uint8_t* m_data { nullptr };
Modified: trunk/Source/WebKit/Platform/IPC/Decoder.h (259939 => 259940)
--- trunk/Source/WebKit/Platform/IPC/Decoder.h 2020-04-12 03:13:17 UTC (rev 259939)
+++ trunk/Source/WebKit/Platform/IPC/Decoder.h 2020-04-12 04:32:41 UTC (rev 259940)
@@ -78,30 +78,30 @@
}
void markInvalid() { m_bufferPos = nullptr; }
- bool decodeFixedLengthData(uint8_t*, size_t, unsigned alignment) WARN_UNUSED_RETURN;
+ WARN_UNUSED_RETURN bool decodeFixedLengthData(uint8_t*, size_t, unsigned alignment);
// The data in the data reference here will only be valid for the lifetime of the ArgumentDecoder object.
- bool decodeVariableLengthByteArray(DataReference&) WARN_UNUSED_RETURN;
+ WARN_UNUSED_RETURN bool decodeVariableLengthByteArray(DataReference&);
- bool decode(bool&) WARN_UNUSED_RETURN;
+ WARN_UNUSED_RETURN bool decode(bool&);
Decoder& operator>>(Optional<bool>&);
- bool decode(uint8_t&) WARN_UNUSED_RETURN;
+ WARN_UNUSED_RETURN bool decode(uint8_t&);
Decoder& operator>>(Optional<uint8_t>&);
- bool decode(uint16_t&) WARN_UNUSED_RETURN;
+ WARN_UNUSED_RETURN bool decode(uint16_t&);
Decoder& operator>>(Optional<uint16_t>&);
- bool decode(uint32_t&) WARN_UNUSED_RETURN;
+ WARN_UNUSED_RETURN bool decode(uint32_t&);
Decoder& operator>>(Optional<uint32_t>&);
- bool decode(uint64_t&) WARN_UNUSED_RETURN;
+ WARN_UNUSED_RETURN bool decode(uint64_t&);
Decoder& operator>>(Optional<uint64_t>&);
- bool decode(int16_t&) WARN_UNUSED_RETURN;
+ WARN_UNUSED_RETURN bool decode(int16_t&);
Decoder& operator>>(Optional<int16_t>&);
- bool decode(int32_t&) WARN_UNUSED_RETURN;
+ WARN_UNUSED_RETURN bool decode(int32_t&);
Decoder& operator>>(Optional<int32_t>&);
- bool decode(int64_t&) WARN_UNUSED_RETURN;
+ WARN_UNUSED_RETURN bool decode(int64_t&);
Decoder& operator>>(Optional<int64_t>&);
- bool decode(float&) WARN_UNUSED_RETURN;
+ WARN_UNUSED_RETURN bool decode(float&);
Decoder& operator>>(Optional<float>&);
- bool decode(double&) WARN_UNUSED_RETURN;
+ WARN_UNUSED_RETURN bool decode(double&);
Decoder& operator>>(Optional<double>&);
template<typename E, typename = std::enable_if_t<std::is_enum<E>::value>> WARN_UNUSED_RETURN
Modified: trunk/Source/WebKit/Platform/IPC/FormDataReference.h (259939 => 259940)
--- trunk/Source/WebKit/Platform/IPC/FormDataReference.h 2020-04-12 03:13:17 UTC (rev 259939)
+++ trunk/Source/WebKit/Platform/IPC/FormDataReference.h 2020-04-12 04:32:41 UTC (rev 259940)
@@ -67,7 +67,7 @@
encoder << sandboxExtensionHandles;
}
- static WARN_UNUSED_RETURN Optional<FormDataReference> decode(Decoder& decoder)
+ static Optional<FormDataReference> decode(Decoder& decoder)
{
Optional<bool> hasFormData;
decoder >> hasFormData;
Modified: trunk/Source/WebKit/Platform/IPC/ImageDataReference.h (259939 => 259940)
--- trunk/Source/WebKit/Platform/IPC/ImageDataReference.h 2020-04-12 03:13:17 UTC (rev 259939)
+++ trunk/Source/WebKit/Platform/IPC/ImageDataReference.h 2020-04-12 04:32:41 UTC (rev 259940)
@@ -46,7 +46,7 @@
encoder << m_imageData;
}
- static WARN_UNUSED_RETURN Optional<ImageDataReference> decode(Decoder& decoder)
+ static Optional<ImageDataReference> decode(Decoder& decoder)
{
Optional<RefPtr<WebCore::ImageData>> imageData;
decoder >> imageData;
Modified: trunk/Source/WebKit/Platform/IPC/SharedBufferDataReference.h (259939 => 259940)
--- trunk/Source/WebKit/Platform/IPC/SharedBufferDataReference.h 2020-04-12 03:13:17 UTC (rev 259939)
+++ trunk/Source/WebKit/Platform/IPC/SharedBufferDataReference.h 2020-04-12 04:32:41 UTC (rev 259940)
@@ -53,7 +53,7 @@
encoder << m_buffer;
}
- static WARN_UNUSED_RETURN Optional<SharedBufferDataReference> decode(Decoder& decoder)
+ static Optional<SharedBufferDataReference> decode(Decoder& decoder)
{
Optional<RefPtr<WebCore::SharedBuffer>> buffer;
decoder >> buffer;
Modified: trunk/Source/WebKit/Platform/IPC/StringReference.h (259939 => 259940)
--- trunk/Source/WebKit/Platform/IPC/StringReference.h 2020-04-12 03:13:17 UTC (rev 259939)
+++ trunk/Source/WebKit/Platform/IPC/StringReference.h 2020-04-12 04:32:41 UTC (rev 259940)
@@ -64,7 +64,7 @@
CString toString() const;
void encode(Encoder&) const;
- static bool decode(Decoder&, StringReference&) WARN_UNUSED_RETURN;
+ static WARN_UNUSED_RETURN bool decode(Decoder&, StringReference&);
struct Hash {
static unsigned hash(const StringReference& a);
_______________________________________________ webkit-changes mailing list [email protected] https://lists.webkit.org/mailman/listinfo/webkit-changes
