Auto-generate files after cl/605718863
diff --git a/ruby/ext/google/protobuf_c/ruby-upb.h b/ruby/ext/google/protobuf_c/ruby-upb.h
index 5ab3438..10f4b2d 100755
--- a/ruby/ext/google/protobuf_c/ruby-upb.h
+++ b/ruby/ext/google/protobuf_c/ruby-upb.h
@@ -3516,9 +3516,9 @@
const upb_MiniTableField* field, upb_Arena* arena) {
UPB_ASSUME(upb_MiniTableField_CType(field) == kUpb_CType_Message);
const upb_MiniTableField* map_entry_key_field =
- &map_entry_mini_table->UPB_PRIVATE(fields)[0];
+ &map_entry_mini_table->UPB_ONLYBITS(fields)[0];
const upb_MiniTableField* map_entry_value_field =
- &map_entry_mini_table->UPB_PRIVATE(fields)[1];
+ &map_entry_mini_table->UPB_ONLYBITS(fields)[1];
return _upb_Message_GetOrCreateMutableMap(
msg, field,
_upb_Map_CTypeSize(upb_MiniTableField_CType(map_entry_key_field)),
@@ -12440,6 +12440,8 @@
#ifndef UPB_MESSAGE_COMPARE_H_
#define UPB_MESSAGE_COMPARE_H_
+#include <stddef.h>
+
// Must be last.
@@ -12447,15 +12449,24 @@
extern "C" {
#endif
+// Returns true if no known fields or extensions are set in the message.
+UPB_API bool upb_Message_IsEmpty(const upb_Message* msg,
+ const upb_MiniTable* m);
+
+UPB_API bool upb_Message_IsEqual(const upb_Message* msg1,
+ const upb_Message* msg2,
+ const upb_MiniTable* m);
+
// Compares two messages by serializing them and calling memcmp().
UPB_API bool upb_Message_IsExactlyEqual(const upb_Message* msg1,
const upb_Message* msg2,
const upb_MiniTable* m);
-// Performs a shallow field comparison. Do not use on message types.
+// If |ctype| is a message then |m| must point to its minitable.
UPB_API_INLINE bool upb_MessageValue_IsEqual(upb_MessageValue val1,
upb_MessageValue val2,
- upb_CType ctype) {
+ upb_CType ctype,
+ const upb_MiniTable* m) {
switch (ctype) {
case kUpb_CType_Bool:
return val1.bool_val == val2.bool_val;
@@ -12475,8 +12486,11 @@
case kUpb_CType_Bytes:
return upb_StringView_IsEqual(val1.str_val, val2.str_val);
- default: // Note: This includes kUpb_CType_Message
- UPB_ASSERT(0);
+ case kUpb_CType_Message:
+ return upb_Message_IsEqual(val1.msg_val, val2.msg_val, m);
+
+ default:
+ UPB_UNREACHABLE();
return false;
}
}
@@ -12488,6 +12502,47 @@
#endif // UPB_MESSAGE_COMPARE_H_
+#ifndef UPB_MESSAGE_INTERNAL_COMPARE_UNKNOWN_H_
+#define UPB_MESSAGE_INTERNAL_COMPARE_UNKNOWN_H_
+
+#include <stddef.h>
+
+// Must be last.
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Returns true if unknown fields from the two messages are equal when sorted
+// and varints are made canonical.
+//
+// This function is discouraged, as the comparison is inherently lossy without
+// schema data:
+//
+// 1. We don't know whether delimited fields are sub-messages. Unknown
+// sub-messages will therefore not have their fields sorted and varints
+// canonicalized.
+// 2. We don't know about oneof/non-repeated fields, which should semantically
+// discard every value except the last.
+
+typedef enum {
+ kUpb_UnknownCompareResult_Equal = 0,
+ kUpb_UnknownCompareResult_NotEqual = 1,
+ kUpb_UnknownCompareResult_OutOfMemory = 2,
+ kUpb_UnknownCompareResult_MaxDepthExceeded = 3,
+} upb_UnknownCompareResult;
+
+upb_UnknownCompareResult UPB_PRIVATE(_upb_Message_UnknownFieldsAreEqual)(
+ const char* buf1, size_t size1, const char* buf2, size_t size2,
+ int max_depth);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+
+#endif /* UPB_MESSAGE_INTERNAL_COMPARE_UNKNOWN_H_ */
+
#ifndef UPB_MESSAGE_COPY_H_
#define UPB_MESSAGE_COPY_H_