From 1aa65000568422f0187d2eb4fef00bcdca0cc125 Mon Sep 17 00:00:00 2001 From: Thomas Van Lenten Date: Thu, 15 Sep 2016 13:27:17 -0400 Subject: Update the ObjC version checks to support a min and current version. - Capture the version used to generated. - Check at compile time and runtime that generated code isn't from a newer version, also check that the min version required is also supported. - Keep the old constants/macros/functions to special case the last version that was working so those generated sources still work until we decide otherwise. --- objectivec/google/protobuf/Any.pbobjc.h | 7 +++++-- objectivec/google/protobuf/Any.pbobjc.m | 2 +- objectivec/google/protobuf/Api.pbobjc.h | 7 +++++-- objectivec/google/protobuf/Api.pbobjc.m | 2 +- objectivec/google/protobuf/Duration.pbobjc.h | 7 +++++-- objectivec/google/protobuf/Duration.pbobjc.m | 2 +- objectivec/google/protobuf/Empty.pbobjc.h | 7 +++++-- objectivec/google/protobuf/Empty.pbobjc.m | 2 +- objectivec/google/protobuf/FieldMask.pbobjc.h | 7 +++++-- objectivec/google/protobuf/FieldMask.pbobjc.m | 2 +- objectivec/google/protobuf/SourceContext.pbobjc.h | 7 +++++-- objectivec/google/protobuf/SourceContext.pbobjc.m | 2 +- objectivec/google/protobuf/Struct.pbobjc.h | 7 +++++-- objectivec/google/protobuf/Struct.pbobjc.m | 2 +- objectivec/google/protobuf/Timestamp.pbobjc.h | 7 +++++-- objectivec/google/protobuf/Timestamp.pbobjc.m | 2 +- objectivec/google/protobuf/Type.pbobjc.h | 7 +++++-- objectivec/google/protobuf/Type.pbobjc.m | 2 +- objectivec/google/protobuf/Wrappers.pbobjc.h | 7 +++++-- objectivec/google/protobuf/Wrappers.pbobjc.m | 2 +- 20 files changed, 60 insertions(+), 30 deletions(-) (limited to 'objectivec/google') diff --git a/objectivec/google/protobuf/Any.pbobjc.h b/objectivec/google/protobuf/Any.pbobjc.h index b88b786a..d236e4b2 100644 --- a/objectivec/google/protobuf/Any.pbobjc.h +++ b/objectivec/google/protobuf/Any.pbobjc.h @@ -13,8 +13,11 @@ #import "GPBProtocolBuffers.h" #endif -#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30002 -#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources. +#if GOOGLE_PROTOBUF_OBJC_VERSION < 30002 +#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources. +#endif +#if 30002 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION +#error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources. #endif // @@protoc_insertion_point(imports) diff --git a/objectivec/google/protobuf/Any.pbobjc.m b/objectivec/google/protobuf/Any.pbobjc.m index e1054926..d210643f 100644 --- a/objectivec/google/protobuf/Any.pbobjc.m +++ b/objectivec/google/protobuf/Any.pbobjc.m @@ -39,7 +39,7 @@ static GPBFileDescriptor *GPBAnyRoot_FileDescriptor(void) { // about thread safety of the singleton. static GPBFileDescriptor *descriptor = NULL; if (!descriptor) { - GPBDebugCheckRuntimeVersion(); + GPB_DEBUG_CHECK_RUNTIME_VERSIONS(); descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"google.protobuf" objcPrefix:@"GPB" syntax:GPBFileSyntaxProto3]; diff --git a/objectivec/google/protobuf/Api.pbobjc.h b/objectivec/google/protobuf/Api.pbobjc.h index 3750e093..742a8122 100644 --- a/objectivec/google/protobuf/Api.pbobjc.h +++ b/objectivec/google/protobuf/Api.pbobjc.h @@ -13,8 +13,11 @@ #import "GPBProtocolBuffers.h" #endif -#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30002 -#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources. +#if GOOGLE_PROTOBUF_OBJC_VERSION < 30002 +#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources. +#endif +#if 30002 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION +#error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources. #endif // @@protoc_insertion_point(imports) diff --git a/objectivec/google/protobuf/Api.pbobjc.m b/objectivec/google/protobuf/Api.pbobjc.m index 70437d49..58b47157 100644 --- a/objectivec/google/protobuf/Api.pbobjc.m +++ b/objectivec/google/protobuf/Api.pbobjc.m @@ -43,7 +43,7 @@ static GPBFileDescriptor *GPBApiRoot_FileDescriptor(void) { // about thread safety of the singleton. static GPBFileDescriptor *descriptor = NULL; if (!descriptor) { - GPBDebugCheckRuntimeVersion(); + GPB_DEBUG_CHECK_RUNTIME_VERSIONS(); descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"google.protobuf" objcPrefix:@"GPB" syntax:GPBFileSyntaxProto3]; diff --git a/objectivec/google/protobuf/Duration.pbobjc.h b/objectivec/google/protobuf/Duration.pbobjc.h index 090eb002..67380704 100644 --- a/objectivec/google/protobuf/Duration.pbobjc.h +++ b/objectivec/google/protobuf/Duration.pbobjc.h @@ -13,8 +13,11 @@ #import "GPBProtocolBuffers.h" #endif -#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30002 -#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources. +#if GOOGLE_PROTOBUF_OBJC_VERSION < 30002 +#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources. +#endif +#if 30002 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION +#error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources. #endif // @@protoc_insertion_point(imports) diff --git a/objectivec/google/protobuf/Duration.pbobjc.m b/objectivec/google/protobuf/Duration.pbobjc.m index f87d35db..bafb64a0 100644 --- a/objectivec/google/protobuf/Duration.pbobjc.m +++ b/objectivec/google/protobuf/Duration.pbobjc.m @@ -39,7 +39,7 @@ static GPBFileDescriptor *GPBDurationRoot_FileDescriptor(void) { // about thread safety of the singleton. static GPBFileDescriptor *descriptor = NULL; if (!descriptor) { - GPBDebugCheckRuntimeVersion(); + GPB_DEBUG_CHECK_RUNTIME_VERSIONS(); descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"google.protobuf" objcPrefix:@"GPB" syntax:GPBFileSyntaxProto3]; diff --git a/objectivec/google/protobuf/Empty.pbobjc.h b/objectivec/google/protobuf/Empty.pbobjc.h index e0ed3e16..bd49cfdb 100644 --- a/objectivec/google/protobuf/Empty.pbobjc.h +++ b/objectivec/google/protobuf/Empty.pbobjc.h @@ -13,8 +13,11 @@ #import "GPBProtocolBuffers.h" #endif -#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30002 -#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources. +#if GOOGLE_PROTOBUF_OBJC_VERSION < 30002 +#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources. +#endif +#if 30002 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION +#error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources. #endif // @@protoc_insertion_point(imports) diff --git a/objectivec/google/protobuf/Empty.pbobjc.m b/objectivec/google/protobuf/Empty.pbobjc.m index 9b60f36d..506b500e 100644 --- a/objectivec/google/protobuf/Empty.pbobjc.m +++ b/objectivec/google/protobuf/Empty.pbobjc.m @@ -39,7 +39,7 @@ static GPBFileDescriptor *GPBEmptyRoot_FileDescriptor(void) { // about thread safety of the singleton. static GPBFileDescriptor *descriptor = NULL; if (!descriptor) { - GPBDebugCheckRuntimeVersion(); + GPB_DEBUG_CHECK_RUNTIME_VERSIONS(); descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"google.protobuf" objcPrefix:@"GPB" syntax:GPBFileSyntaxProto3]; diff --git a/objectivec/google/protobuf/FieldMask.pbobjc.h b/objectivec/google/protobuf/FieldMask.pbobjc.h index 14ed5379..6434ac18 100644 --- a/objectivec/google/protobuf/FieldMask.pbobjc.h +++ b/objectivec/google/protobuf/FieldMask.pbobjc.h @@ -13,8 +13,11 @@ #import "GPBProtocolBuffers.h" #endif -#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30002 -#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources. +#if GOOGLE_PROTOBUF_OBJC_VERSION < 30002 +#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources. +#endif +#if 30002 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION +#error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources. #endif // @@protoc_insertion_point(imports) diff --git a/objectivec/google/protobuf/FieldMask.pbobjc.m b/objectivec/google/protobuf/FieldMask.pbobjc.m index 4dc8409c..b0915af4 100644 --- a/objectivec/google/protobuf/FieldMask.pbobjc.m +++ b/objectivec/google/protobuf/FieldMask.pbobjc.m @@ -39,7 +39,7 @@ static GPBFileDescriptor *GPBFieldMaskRoot_FileDescriptor(void) { // about thread safety of the singleton. static GPBFileDescriptor *descriptor = NULL; if (!descriptor) { - GPBDebugCheckRuntimeVersion(); + GPB_DEBUG_CHECK_RUNTIME_VERSIONS(); descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"google.protobuf" objcPrefix:@"GPB" syntax:GPBFileSyntaxProto3]; diff --git a/objectivec/google/protobuf/SourceContext.pbobjc.h b/objectivec/google/protobuf/SourceContext.pbobjc.h index 417562c0..799d190a 100644 --- a/objectivec/google/protobuf/SourceContext.pbobjc.h +++ b/objectivec/google/protobuf/SourceContext.pbobjc.h @@ -13,8 +13,11 @@ #import "GPBProtocolBuffers.h" #endif -#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30002 -#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources. +#if GOOGLE_PROTOBUF_OBJC_VERSION < 30002 +#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources. +#endif +#if 30002 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION +#error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources. #endif // @@protoc_insertion_point(imports) diff --git a/objectivec/google/protobuf/SourceContext.pbobjc.m b/objectivec/google/protobuf/SourceContext.pbobjc.m index 648d736c..83bfa346 100644 --- a/objectivec/google/protobuf/SourceContext.pbobjc.m +++ b/objectivec/google/protobuf/SourceContext.pbobjc.m @@ -39,7 +39,7 @@ static GPBFileDescriptor *GPBSourceContextRoot_FileDescriptor(void) { // about thread safety of the singleton. static GPBFileDescriptor *descriptor = NULL; if (!descriptor) { - GPBDebugCheckRuntimeVersion(); + GPB_DEBUG_CHECK_RUNTIME_VERSIONS(); descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"google.protobuf" objcPrefix:@"GPB" syntax:GPBFileSyntaxProto3]; diff --git a/objectivec/google/protobuf/Struct.pbobjc.h b/objectivec/google/protobuf/Struct.pbobjc.h index 163b39ba..3fc80caa 100644 --- a/objectivec/google/protobuf/Struct.pbobjc.h +++ b/objectivec/google/protobuf/Struct.pbobjc.h @@ -13,8 +13,11 @@ #import "GPBProtocolBuffers.h" #endif -#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30002 -#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources. +#if GOOGLE_PROTOBUF_OBJC_VERSION < 30002 +#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources. +#endif +#if 30002 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION +#error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources. #endif // @@protoc_insertion_point(imports) diff --git a/objectivec/google/protobuf/Struct.pbobjc.m b/objectivec/google/protobuf/Struct.pbobjc.m index bc9f23ff..f36ec582 100644 --- a/objectivec/google/protobuf/Struct.pbobjc.m +++ b/objectivec/google/protobuf/Struct.pbobjc.m @@ -40,7 +40,7 @@ static GPBFileDescriptor *GPBStructRoot_FileDescriptor(void) { // about thread safety of the singleton. static GPBFileDescriptor *descriptor = NULL; if (!descriptor) { - GPBDebugCheckRuntimeVersion(); + GPB_DEBUG_CHECK_RUNTIME_VERSIONS(); descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"google.protobuf" objcPrefix:@"GPB" syntax:GPBFileSyntaxProto3]; diff --git a/objectivec/google/protobuf/Timestamp.pbobjc.h b/objectivec/google/protobuf/Timestamp.pbobjc.h index 094e9b6b..898f88e3 100644 --- a/objectivec/google/protobuf/Timestamp.pbobjc.h +++ b/objectivec/google/protobuf/Timestamp.pbobjc.h @@ -13,8 +13,11 @@ #import "GPBProtocolBuffers.h" #endif -#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30002 -#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources. +#if GOOGLE_PROTOBUF_OBJC_VERSION < 30002 +#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources. +#endif +#if 30002 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION +#error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources. #endif // @@protoc_insertion_point(imports) diff --git a/objectivec/google/protobuf/Timestamp.pbobjc.m b/objectivec/google/protobuf/Timestamp.pbobjc.m index 1506dff3..4ab159fb 100644 --- a/objectivec/google/protobuf/Timestamp.pbobjc.m +++ b/objectivec/google/protobuf/Timestamp.pbobjc.m @@ -39,7 +39,7 @@ static GPBFileDescriptor *GPBTimestampRoot_FileDescriptor(void) { // about thread safety of the singleton. static GPBFileDescriptor *descriptor = NULL; if (!descriptor) { - GPBDebugCheckRuntimeVersion(); + GPB_DEBUG_CHECK_RUNTIME_VERSIONS(); descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"google.protobuf" objcPrefix:@"GPB" syntax:GPBFileSyntaxProto3]; diff --git a/objectivec/google/protobuf/Type.pbobjc.h b/objectivec/google/protobuf/Type.pbobjc.h index da923c30..06e75480 100644 --- a/objectivec/google/protobuf/Type.pbobjc.h +++ b/objectivec/google/protobuf/Type.pbobjc.h @@ -13,8 +13,11 @@ #import "GPBProtocolBuffers.h" #endif -#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30002 -#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources. +#if GOOGLE_PROTOBUF_OBJC_VERSION < 30002 +#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources. +#endif +#if 30002 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION +#error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources. #endif // @@protoc_insertion_point(imports) diff --git a/objectivec/google/protobuf/Type.pbobjc.m b/objectivec/google/protobuf/Type.pbobjc.m index a36f1cd4..7a949388 100644 --- a/objectivec/google/protobuf/Type.pbobjc.m +++ b/objectivec/google/protobuf/Type.pbobjc.m @@ -43,7 +43,7 @@ static GPBFileDescriptor *GPBTypeRoot_FileDescriptor(void) { // about thread safety of the singleton. static GPBFileDescriptor *descriptor = NULL; if (!descriptor) { - GPBDebugCheckRuntimeVersion(); + GPB_DEBUG_CHECK_RUNTIME_VERSIONS(); descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"google.protobuf" objcPrefix:@"GPB" syntax:GPBFileSyntaxProto3]; diff --git a/objectivec/google/protobuf/Wrappers.pbobjc.h b/objectivec/google/protobuf/Wrappers.pbobjc.h index 2bf6fd29..3cb9fe77 100644 --- a/objectivec/google/protobuf/Wrappers.pbobjc.h +++ b/objectivec/google/protobuf/Wrappers.pbobjc.h @@ -13,8 +13,11 @@ #import "GPBProtocolBuffers.h" #endif -#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30002 -#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources. +#if GOOGLE_PROTOBUF_OBJC_VERSION < 30002 +#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources. +#endif +#if 30002 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION +#error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources. #endif // @@protoc_insertion_point(imports) diff --git a/objectivec/google/protobuf/Wrappers.pbobjc.m b/objectivec/google/protobuf/Wrappers.pbobjc.m index c8fdeb08..5479eb12 100644 --- a/objectivec/google/protobuf/Wrappers.pbobjc.m +++ b/objectivec/google/protobuf/Wrappers.pbobjc.m @@ -39,7 +39,7 @@ static GPBFileDescriptor *GPBWrappersRoot_FileDescriptor(void) { // about thread safety of the singleton. static GPBFileDescriptor *descriptor = NULL; if (!descriptor) { - GPBDebugCheckRuntimeVersion(); + GPB_DEBUG_CHECK_RUNTIME_VERSIONS(); descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"google.protobuf" objcPrefix:@"GPB" syntax:GPBFileSyntaxProto3]; -- cgit v1.2.3