diff options
author | Thomas Van Lenten <thomasvl@google.com> | 2016-09-15 13:27:17 -0400 |
---|---|---|
committer | Thomas Van Lenten <thomasvl@google.com> | 2016-09-15 17:22:51 -0400 |
commit | 1aa65000568422f0187d2eb4fef00bcdca0cc125 (patch) | |
tree | 0e7a0728d64ef3cdec39ab42c6113ee714eab388 /objectivec/GPBBootstrap.h | |
parent | 86fcd879b38505446799b2f2a2929415ddad620a (diff) | |
download | protobuf-1aa65000568422f0187d2eb4fef00bcdca0cc125.tar.gz protobuf-1aa65000568422f0187d2eb4fef00bcdca0cc125.tar.bz2 protobuf-1aa65000568422f0187d2eb4fef00bcdca0cc125.zip |
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.
Diffstat (limited to 'objectivec/GPBBootstrap.h')
-rw-r--r-- | objectivec/GPBBootstrap.h | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/objectivec/GPBBootstrap.h b/objectivec/GPBBootstrap.h index 7dc943d4..f14dd8aa 100644 --- a/objectivec/GPBBootstrap.h +++ b/objectivec/GPBBootstrap.h @@ -93,10 +93,27 @@ // Meant to be used internally by generated code. #define GPB_METHOD_FAMILY_NONE __attribute__((objc_method_family(none))) -// The protoc-gen-objc version which works with the current version of the -// generated Objective C sources. In general we don't want to change the -// runtime interfaces (or this version) as it means everything has to be -// regenerated. +// ---------------------------------------------------------------------------- +// These version numbers are all internal to the ObjC Protobuf runtime; they +// are used to ensure compatibility between the generated sources and the +// headers being compiled against and/or the version of sources being run +// against. // -// Meant to be used internally by generated code. -#define GOOGLE_PROTOBUF_OBJC_GEN_VERSION 30002 +// They are all #defines so the values are captured into every .o file they +// are used in and to allow comparisons in the preprocessor. + +// Current library runtime version. +// - Gets bumped when the runtime makes changes to the interfaces between the +// generated code and runtime (things added/removed, etc). +#define GOOGLE_PROTOBUF_OBJC_VERSION 30002 + +// Minimum runtime version supported for compiling/running against. +// - Gets changed when support for the older generated code is dropped. +#define GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION 30001 + + +// This is a legacy constant now frozen in time for old generated code. If +// GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION ever gets moved above 30001 then +// this should also change to break code compiled with an old runtime that +// can't be supported any more. +#define GOOGLE_PROTOBUF_OBJC_GEN_VERSION 30001 |