google-protobuf 4.36.0.rc.1-java → 4.36.0.rc.2-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2ff1983746babc0e8b07f40e3d38c5901733c130d3f640c53b218ea046bac02
4
- data.tar.gz: e51984fb1aa0128a550d746cf7d5b8b50d70053c5299ee5b16965536197385ac
3
+ metadata.gz: 8d9dffc55681df43257477cac82d0254992a1f257415f19ad2959e31431cb0fc
4
+ data.tar.gz: 2933b25103a39296336bc8501b9341281da8fe70b828d223736bc8092cc17c63
5
5
  SHA512:
6
- metadata.gz: 15537cd1e0b89f2650c26b38d3bebde76e21983563566666ad9a31647464f89e1d4f9ab82e0795aa10df2659312a20961f727d5e72197138bf06a5bf536f4461
7
- data.tar.gz: f9c2cbae3b59545d8b0ebf59d621caf8ee182eae76b44e626439ab36d49f7ac81ae936ffc665103c55555d688d6569c5d4524e3113435623cf5ce7911e82ab1a
6
+ metadata.gz: 8e385e029b218f9e45519f8e5ce8d0f651d420897358cc163c6268f68492aee77d814813b90a604ae5e96ed1b05c2307963f3a2dab070bd08c1a82012639f857
7
+ data.tar.gz: 35a135328b8b9345e1e7ecc03cf5a934af62a99108450c05a42fbe7153561eed4a5f5509b618d1307554b289df621a74929f3c0f07da70675af6aac423b68d8f
@@ -38,6 +38,13 @@
38
38
  #define UPB_GNUC_MIN(x, y) 0
39
39
  #endif
40
40
 
41
+ #if defined(__clang__) && defined(__clang_major__) && defined(__clang_minor__)
42
+ #define UPB_CLANG_MIN(x, y) \
43
+ (__clang_major__ > (x) || __clang_major__ == (x) && __clang_minor__ >= (y))
44
+ #else
45
+ #define UPB_CLANG_MIN(x, y) 0
46
+ #endif
47
+
41
48
  // Macros for checking for compiler attributes, defined here to avoid the
42
49
  // problem described in
43
50
  // https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005fattribute.html.
@@ -602,10 +609,12 @@ Error, UINTPTR_MAX is undefined
602
609
  #define UPB_LINKARR_APPEND(name) \
603
610
  __attribute__(( \
604
611
  section("linkarr_" #name))) UPB_LINKARR_ATTR UPB_NO_SANITIZE_ADDRESS
605
- #define UPB_LINKARR_DECLARE(name, type) \
606
- extern type __start_linkarr_##name; \
607
- extern type __stop_linkarr_##name; \
608
- UPB_LINKARR_APPEND(name) \
612
+ #define UPB_LINKARR_DECLARE(name, type) \
613
+ UPB_STATIC_ASSERT(sizeof("__la_" #name) <= 17, \
614
+ "Linker array name too long for Mach-O (16-char limit)"); \
615
+ extern type __start_linkarr_##name; \
616
+ extern type __stop_linkarr_##name; \
617
+ UPB_LINKARR_APPEND(name) \
609
618
  UPB_LINKARR_SENTINEL type UPB_linkarr_internal_empty_##name[1]
610
619
  #define UPB_LINKARR_START(name) (&__start_linkarr_##name)
611
620
  #define UPB_LINKARR_STOP(name) (&__stop_linkarr_##name)
@@ -616,13 +625,15 @@ Error, UINTPTR_MAX is undefined
616
625
  #define UPB_LINKARR_APPEND(name) \
617
626
  __attribute__(( \
618
627
  section("__DATA,__la_" #name))) UPB_LINKARR_ATTR UPB_NO_SANITIZE_ADDRESS
619
- #define UPB_LINKARR_DECLARE(name, type) \
620
- extern type __start_linkarr_##name __asm( \
621
- "section$start$__DATA$__la_" #name); \
622
- extern type __stop_linkarr_##name __asm( \
623
- "section$end$__DATA$" \
624
- "__la_" #name); \
625
- UPB_LINKARR_APPEND(name) \
628
+ #define UPB_LINKARR_DECLARE(name, type) \
629
+ UPB_STATIC_ASSERT(sizeof("__la_" #name) <= 17, \
630
+ "Linker array name too long for Mach-O (16-char limit)"); \
631
+ extern type __start_linkarr_##name __asm( \
632
+ "section$start$__DATA$__la_" #name); \
633
+ extern type __stop_linkarr_##name __asm( \
634
+ "section$end$__DATA$" \
635
+ "__la_" #name); \
636
+ UPB_LINKARR_APPEND(name) \
626
637
  UPB_LINKARR_SENTINEL type UPB_linkarr_internal_empty_##name[1]
627
638
  #define UPB_LINKARR_START(name) (&__start_linkarr_##name)
628
639
  #define UPB_LINKARR_STOP(name) (&__stop_linkarr_##name)
@@ -660,7 +671,9 @@ Error, UINTPTR_MAX is undefined
660
671
 
661
672
  // Linker arrays are not supported on this platform. Make macros no-ops.
662
673
  #define UPB_LINKARR_APPEND(name)
663
- #define UPB_LINKARR_DECLARE(name, type)
674
+ #define UPB_LINKARR_DECLARE(name, type) \
675
+ UPB_STATIC_ASSERT(sizeof("__la_" #name) <= 17, \
676
+ "Linker array name too long for Mach-O (16-char limit)")
664
677
  #define UPB_LINKARR_START(name) (NULL)
665
678
  #define UPB_LINKARR_STOP(name) (NULL)
666
679
 
@@ -677,11 +690,46 @@ Error, UINTPTR_MAX is undefined
677
690
  #define _UPB_CONSTRUCTOR_PLACEHOLDER(unique_name)
678
691
  #endif
679
692
 
680
- #if defined(__ELF__) || defined(__wasm__) || defined(__MACH__)
681
- #define UPB_CONSTRUCTOR(name, unique_name) \
693
+ #define _UPB_STRINGIFY2(x) #x
694
+ #define _UPB_STRINGIFY(x) _UPB_STRINGIFY2(x)
695
+
696
+ #if defined(__ELF__) && (UPB_GNUC_MIN(15, 1) || UPB_CLANG_MIN(21, 1))
697
+ /*
698
+ * Workaround for b/456308964 and b/456317163. Although weak constructors
699
+ * resolve to a single function body, Clang still emits a pointer into
700
+ * .init_array for every translation unit, causing the constructor to be
701
+ * executed multiple times and inflating binary size. We wrap the .init_array
702
+ * entry in a COMDAT group (using inline assembly) to force the linker to
703
+ * deduplicate the pointer to exactly one instance. %cc is used in preference to
704
+ * the more widely available %c because %c may under some circumstances still
705
+ * output a function name including relocation information, which will then
706
+ * confuse the linker. This was only a problem on gcc; when %cc was introduced
707
+ * to clang it was just an alias to %c, and clang's %c had already done the
708
+ * checks that %cc introduced to gcc.
709
+ * References:
710
+ * https://github.com/gcc-mirror/gcc/commit/74d6a676034b3ab20c387f12f19f5597e4f1c9fa
711
+ * https://github.com/llvm/llvm-project/pull/127719#issuecomment-2686276305
712
+ */
713
+ #define UPB_CONSTRUCTOR(name, unique_name, ...) \
714
+ _UPB_CONSTRUCTOR_PLACEHOLDER(unique_name) \
715
+ __attribute__((weak, used, visibility("hidden"))) void UPB_PRIVATE(name)( \
716
+ void) { \
717
+ __asm__ volatile( \
718
+ ".pushsection .init_array,\"awG\",%%init_array, %cc0, comdat\n" \
719
+ ".dc.a %cc0\n" \
720
+ ".popsection\n" \
721
+ : \
722
+ : "X"(UPB_PRIVATE(name))); \
723
+ __VA_ARGS__ \
724
+ }
725
+ #elif defined(__ELF__) || defined(__wasm__) || defined(__MACH__) || \
726
+ defined(__MINGW32__)
727
+ #define UPB_CONSTRUCTOR(name, unique_name, ...) \
682
728
  _UPB_CONSTRUCTOR_PLACEHOLDER(unique_name) \
683
729
  __attribute__((weak, visibility("hidden"), constructor)) void UPB_PRIVATE( \
684
- name)(void)
730
+ name)(void) { \
731
+ __VA_ARGS__ \
732
+ }
685
733
  #elif defined(_MSC_VER)
686
734
  /*
687
735
  * See: https://stackoverflow.com/questions/1113409
@@ -692,17 +740,22 @@ Error, UINTPTR_MAX is undefined
692
740
  * create a dummy exported weak symbol that prevent this stripping.
693
741
  */
694
742
  #pragma section(".CRT$XCT", read)
695
- #define UPB_CONSTRUCTOR(name, unique_name) \
743
+ #define UPB_CONSTRUCTOR(name, unique_name, ...) \
696
744
  static void __cdecl UPB_PRIVATE(name)(void); \
697
745
  __declspec(allocate(".CRT$XCT"), selectany) void( \
698
746
  __cdecl * UPB_PRIVATE(name##_))(void) = UPB_PRIVATE(name); \
699
747
  __declspec(selectany, dllexport) void* UPB_PRIVATE(name##_force_linkage) = \
700
748
  &UPB_PRIVATE(name##_); \
701
- static void __cdecl UPB_PRIVATE(name)(void)
702
-
749
+ static void __cdecl UPB_PRIVATE(name)(void) { __VA_ARGS__ }
703
750
  #else
704
751
  // No constructor support, nothing we can do except not break builds.
705
- #define UPB_CONSTRUCTOR(name, unique_name) static void UPB_PRIVATE(name)(void)
752
+ #if defined(__GNUC__) || defined(__clang__)
753
+ #define UPB_CONSTRUCTOR(name, unique_name, ...) \
754
+ static __attribute__((used)) void UPB_PRIVATE(name)(void) { __VA_ARGS__ }
755
+ #else
756
+ #define UPB_CONSTRUCTOR(name, unique_name, ...) \
757
+ static void UPB_PRIVATE(name)(void) { __VA_ARGS__ }
758
+ #endif
706
759
  #endif
707
760
 
708
761
  //
@@ -740,9 +793,9 @@ Error, UINTPTR_MAX is undefined
740
793
 
741
794
  #elif defined(__ELF__) || defined(__wasm__)
742
795
 
743
- // On ELF, weak aliases work properly, so we can have all weak MiniTables point
744
- // to the same empty singleton MiniTable. This reduces code size if many
745
- // MiniTables are tree shaken.
796
+ // On ELF, weak aliases work properly, so we can have all weak MiniTables
797
+ // point to the same empty singleton MiniTable. This reduces code size if many
798
+ // MiniTables are tree shaken.
746
799
  #define UPB_WEAK_SINGLETON_PLACEHOLDER_MINITABLE() \
747
800
  __attribute__((weak)) \
748
801
  const upb_MiniTable kUpb_WeakSingletonPlaceholderMiniTable = { \
@@ -2389,7 +2442,7 @@ const upb_MiniTableEnum google__protobuf__SymbolVisibility_enum_init = {
2389
2442
  },
2390
2443
  };
2391
2444
 
2392
- static const upb_MiniTable *messages_layout[35] = {
2445
+ static const upb_MiniTable *messages_layout_google_protobuf_descriptor_proto_upb_file_layout[35] = {
2393
2446
  &google__protobuf__FileDescriptorSet_msg_init,
2394
2447
  &google__protobuf__FileDescriptorProto_msg_init,
2395
2448
  &google__protobuf__DescriptorProto_msg_init,
@@ -2427,7 +2480,7 @@ static const upb_MiniTable *messages_layout[35] = {
2427
2480
  &google__protobuf__GeneratedCodeInfo__Annotation_msg_init,
2428
2481
  };
2429
2482
 
2430
- static const upb_MiniTableEnum *enums_layout[21] = {
2483
+ static const upb_MiniTableEnum *enums_layout_google_protobuf_descriptor_proto_upb_file_layout[21] = {
2431
2484
  &google__protobuf__Edition_enum_init,
2432
2485
  &google__protobuf__ExtensionRangeOptions__VerificationState_enum_init,
2433
2486
  &google__protobuf__FeatureSet__EnforceNamingStyle_enum_init,
@@ -2452,8 +2505,8 @@ static const upb_MiniTableEnum *enums_layout[21] = {
2452
2505
  };
2453
2506
 
2454
2507
  const upb_MiniTableFile google_protobuf_descriptor_proto_upb_file_layout = {
2455
- messages_layout,
2456
- enums_layout,
2508
+ messages_layout_google_protobuf_descriptor_proto_upb_file_layout,
2509
+ enums_layout_google_protobuf_descriptor_proto_upb_file_layout,
2457
2510
  NULL,
2458
2511
  35,
2459
2512
  21,
@@ -2462,6 +2515,81 @@ const upb_MiniTableFile google_protobuf_descriptor_proto_upb_file_layout = {
2462
2515
 
2463
2516
 
2464
2517
 
2518
+ /* This file was generated by upb_generator from the input file:
2519
+ *
2520
+ * google/protobuf/json_enumvalue_options.proto
2521
+ *
2522
+ * Do not edit -- your changes will be discarded when the file is
2523
+ * regenerated.
2524
+ * NO CHECKED-IN PROTOBUF GENCODE */
2525
+
2526
+ #include <stddef.h>
2527
+
2528
+ // Must be last.
2529
+
2530
+ extern const UPB_PRIVATE(upb_GeneratedExtensionListEntry)* UPB_PRIVATE(upb_generated_extension_list);
2531
+ typedef struct {
2532
+ upb_MiniTableField fields[1];
2533
+ } pb__enumvalue__JsonEnumValueOptions_msg_init_Fields;
2534
+
2535
+ static const pb__enumvalue__JsonEnumValueOptions_msg_init_Fields pb_enumvalue_JsonEnumValueOptions__fields = {{
2536
+ {1, UPB_SIZE(12, 16), 64, kUpb_NoSub, 9, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
2537
+ }};
2538
+
2539
+ const upb_MiniTable pb__enumvalue__JsonEnumValueOptions_msg_init = {
2540
+ &pb_enumvalue_JsonEnumValueOptions__fields.fields[0],
2541
+ UPB_SIZE(24, 32), 1, kUpb_ExtMode_NonExtendable, 1, UPB_FASTTABLE_MASK(8), 0,
2542
+ #ifdef UPB_TRACING_ENABLED
2543
+ "pb.enumvalue.JsonEnumValueOptions",
2544
+ #endif
2545
+ UPB_FASTTABLE_INIT({
2546
+ {0x0000000000000000, &_upb_FastDecoder_DecodeUnknown},
2547
+ {0x001000000000000a, &upb_DecodeFast_String_Scalar_Tag1Byte},
2548
+ })
2549
+ };
2550
+
2551
+ static const upb_MiniTableExtension pb_enumvalue_json_ext_obj = {
2552
+ {998, 0, 0, UPB_SIZE(3, 4), 11, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsExtension | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)},
2553
+ {.UPB_PRIVATE(submsg) = &pb__enumvalue__JsonEnumValueOptions_msg_init},
2554
+ &google__protobuf__EnumValueOptions_msg_init,
2555
+
2556
+ };
2557
+ UPB_LINKARR_APPEND(upb_AllExts)
2558
+ const upb_MiniTableExtension* pb_enumvalue_json_ext = &pb_enumvalue_json_ext_obj;
2559
+ static const upb_MiniTable *messages_layout_google_protobuf_json_enumvalue_options_proto_upb_file_layout[1] = {
2560
+ &pb__enumvalue__JsonEnumValueOptions_msg_init,
2561
+ };
2562
+
2563
+
2564
+ static const upb_MiniTableExtension *extensions_layout_google_protobuf_json_enumvalue_options_proto_upb_file_layout[1] = {
2565
+ &pb_enumvalue_json_ext_obj,
2566
+ };
2567
+
2568
+ UPB_LINKARR_DECLARE(upb_AllExts, const upb_MiniTableExtension*);
2569
+ UPB_CONSTRUCTOR(upb_GeneratedRegistry_Constructor, google_protobuf_json_enumvalue_options_proto_ext_constructor, {
2570
+ static bool finished = false;
2571
+ if (finished) return;
2572
+ finished = true;
2573
+ static UPB_PRIVATE(upb_GeneratedExtensionListEntry) entry = {
2574
+ UPB_LINKARR_START(upb_AllExts),
2575
+ UPB_LINKARR_STOP(upb_AllExts),
2576
+ NULL
2577
+ };
2578
+ UPB_ASSERT(entry.next == NULL);
2579
+ entry.next = UPB_PRIVATE(upb_generated_extension_list);
2580
+ UPB_PRIVATE(upb_generated_extension_list) = &entry;
2581
+ })
2582
+ const upb_MiniTableFile google_protobuf_json_enumvalue_options_proto_upb_file_layout = {
2583
+ messages_layout_google_protobuf_json_enumvalue_options_proto_upb_file_layout,
2584
+ NULL,
2585
+ extensions_layout_google_protobuf_json_enumvalue_options_proto_upb_file_layout,
2586
+ 1,
2587
+ 0,
2588
+ 1,
2589
+ };
2590
+
2591
+
2592
+
2465
2593
 
2466
2594
  #include <errno.h>
2467
2595
  #include <float.h>
@@ -4208,7 +4336,7 @@ static upb_JsonMessageValue jsondec_enum(jsondec* d, const upb_FieldDef* f) {
4208
4336
  upb_StringView str = jsondec_string(d);
4209
4337
  const upb_EnumDef* e = upb_FieldDef_EnumSubDef(f);
4210
4338
  const upb_EnumValueDef* ev =
4211
- upb_EnumDef_FindValueByNameWithSize(e, str.data, str.size);
4339
+ upb_EnumDef_FindByJsonNameWithSize(e, str.data, str.size);
4212
4340
  upb_JsonMessageValue val = {.ignore = false};
4213
4341
  if (ev) {
4214
4342
  val.value.int32_val = upb_EnumValueDef_Number(ev);
@@ -4986,11 +5114,12 @@ int upb_JsonDecodeDetectingNonconformance(const char* buf, size_t size,
4986
5114
  }
4987
5115
 
4988
5116
 
4989
- #include <ctype.h>
4990
5117
  #include <float.h>
4991
5118
  #include <inttypes.h>
4992
5119
  #include <math.h>
5120
+ #include <setjmp.h>
4993
5121
  #include <stdarg.h>
5122
+ #include <stdint.h>
4994
5123
  #include <string.h>
4995
5124
 
4996
5125
 
@@ -5017,6 +5146,7 @@ static void jsonenc_msgfields(jsonenc* e, const upb_Message* msg,
5017
5146
  const upb_MessageDef* m, bool first);
5018
5147
  static void jsonenc_value(jsonenc* e, const upb_Message* msg,
5019
5148
  const upb_MessageDef* m);
5149
+ static void jsonenc_string(jsonenc* e, upb_StringView str);
5020
5150
 
5021
5151
  UPB_NORETURN static void jsonenc_err(jsonenc* e, const char* msg) {
5022
5152
  upb_Status_SetErrorMessage(e->status, msg);
@@ -5178,7 +5308,8 @@ static void jsonenc_enum(int32_t val, const upb_FieldDef* f, jsonenc* e) {
5178
5308
  : upb_EnumDef_FindValueByNumber(e_def, val);
5179
5309
 
5180
5310
  if (ev) {
5181
- jsonenc_printf(e, "\"%s\"", upb_EnumValueDef_Name(ev));
5311
+ const char* name = upb_EnumValueDef_JsonName(ev);
5312
+ jsonenc_string(e, upb_StringView_FromString(name));
5182
5313
  } else {
5183
5314
  jsonenc_printf(e, "%" PRId32, val);
5184
5315
  }
@@ -11515,6 +11646,28 @@ struct upb_EnumDef {
11515
11646
  bool is_sorted; // Whether all of the values are defined in ascending order.
11516
11647
  };
11517
11648
 
11649
+ // We store both regular proto enum names and custom JSON enum names in the
11650
+ // same strtable (ntoi). This is safe because protoc enforces that custom JSON
11651
+ // enum names never conflict with default enum names across different enum
11652
+ // values (or are identical, in which case we leave the entry untagged). Because
11653
+ // upb_EnumValueDef pointers are arena-aligned to at least 4 bytes (bit 0 is
11654
+ // always 0 for untagged pointers), we set bit 0 to tag custom JSON-only names
11655
+ // so that regular name lookups can ignore them.
11656
+ static const uintptr_t kUpb_EnumDef_JsonOnlyTag = 1ULL;
11657
+
11658
+ static upb_value _upb_EnumDef_TagJsonOnly(upb_value v) {
11659
+ v.val |= kUpb_EnumDef_JsonOnlyTag;
11660
+ return v;
11661
+ }
11662
+
11663
+ static bool _upb_EnumDef_IsJsonOnly(upb_value v) {
11664
+ return (v.val & kUpb_EnumDef_JsonOnlyTag) != 0;
11665
+ }
11666
+
11667
+ static const upb_EnumValueDef* _upb_EnumDef_Untag(upb_value v) {
11668
+ return (const upb_EnumValueDef*)(v.val & ~kUpb_EnumDef_JsonOnlyTag);
11669
+ }
11670
+
11518
11671
  upb_EnumDef* _upb_EnumDef_At(const upb_EnumDef* e, int i) {
11519
11672
  return (upb_EnumDef*)&e[i];
11520
11673
  }
@@ -11523,18 +11676,43 @@ const upb_MiniTableEnum* _upb_EnumDef_MiniTable(const upb_EnumDef* e) {
11523
11676
  return e->layout;
11524
11677
  }
11525
11678
 
11526
- bool _upb_EnumDef_Insert(upb_EnumDef* e, upb_EnumValueDef* v, upb_Arena* a) {
11679
+ void _upb_EnumDef_Insert(upb_DefBuilder* ctx, upb_EnumDef* e,
11680
+ upb_EnumValueDef* v) {
11527
11681
  const char* name = upb_EnumValueDef_Name(v);
11528
11682
  const upb_value val = upb_value_constptr(v);
11529
- bool ok = upb_strtable_insert(&e->ntoi, name, strlen(name), val, a);
11530
- if (!ok) return false;
11683
+ bool ok = upb_strtable_insert(&e->ntoi, name, strlen(name), val, ctx->arena);
11684
+ if (!ok) _upb_DefBuilder_OomErr(ctx);
11685
+
11686
+ // Aliased enum values can share the same custom JSON name, first one wins.
11687
+ const char* json_name = upb_EnumValueDef_JsonName(v);
11688
+ size_t json_len = strlen(json_name);
11689
+ if (strcmp(json_name, name) != 0) {
11690
+ upb_value existing_value;
11691
+ if (upb_strtable_lookup2(&e->ntoi, json_name, json_len, &existing_value)) {
11692
+ const upb_EnumValueDef* enumval = _upb_EnumDef_Untag(existing_value);
11693
+ if (upb_EnumValueDef_Number(enumval) != upb_EnumValueDef_Number(v)) {
11694
+ // If the custom JSON name exists, but points to a value with a
11695
+ // different number, then this is a parse/conflict error.
11696
+ _upb_DefBuilder_Errf(ctx,
11697
+ "duplicate custom json_name (%s) in enum (%s)",
11698
+ json_name, upb_EnumDef_FullName(e));
11699
+ }
11700
+ } else {
11701
+ upb_value json_val = _upb_EnumDef_TagJsonOnly(val);
11702
+ if (!upb_strtable_insert(&e->ntoi, json_name, json_len, json_val,
11703
+ ctx->arena)) {
11704
+ _upb_DefBuilder_OomErr(ctx);
11705
+ }
11706
+ }
11707
+ }
11531
11708
 
11532
- // Multiple enumerators can have the same number, first one wins.
11709
+ // Multiple enum values can have the same number, first one wins.
11533
11710
  const int number = upb_EnumValueDef_Number(v);
11534
11711
  if (!upb_inttable_lookup(&e->iton, number, NULL)) {
11535
- return upb_inttable_insert(&e->iton, number, val, a);
11712
+ if (!upb_inttable_insert(&e->iton, number, val, ctx->arena)) {
11713
+ _upb_DefBuilder_OomErr(ctx);
11714
+ }
11536
11715
  }
11537
- return true;
11538
11716
  }
11539
11717
 
11540
11718
  const google_protobuf_EnumOptions* upb_EnumDef_Options(const upb_EnumDef* e) {
@@ -11591,6 +11769,16 @@ upb_StringView upb_EnumDef_ReservedName(const upb_EnumDef* e, int i) {
11591
11769
 
11592
11770
  int upb_EnumDef_ValueCount(const upb_EnumDef* e) { return e->value_count; }
11593
11771
 
11772
+ const upb_EnumValueDef* upb_EnumDef_FindByJsonNameWithSize(const upb_EnumDef* e,
11773
+ const char* name,
11774
+ size_t size) {
11775
+ upb_value v;
11776
+ if (!upb_strtable_lookup2(&e->ntoi, name, size, &v)) {
11777
+ return NULL;
11778
+ }
11779
+ return _upb_EnumDef_Untag(v);
11780
+ }
11781
+
11594
11782
  const upb_EnumValueDef* upb_EnumDef_FindValueByName(const upb_EnumDef* e,
11595
11783
  const char* name) {
11596
11784
  return upb_EnumDef_FindValueByNameWithSize(e, name, strlen(name));
@@ -11599,9 +11787,13 @@ const upb_EnumValueDef* upb_EnumDef_FindValueByName(const upb_EnumDef* e,
11599
11787
  const upb_EnumValueDef* upb_EnumDef_FindValueByNameWithSize(
11600
11788
  const upb_EnumDef* e, const char* name, size_t size) {
11601
11789
  upb_value v;
11602
- return upb_strtable_lookup2(&e->ntoi, name, size, &v)
11603
- ? upb_value_getconstptr(v)
11604
- : NULL;
11790
+ if (!upb_strtable_lookup2(&e->ntoi, name, size, &v)) {
11791
+ return NULL;
11792
+ }
11793
+ if (_upb_EnumDef_IsJsonOnly(v)) {
11794
+ return NULL;
11795
+ }
11796
+ return upb_value_getconstptr(v);
11605
11797
  }
11606
11798
 
11607
11799
  const upb_EnumValueDef* upb_EnumDef_FindValueByNumber(const upb_EnumDef* e,
@@ -11742,7 +11934,7 @@ static void create_enumdef(upb_DefBuilder* ctx, const char* prefix,
11742
11934
  upb_EnumDef_FullName(e));
11743
11935
  }
11744
11936
 
11745
- bool ok = upb_strtable_init(&e->ntoi, n_value, ctx->arena);
11937
+ bool ok = upb_strtable_init(&e->ntoi, n_value * 2, ctx->arena);
11746
11938
  if (!ok) _upb_DefBuilder_OomErr(ctx);
11747
11939
 
11748
11940
  ok = upb_inttable_init(&e->iton, ctx->arena);
@@ -11859,6 +12051,7 @@ struct upb_EnumValueDef {
11859
12051
  const google_protobuf_FeatureSet* resolved_features;
11860
12052
  const upb_EnumDef* parent;
11861
12053
  const char* full_name;
12054
+ const char* json_name;
11862
12055
  int32_t number;
11863
12056
  };
11864
12057
 
@@ -11880,7 +12073,7 @@ const upb_EnumValueDef** _upb_EnumValueDefs_Sorted(const upb_EnumValueDef* v,
11880
12073
  (upb_EnumValueDef**)upb_Arena_Malloc(a, n * sizeof(void*));
11881
12074
  if (!out) return NULL;
11882
12075
 
11883
- for (int i = 0; i < n; i++) {
12076
+ for (size_t i = 0; i < n; i++) {
11884
12077
  out[i] = (upb_EnumValueDef*)&v[i];
11885
12078
  }
11886
12079
  qsort(out, n, sizeof(void*), _upb_EnumValueDef_Compare);
@@ -11910,6 +12103,10 @@ const char* upb_EnumValueDef_FullName(const upb_EnumValueDef* v) {
11910
12103
  return v->full_name;
11911
12104
  }
11912
12105
 
12106
+ const char* upb_EnumValueDef_JsonName(const upb_EnumValueDef* v) {
12107
+ return v->json_name ? v->json_name : upb_EnumValueDef_Name(v);
12108
+ }
12109
+
11913
12110
  const char* upb_EnumValueDef_Name(const upb_EnumValueDef* v) {
11914
12111
  return _upb_DefBuilder_FullToShort(v->full_name);
11915
12112
  }
@@ -11921,6 +12118,19 @@ uint32_t upb_EnumValueDef_Index(const upb_EnumValueDef* v) {
11921
12118
  return v - upb_EnumDef_Value(v->parent, 0);
11922
12119
  }
11923
12120
 
12121
+ static const char* _upb_EnumValueDef_ExtractJsonName(
12122
+ upb_DefBuilder* ctx, const upb_EnumValueDef* v) {
12123
+ if (!upb_EnumValueDef_HasOptions(v)) return NULL;
12124
+ const google_protobuf_EnumValueOptions* opts = (const google_protobuf_EnumValueOptions*)v->opts;
12125
+ if (!pb_enumvalue_has_json(opts)) return NULL;
12126
+ const pb_enumvalue_JsonEnumValueOptions* json_opts = pb_enumvalue_json(opts);
12127
+ if (!json_opts || !pb_enumvalue_JsonEnumValueOptions_has_string(json_opts)) {
12128
+ return NULL;
12129
+ }
12130
+ upb_StringView str = pb_enumvalue_JsonEnumValueOptions_string(json_opts);
12131
+ return upb_strdup2(str.data, str.size, ctx->arena);
12132
+ }
12133
+
11924
12134
  static void create_enumvaldef(upb_DefBuilder* ctx, const char* prefix,
11925
12135
  const google_protobuf_EnumValueDescriptorProto* val_proto,
11926
12136
  const google_protobuf_FeatureSet* parent_features,
@@ -11935,11 +12145,11 @@ static void create_enumvaldef(upb_DefBuilder* ctx, const char* prefix,
11935
12145
  v->parent = e; // Must happen prior to _upb_DefBuilder_Add()
11936
12146
  v->full_name = _upb_DefBuilder_MakeFullName(ctx, prefix, name);
11937
12147
  v->number = google_protobuf_EnumValueDescriptorProto_number(val_proto);
12148
+ v->json_name = _upb_EnumValueDef_ExtractJsonName(ctx, v);
11938
12149
  _upb_DefBuilder_Add(ctx, v->full_name,
11939
12150
  _upb_DefType_Pack(v, UPB_DEFTYPE_ENUMVAL));
11940
12151
 
11941
- bool ok = _upb_EnumDef_Insert(e, v, ctx->arena);
11942
- if (!ok) _upb_DefBuilder_OomErr(ctx);
12152
+ _upb_EnumDef_Insert(ctx, e, v);
11943
12153
  }
11944
12154
 
11945
12155
  // Allocate and initialize an array of |n| enum value defs owned by |e|.
@@ -18602,6 +18812,7 @@ const char* UPB_PRIVATE(_upb_WireReader_SkipGroup)(
18602
18812
  #undef UPB_TSAN
18603
18813
  #undef UPB_DEPRECATED
18604
18814
  #undef UPB_GNUC_MIN
18815
+ #undef UPB_CLANG_MIN
18605
18816
  #undef UPB_DESCRIPTOR_UPB_H_FILENAME
18606
18817
  #undef UPB_DESC_MINITABLE
18607
18818
  #undef UPB_IS_GOOGLE3
@@ -18628,3 +18839,6 @@ const char* UPB_PRIVATE(_upb_WireReader_SkipGroup)(
18628
18839
  #undef UPB_DEPRECATE_AND_INLINE
18629
18840
  #undef UPB_MAYBE_ASSUME
18630
18841
  #undef UPB_ATTR_CONST
18842
+ #undef _UPB_STRINGIFY
18843
+ #undef _UPB_STRINGIFY2
18844
+ #undef UPB_CONSTRUCTOR
@@ -37,6 +37,13 @@
37
37
  #define UPB_GNUC_MIN(x, y) 0
38
38
  #endif
39
39
 
40
+ #if defined(__clang__) && defined(__clang_major__) && defined(__clang_minor__)
41
+ #define UPB_CLANG_MIN(x, y) \
42
+ (__clang_major__ > (x) || __clang_major__ == (x) && __clang_minor__ >= (y))
43
+ #else
44
+ #define UPB_CLANG_MIN(x, y) 0
45
+ #endif
46
+
40
47
  // Macros for checking for compiler attributes, defined here to avoid the
41
48
  // problem described in
42
49
  // https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005fattribute.html.
@@ -601,10 +608,12 @@ Error, UINTPTR_MAX is undefined
601
608
  #define UPB_LINKARR_APPEND(name) \
602
609
  __attribute__(( \
603
610
  section("linkarr_" #name))) UPB_LINKARR_ATTR UPB_NO_SANITIZE_ADDRESS
604
- #define UPB_LINKARR_DECLARE(name, type) \
605
- extern type __start_linkarr_##name; \
606
- extern type __stop_linkarr_##name; \
607
- UPB_LINKARR_APPEND(name) \
611
+ #define UPB_LINKARR_DECLARE(name, type) \
612
+ UPB_STATIC_ASSERT(sizeof("__la_" #name) <= 17, \
613
+ "Linker array name too long for Mach-O (16-char limit)"); \
614
+ extern type __start_linkarr_##name; \
615
+ extern type __stop_linkarr_##name; \
616
+ UPB_LINKARR_APPEND(name) \
608
617
  UPB_LINKARR_SENTINEL type UPB_linkarr_internal_empty_##name[1]
609
618
  #define UPB_LINKARR_START(name) (&__start_linkarr_##name)
610
619
  #define UPB_LINKARR_STOP(name) (&__stop_linkarr_##name)
@@ -615,13 +624,15 @@ Error, UINTPTR_MAX is undefined
615
624
  #define UPB_LINKARR_APPEND(name) \
616
625
  __attribute__(( \
617
626
  section("__DATA,__la_" #name))) UPB_LINKARR_ATTR UPB_NO_SANITIZE_ADDRESS
618
- #define UPB_LINKARR_DECLARE(name, type) \
619
- extern type __start_linkarr_##name __asm( \
620
- "section$start$__DATA$__la_" #name); \
621
- extern type __stop_linkarr_##name __asm( \
622
- "section$end$__DATA$" \
623
- "__la_" #name); \
624
- UPB_LINKARR_APPEND(name) \
627
+ #define UPB_LINKARR_DECLARE(name, type) \
628
+ UPB_STATIC_ASSERT(sizeof("__la_" #name) <= 17, \
629
+ "Linker array name too long for Mach-O (16-char limit)"); \
630
+ extern type __start_linkarr_##name __asm( \
631
+ "section$start$__DATA$__la_" #name); \
632
+ extern type __stop_linkarr_##name __asm( \
633
+ "section$end$__DATA$" \
634
+ "__la_" #name); \
635
+ UPB_LINKARR_APPEND(name) \
625
636
  UPB_LINKARR_SENTINEL type UPB_linkarr_internal_empty_##name[1]
626
637
  #define UPB_LINKARR_START(name) (&__start_linkarr_##name)
627
638
  #define UPB_LINKARR_STOP(name) (&__stop_linkarr_##name)
@@ -659,7 +670,9 @@ Error, UINTPTR_MAX is undefined
659
670
 
660
671
  // Linker arrays are not supported on this platform. Make macros no-ops.
661
672
  #define UPB_LINKARR_APPEND(name)
662
- #define UPB_LINKARR_DECLARE(name, type)
673
+ #define UPB_LINKARR_DECLARE(name, type) \
674
+ UPB_STATIC_ASSERT(sizeof("__la_" #name) <= 17, \
675
+ "Linker array name too long for Mach-O (16-char limit)")
663
676
  #define UPB_LINKARR_START(name) (NULL)
664
677
  #define UPB_LINKARR_STOP(name) (NULL)
665
678
 
@@ -676,11 +689,46 @@ Error, UINTPTR_MAX is undefined
676
689
  #define _UPB_CONSTRUCTOR_PLACEHOLDER(unique_name)
677
690
  #endif
678
691
 
679
- #if defined(__ELF__) || defined(__wasm__) || defined(__MACH__)
680
- #define UPB_CONSTRUCTOR(name, unique_name) \
692
+ #define _UPB_STRINGIFY2(x) #x
693
+ #define _UPB_STRINGIFY(x) _UPB_STRINGIFY2(x)
694
+
695
+ #if defined(__ELF__) && (UPB_GNUC_MIN(15, 1) || UPB_CLANG_MIN(21, 1))
696
+ /*
697
+ * Workaround for b/456308964 and b/456317163. Although weak constructors
698
+ * resolve to a single function body, Clang still emits a pointer into
699
+ * .init_array for every translation unit, causing the constructor to be
700
+ * executed multiple times and inflating binary size. We wrap the .init_array
701
+ * entry in a COMDAT group (using inline assembly) to force the linker to
702
+ * deduplicate the pointer to exactly one instance. %cc is used in preference to
703
+ * the more widely available %c because %c may under some circumstances still
704
+ * output a function name including relocation information, which will then
705
+ * confuse the linker. This was only a problem on gcc; when %cc was introduced
706
+ * to clang it was just an alias to %c, and clang's %c had already done the
707
+ * checks that %cc introduced to gcc.
708
+ * References:
709
+ * https://github.com/gcc-mirror/gcc/commit/74d6a676034b3ab20c387f12f19f5597e4f1c9fa
710
+ * https://github.com/llvm/llvm-project/pull/127719#issuecomment-2686276305
711
+ */
712
+ #define UPB_CONSTRUCTOR(name, unique_name, ...) \
713
+ _UPB_CONSTRUCTOR_PLACEHOLDER(unique_name) \
714
+ __attribute__((weak, used, visibility("hidden"))) void UPB_PRIVATE(name)( \
715
+ void) { \
716
+ __asm__ volatile( \
717
+ ".pushsection .init_array,\"awG\",%%init_array, %cc0, comdat\n" \
718
+ ".dc.a %cc0\n" \
719
+ ".popsection\n" \
720
+ : \
721
+ : "X"(UPB_PRIVATE(name))); \
722
+ __VA_ARGS__ \
723
+ }
724
+ #elif defined(__ELF__) || defined(__wasm__) || defined(__MACH__) || \
725
+ defined(__MINGW32__)
726
+ #define UPB_CONSTRUCTOR(name, unique_name, ...) \
681
727
  _UPB_CONSTRUCTOR_PLACEHOLDER(unique_name) \
682
728
  __attribute__((weak, visibility("hidden"), constructor)) void UPB_PRIVATE( \
683
- name)(void)
729
+ name)(void) { \
730
+ __VA_ARGS__ \
731
+ }
684
732
  #elif defined(_MSC_VER)
685
733
  /*
686
734
  * See: https://stackoverflow.com/questions/1113409
@@ -691,17 +739,22 @@ Error, UINTPTR_MAX is undefined
691
739
  * create a dummy exported weak symbol that prevent this stripping.
692
740
  */
693
741
  #pragma section(".CRT$XCT", read)
694
- #define UPB_CONSTRUCTOR(name, unique_name) \
742
+ #define UPB_CONSTRUCTOR(name, unique_name, ...) \
695
743
  static void __cdecl UPB_PRIVATE(name)(void); \
696
744
  __declspec(allocate(".CRT$XCT"), selectany) void( \
697
745
  __cdecl * UPB_PRIVATE(name##_))(void) = UPB_PRIVATE(name); \
698
746
  __declspec(selectany, dllexport) void* UPB_PRIVATE(name##_force_linkage) = \
699
747
  &UPB_PRIVATE(name##_); \
700
- static void __cdecl UPB_PRIVATE(name)(void)
701
-
748
+ static void __cdecl UPB_PRIVATE(name)(void) { __VA_ARGS__ }
702
749
  #else
703
750
  // No constructor support, nothing we can do except not break builds.
704
- #define UPB_CONSTRUCTOR(name, unique_name) static void UPB_PRIVATE(name)(void)
751
+ #if defined(__GNUC__) || defined(__clang__)
752
+ #define UPB_CONSTRUCTOR(name, unique_name, ...) \
753
+ static __attribute__((used)) void UPB_PRIVATE(name)(void) { __VA_ARGS__ }
754
+ #else
755
+ #define UPB_CONSTRUCTOR(name, unique_name, ...) \
756
+ static void UPB_PRIVATE(name)(void) { __VA_ARGS__ }
757
+ #endif
705
758
  #endif
706
759
 
707
760
  //
@@ -739,9 +792,9 @@ Error, UINTPTR_MAX is undefined
739
792
 
740
793
  #elif defined(__ELF__) || defined(__wasm__)
741
794
 
742
- // On ELF, weak aliases work properly, so we can have all weak MiniTables point
743
- // to the same empty singleton MiniTable. This reduces code size if many
744
- // MiniTables are tree shaken.
795
+ // On ELF, weak aliases work properly, so we can have all weak MiniTables
796
+ // point to the same empty singleton MiniTable. This reduces code size if many
797
+ // MiniTables are tree shaken.
745
798
  #define UPB_WEAK_SINGLETON_PLACEHOLDER_MINITABLE() \
746
799
  __attribute__((weak)) \
747
800
  const upb_MiniTable kUpb_WeakSingletonPlaceholderMiniTable = { \
@@ -6845,6 +6898,35 @@ extern const upb_MiniTableFile google_protobuf_descriptor_proto_upb_file_layout;
6845
6898
 
6846
6899
 
6847
6900
  #endif /* GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H__UPB_MINITABLE_H_ */
6901
+ /* This file was generated by upb_generator from the input file:
6902
+ *
6903
+ * google/protobuf/json_enumvalue_options.proto
6904
+ *
6905
+ * Do not edit -- your changes will be discarded when the file is
6906
+ * regenerated.
6907
+ * NO CHECKED-IN PROTOBUF GENCODE */
6908
+
6909
+ #ifndef GOOGLE_PROTOBUF_JSON_ENUMVALUE_OPTIONS_PROTO_UPB_H__UPB_MINITABLE_H_
6910
+ #define GOOGLE_PROTOBUF_JSON_ENUMVALUE_OPTIONS_PROTO_UPB_H__UPB_MINITABLE_H_
6911
+
6912
+
6913
+ // Must be last.
6914
+
6915
+ #ifdef __cplusplus
6916
+ extern "C" {
6917
+ #endif
6918
+
6919
+ extern const upb_MiniTable pb__enumvalue__JsonEnumValueOptions_msg_init;
6920
+ extern const upb_MiniTableExtension* pb_enumvalue_json_ext;
6921
+
6922
+ extern const upb_MiniTableFile google_protobuf_json_enumvalue_options_proto_upb_file_layout;
6923
+
6924
+ #ifdef __cplusplus
6925
+ } /* extern "C" */
6926
+ #endif
6927
+
6928
+
6929
+ #endif /* GOOGLE_PROTOBUF_JSON_ENUMVALUE_OPTIONS_PROTO_UPB_H__UPB_MINITABLE_H_ */
6848
6930
 
6849
6931
  #ifndef UPB_BASE_INTERNAL_LOG2_H_
6850
6932
  #define UPB_BASE_INTERNAL_LOG2_H_
@@ -15019,6 +15101,7 @@ bool upb_DefPool_ImplicitFieldPresenceDisabled(const upb_DefPool* s);
15019
15101
 
15020
15102
  #include <stddef.h>
15021
15103
  #include <stdint.h>
15104
+ #include <string.h>
15022
15105
 
15023
15106
 
15024
15107
  // Must be last.
@@ -15031,6 +15114,12 @@ bool upb_EnumDef_CheckNumber(const upb_EnumDef* e, int32_t num);
15031
15114
  const upb_MessageDef* upb_EnumDef_ContainingType(const upb_EnumDef* e);
15032
15115
  int32_t upb_EnumDef_Default(const upb_EnumDef* e);
15033
15116
  UPB_API const upb_FileDef* upb_EnumDef_File(const upb_EnumDef* e);
15117
+ UPB_API const upb_EnumValueDef* upb_EnumDef_FindByJsonNameWithSize(
15118
+ const upb_EnumDef* e, const char* name, size_t size);
15119
+ UPB_INLINE const upb_EnumValueDef* upb_EnumDef_FindByJsonName(
15120
+ const upb_EnumDef* e, const char* name) {
15121
+ return upb_EnumDef_FindByJsonNameWithSize(e, name, strlen(name));
15122
+ }
15034
15123
  const upb_EnumValueDef* upb_EnumDef_FindValueByName(const upb_EnumDef* e,
15035
15124
  const char* name);
15036
15125
  UPB_API const upb_EnumValueDef* upb_EnumDef_FindValueByNameWithSize(
@@ -15073,6 +15162,8 @@ UPB_API int upb_EnumDef_ValueCount(const upb_EnumDef* e);
15073
15162
  #ifndef UPB_REFLECTION_ENUM_VALUE_DEF_H_
15074
15163
  #define UPB_REFLECTION_ENUM_VALUE_DEF_H_
15075
15164
 
15165
+ #include <stdint.h>
15166
+
15076
15167
 
15077
15168
  // Must be last.
15078
15169
 
@@ -15084,6 +15175,7 @@ const upb_EnumDef* upb_EnumValueDef_Enum(const upb_EnumValueDef* v);
15084
15175
  const char* upb_EnumValueDef_FullName(const upb_EnumValueDef* v);
15085
15176
  bool upb_EnumValueDef_HasOptions(const upb_EnumValueDef* v);
15086
15177
  uint32_t upb_EnumValueDef_Index(const upb_EnumValueDef* v);
15178
+ UPB_API const char* upb_EnumValueDef_JsonName(const upb_EnumValueDef* v);
15087
15179
  UPB_API const char* upb_EnumValueDef_Name(const upb_EnumValueDef* v);
15088
15180
  UPB_API int32_t upb_EnumValueDef_Number(const upb_EnumValueDef* v);
15089
15181
  const google_protobuf_EnumValueOptions* upb_EnumValueDef_Options(
@@ -18082,7 +18174,8 @@ extern "C" {
18082
18174
  #endif
18083
18175
 
18084
18176
  upb_EnumDef* _upb_EnumDef_At(const upb_EnumDef* e, int i);
18085
- bool _upb_EnumDef_Insert(upb_EnumDef* e, upb_EnumValueDef* v, upb_Arena* a);
18177
+ void _upb_EnumDef_Insert(upb_DefBuilder* ctx, upb_EnumDef* e,
18178
+ upb_EnumValueDef* v);
18086
18179
  const upb_MiniTableEnum* _upb_EnumDef_MiniTable(const upb_EnumDef* e);
18087
18180
 
18088
18181
  // Allocate and initialize an array of |n| enum defs.
@@ -18176,6 +18269,151 @@ char* upb_strdup2(const char* s, size_t len, upb_Arena* a);
18176
18269
 
18177
18270
 
18178
18271
  #endif /* UPB_REFLECTION_INTERNAL_STRDUP2_H_ */
18272
+ #ifndef GOOGLE_UPB_UPB_REFLECTION_JSON_ENUMVALUE_OPTIONS_BOOTSTRAP_H__
18273
+ #define GOOGLE_UPB_UPB_REFLECTION_JSON_ENUMVALUE_OPTIONS_BOOTSTRAP_H__
18274
+
18275
+ // IWYU pragma: begin_exports
18276
+
18277
+ #if defined(UPB_BOOTSTRAP_STAGE) && UPB_BOOTSTRAP_STAGE == 0
18278
+ // This header is checked in.
18279
+ #elif defined(UPB_BOOTSTRAP_STAGE) && UPB_BOOTSTRAP_STAGE == 1
18280
+ // This header is generated at build time by the bootstrapping process.
18281
+ #else
18282
+ // This is the normal header, generated by upb_c_proto_library().
18283
+ /* This file was generated by upb_generator from the input file:
18284
+ *
18285
+ * google/protobuf/json_enumvalue_options.proto
18286
+ *
18287
+ * Do not edit -- your changes will be discarded when the file is
18288
+ * regenerated.
18289
+ * NO CHECKED-IN PROTOBUF GENCODE */
18290
+
18291
+ #ifndef GOOGLE_PROTOBUF_JSON_ENUMVALUE_OPTIONS_PROTO_UPB_H__UPB_H_
18292
+ #define GOOGLE_PROTOBUF_JSON_ENUMVALUE_OPTIONS_PROTO_UPB_H__UPB_H_
18293
+
18294
+
18295
+ // Must be last.
18296
+
18297
+ #ifdef __cplusplus
18298
+ extern "C" {
18299
+ #endif
18300
+ typedef struct pb_enumvalue_JsonEnumValueOptions {
18301
+ upb_Message UPB_PRIVATE(base);
18302
+ } pb_enumvalue_JsonEnumValueOptions;
18303
+
18304
+ struct google_protobuf_EnumValueOptions;
18305
+
18306
+
18307
+
18308
+ /* pb.enumvalue.JsonEnumValueOptions */
18309
+ UPB_INLINE pb_enumvalue_JsonEnumValueOptions* pb_enumvalue_JsonEnumValueOptions_new(upb_Arena* arena) {
18310
+ return (pb_enumvalue_JsonEnumValueOptions*)_upb_Message_New(&pb__enumvalue__JsonEnumValueOptions_msg_init, arena);
18311
+ }
18312
+ UPB_INLINE pb_enumvalue_JsonEnumValueOptions* pb_enumvalue_JsonEnumValueOptions_parse(const char* buf, size_t size,
18313
+ upb_Arena* arena) {
18314
+ pb_enumvalue_JsonEnumValueOptions* ret = pb_enumvalue_JsonEnumValueOptions_new(arena);
18315
+ if (!ret) return NULL;
18316
+ if (upb_Decode(buf, size, UPB_UPCAST(ret), &pb__enumvalue__JsonEnumValueOptions_msg_init, NULL, 0,
18317
+ arena) != kUpb_DecodeStatus_Ok) {
18318
+ return NULL;
18319
+ }
18320
+ return ret;
18321
+ }
18322
+ UPB_INLINE pb_enumvalue_JsonEnumValueOptions* pb_enumvalue_JsonEnumValueOptions_parse_ex(
18323
+ const char* buf, size_t size, const upb_ExtensionRegistry* extreg,
18324
+ int options, upb_Arena* arena) {
18325
+ pb_enumvalue_JsonEnumValueOptions* ret = pb_enumvalue_JsonEnumValueOptions_new(arena);
18326
+ if (!ret) return NULL;
18327
+ if (upb_Decode(buf, size, UPB_UPCAST(ret), &pb__enumvalue__JsonEnumValueOptions_msg_init, extreg,
18328
+ options, arena) != kUpb_DecodeStatus_Ok) {
18329
+ return NULL;
18330
+ }
18331
+ return ret;
18332
+ }
18333
+ UPB_INLINE char* pb_enumvalue_JsonEnumValueOptions_serialize(const pb_enumvalue_JsonEnumValueOptions* msg,
18334
+ upb_Arena* arena, size_t* len) {
18335
+ char* ptr;
18336
+ (void)upb_Encode(UPB_UPCAST(msg), &pb__enumvalue__JsonEnumValueOptions_msg_init, 0, arena, &ptr, len);
18337
+ return ptr;
18338
+ }
18339
+ UPB_INLINE char* pb_enumvalue_JsonEnumValueOptions_serialize_ex(const pb_enumvalue_JsonEnumValueOptions* msg,
18340
+ int options, upb_Arena* arena,
18341
+ size_t* len) {
18342
+ char* ptr;
18343
+ (void)upb_Encode(UPB_UPCAST(msg), &pb__enumvalue__JsonEnumValueOptions_msg_init, options, arena, &ptr, len);
18344
+ return ptr;
18345
+ }
18346
+ UPB_INLINE void pb_enumvalue_JsonEnumValueOptions_clear_string(pb_enumvalue_JsonEnumValueOptions* msg) {
18347
+ const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 64, kUpb_NoSub, 9, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
18348
+ upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
18349
+ }
18350
+ UPB_INLINE upb_StringView pb_enumvalue_JsonEnumValueOptions_string(const pb_enumvalue_JsonEnumValueOptions* msg) {
18351
+ upb_StringView default_val = upb_StringView_FromString("");
18352
+ upb_StringView ret;
18353
+ const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 64, kUpb_NoSub, 9, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
18354
+ _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
18355
+ &default_val, &ret);
18356
+ return ret;
18357
+ }
18358
+ UPB_INLINE bool pb_enumvalue_JsonEnumValueOptions_has_string(const pb_enumvalue_JsonEnumValueOptions* msg) {
18359
+ const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 64, kUpb_NoSub, 9, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
18360
+ return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
18361
+ }
18362
+
18363
+ UPB_INLINE void pb_enumvalue_JsonEnumValueOptions_set_string(pb_enumvalue_JsonEnumValueOptions* msg, upb_StringView value) {
18364
+ const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 64, kUpb_NoSub, 9, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
18365
+ upb_Message_SetBaseField((upb_Message*)msg, &field, &value);
18366
+ }
18367
+
18368
+ UPB_INLINE bool pb_enumvalue_has_json(const struct google_protobuf_EnumValueOptions* msg) {
18369
+ return upb_Message_HasExtension((upb_Message*)msg, pb_enumvalue_json_ext);
18370
+ }
18371
+
18372
+ UPB_INLINE void pb_enumvalue_clear_json(struct google_protobuf_EnumValueOptions* msg) {
18373
+ upb_Message_ClearExtension((upb_Message*)msg, pb_enumvalue_json_ext);
18374
+ }
18375
+ UPB_INLINE const pb_enumvalue_JsonEnumValueOptions*
18376
+ pb_enumvalue_json(const struct google_protobuf_EnumValueOptions* msg) {
18377
+ const upb_MiniTableExtension* ext = pb_enumvalue_json_ext;
18378
+ UPB_ASSUME(upb_MiniTableField_IsScalar(&ext->UPB_PRIVATE(field)));
18379
+ UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(
18380
+ &ext->UPB_PRIVATE(field)) == UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte));
18381
+ const pb_enumvalue_JsonEnumValueOptions* default_val = NULL;
18382
+ const pb_enumvalue_JsonEnumValueOptions* ret;
18383
+ _upb_Message_GetExtensionField((upb_Message*)msg, ext, &default_val, &ret);
18384
+ return ret;
18385
+ }
18386
+
18387
+ UPB_INLINE void pb_enumvalue_set_json(struct google_protobuf_EnumValueOptions* msg,
18388
+ const pb_enumvalue_JsonEnumValueOptions* val,
18389
+ upb_Arena* arena) {
18390
+ const upb_MiniTableExtension* ext = pb_enumvalue_json_ext;
18391
+ UPB_ASSUME(upb_MiniTableField_IsScalar(&ext->UPB_PRIVATE(field)));
18392
+ UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(
18393
+ &ext->UPB_PRIVATE(field)) == UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte));
18394
+ bool ok = upb_Message_SetExtension((upb_Message*)msg, ext, &val, arena);
18395
+ UPB_ASSERT(ok);
18396
+ }
18397
+ UPB_INLINE struct pb_enumvalue_JsonEnumValueOptions* pb_enumvalue_mutable_json(
18398
+ struct google_protobuf_EnumValueOptions* msg, upb_Arena* arena) {
18399
+ struct pb_enumvalue_JsonEnumValueOptions* sub = (struct pb_enumvalue_JsonEnumValueOptions*)pb_enumvalue_json(msg);
18400
+ if (sub == NULL) {
18401
+ sub = (struct pb_enumvalue_JsonEnumValueOptions*)_upb_Message_New(&pb__enumvalue__JsonEnumValueOptions_msg_init, arena);
18402
+ if (sub) pb_enumvalue_set_json(msg, sub, arena);
18403
+ }
18404
+ return sub;
18405
+ }
18406
+ #ifdef __cplusplus
18407
+ } /* extern "C" */
18408
+ #endif
18409
+
18410
+
18411
+ #endif /* GOOGLE_PROTOBUF_JSON_ENUMVALUE_OPTIONS_PROTO_UPB_H__UPB_H_ */
18412
+ #endif
18413
+
18414
+ // IWYU pragma: end_exports
18415
+
18416
+ #endif // GOOGLE_UPB_UPB_REFLECTION_JSON_ENUMVALUE_OPTIONS_BOOTSTRAP_H__
18179
18417
 
18180
18418
  #ifndef UPB_REFLECTION_EXTENSION_RANGE_INTERNAL_H_
18181
18419
  #define UPB_REFLECTION_EXTENSION_RANGE_INTERNAL_H_
@@ -18990,6 +19228,7 @@ UPB_PRIVATE(upb_WireWriter_VarintUnusedSizeFromLeadingZeros64)(uint64_t clz) {
18990
19228
  #undef UPB_TSAN
18991
19229
  #undef UPB_DEPRECATED
18992
19230
  #undef UPB_GNUC_MIN
19231
+ #undef UPB_CLANG_MIN
18993
19232
  #undef UPB_DESCRIPTOR_UPB_H_FILENAME
18994
19233
  #undef UPB_DESC_MINITABLE
18995
19234
  #undef UPB_IS_GOOGLE3
@@ -19016,3 +19255,6 @@ UPB_PRIVATE(upb_WireWriter_VarintUnusedSizeFromLeadingZeros64)(uint64_t clz) {
19016
19255
  #undef UPB_DEPRECATE_AND_INLINE
19017
19256
  #undef UPB_MAYBE_ASSUME
19018
19257
  #undef UPB_ATTR_CONST
19258
+ #undef _UPB_STRINGIFY
19259
+ #undef _UPB_STRINGIFY2
19260
+ #undef UPB_CONSTRUCTOR
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # source: google/protobuf/json_enumvalue_options.proto
4
+
5
+ require 'google/protobuf'
6
+
7
+ require 'google/protobuf/descriptor_pb'
8
+
9
+
10
+ descriptor_data = "\n,google/protobuf/json_enumvalue_options.proto\x12\x0cpb.enumvalue\x1a google/protobuf/descriptor.proto\"(\n\x14JsonEnumValueOptions\x12\x0e\n\x06string\x18\x01 \x01(\tX\x01:\\\n\x04json\x12!.google.protobuf.EnumValueOptions\x18\xe6\x07 \x01(\x0b\x32\".pb.enumvalue.JsonEnumValueOptionsB\x06\xb2\x01\x03\x08\xea\x07\x42\x1a\n\x18\x63om.google.protobuf.utilb\x08\x65\x64itionsp\xe9\x07"
11
+
12
+ pool = ::Google::Protobuf::DescriptorPool.generated_pool
13
+ pool.add_serialized_file(descriptor_data)
14
+
15
+ module Pb
16
+ module Enumvalue
17
+ JsonEnumValueOptions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("pb.enumvalue.JsonEnumValueOptions").msgclass
18
+ end
19
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # source: google/protobuf/json_options.proto
4
+
5
+ require 'google/protobuf'
6
+
7
+ require 'google/protobuf/json_enumvalue_options_pb'
8
+
9
+
10
+ descriptor_data = "\n\"google/protobuf/json_options.proto\x12\x02pb\x1a,google/protobuf/json_enumvalue_options.protoB\x1a\n\x18\x63om.google.protobuf.utilP\x00\x62\x08\x65\x64itionsp\xe9\x07"
11
+
12
+ pool = ::Google::Protobuf::DescriptorPool.generated_pool
13
+ pool.add_serialized_file(descriptor_data)
14
+
15
+ module Pb
16
+ end
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-protobuf
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.36.0.rc.1
4
+ version: 4.36.0.rc.2
5
5
  platform: java
6
6
  authors:
7
7
  - Protobuf Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-07-09 00:00:00.000000000 Z
11
+ date: 2026-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -185,6 +185,8 @@ files:
185
185
  - lib/google/protobuf/ffi/service_descriptor.rb
186
186
  - lib/google/protobuf/field_mask_pb.rb
187
187
  - lib/google/protobuf/internal/object_cache.rb
188
+ - lib/google/protobuf/json_enumvalue_options_pb.rb
189
+ - lib/google/protobuf/json_options_pb.rb
188
190
  - lib/google/protobuf/message_exts.rb
189
191
  - lib/google/protobuf/plugin_pb.rb
190
192
  - lib/google/protobuf/repeated_field.rb
@@ -202,7 +204,7 @@ homepage: https://developers.google.com/protocol-buffers
202
204
  licenses:
203
205
  - BSD-3-Clause
204
206
  metadata:
205
- source_code_uri: https://github.com/protocolbuffers/protobuf/tree/v4.36.0-rc1/ruby
207
+ source_code_uri: https://github.com/protocolbuffers/protobuf/tree/v4.36.0-rc2/ruby
206
208
  post_install_message:
207
209
  rdoc_options: []
208
210
  require_paths: