diff --git a/objectivec/GPBDescriptor.h b/objectivec/GPBDescriptor.h index 093ce8a3ec..8baa2306f4 100644 --- a/objectivec/GPBDescriptor.h +++ b/objectivec/GPBDescriptor.h @@ -133,8 +133,16 @@ typedef NS_ENUM(uint8_t, GPBFieldType) { @property(nonatomic, readonly, copy) NSString *package; /** The objc prefix declared in the proto file. */ @property(nonatomic, readonly, copy, nullable) NSString *objcPrefix; -/** The syntax of the proto file. */ -@property(nonatomic, readonly) GPBFileSyntax syntax; +/** + * The syntax of the proto file. + * + * This should not be used for making decisions about support + * features/behaviors, what proto2 vs. proto3 syntax has meant has evolved over + * time, and not more specific methods on the descriptors should be used + * instead. + */ +@property(nonatomic, readonly) GPBFileSyntax syntax + __attribute__((deprecated("Syntax is not a good way to decide things about behaviors."))); @end diff --git a/objectivec/GPBDescriptor.m b/objectivec/GPBDescriptor.m index d439da198d..4c50f7b59a 100644 --- a/objectivec/GPBDescriptor.m +++ b/objectivec/GPBDescriptor.m @@ -505,8 +505,11 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) { // - not repeated/map // - not in a oneof (negative has index) // - not a message (the flag doesn't make sense for messages) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" BOOL clearOnZero = ((file.syntax == GPBFileSyntaxProto3) && !isMapOrArray && (coreDesc->hasIndex >= 0) && !isMessage); +#pragma clang diagnostic pop if (clearOnZero) { coreDesc->flags |= GPBFieldClearHasIvarOnZero; } @@ -521,7 +524,10 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) { // to be what the runtime was doing (even though it was wrong). This is // only wrong in the rare cases an enum is declared in a proto3 syntax // file but used for a field in the proto2 syntax file. +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" BOOL isClosedEnum = (dataType == GPBDataTypeEnum && file.syntax != GPBFileSyntaxProto3); +#pragma clang diagnostic pop if (isClosedEnum) { coreDesc->flags |= GPBFieldClosedEnum; }