From cbf9c9be8488681c2eaad089a2c580d6edcf7fdb Mon Sep 17 00:00:00 2001 From: Thomas Van Lenten Date: Thu, 23 Jan 2025 06:48:34 -0800 Subject: [PATCH] [ObjC] Remove some of the legacy generated formats support Remove some of the legacy union fields from the structs used for the generated code. The library has already declared it doesn't support these old formats (via the version check done by the C pre processor). PiperOrigin-RevId: 718846100 --- objectivec/GPBDescriptor_PackagePrivate.h | 30 +++-------------------- 1 file changed, 4 insertions(+), 26 deletions(-) diff --git a/objectivec/GPBDescriptor_PackagePrivate.h b/objectivec/GPBDescriptor_PackagePrivate.h index 7065164a33126..cc437c40a90e1 100644 --- a/objectivec/GPBDescriptor_PackagePrivate.h +++ b/objectivec/GPBDescriptor_PackagePrivate.h @@ -89,13 +89,8 @@ typedef struct GPBMessageFieldDescription { // C identifier for large apps. const char *name; union { - // className is deprecated and will be removed in favor of clazz. - // kept around right now for backwards compatibility. - // clazz is used iff GPBDescriptorInitializationFlag_UsesClassRefs is set. - char *className; // Name of the class of the message. - Class clazz; // Class of the message. - // For enums only. - GPBEnumDescriptorFunc enumDescFunc; + Class clazz; // Class of the message. + GPBEnumDescriptorFunc enumDescFunc; // Function to get the enum descriptor. } dataTypeSpecific; // The field number for the ivar. uint32_t number; @@ -134,29 +129,12 @@ typedef NS_OPTIONS(uint8_t, GPBExtensionOptions) { typedef struct GPBExtensionDescription { GPBGenericValue defaultValue; const char *singletonName; - // Before 3.12, `extendedClass` was just a `const char *`. Thanks to nested - // initialization - // (https://en.cppreference.com/w/c/language/struct_initialization#Nested_initialization) old - // generated code with `.extendedClass = GPBStringifySymbol(Something)` still works; and the - // current generator can use `extendedClass.clazz`, to pass a Class reference. union { - const char *name; Class clazz; } extendedClass; - // Before 3.12, this was `const char *messageOrGroupClassName`. In the - // initial 3.12 release, we moved the `union messageOrGroupClass`, and failed - // to realize that would break existing source code for extensions. So to - // keep existing source code working, we added an unnamed union (C11) to - // provide both the old field name and the new union. This keeps both older - // and newer code working. - // Background: https://github.com/protocolbuffers/protobuf/issues/7555 union { - const char *messageOrGroupClassName; - union { - const char *name; - Class clazz; - } messageOrGroupClass; - }; + Class clazz; + } messageOrGroupClass; GPBEnumDescriptorFunc enumDescriptorFunc; int32_t fieldNumber; GPBDataType dataType;