aboutsummaryrefslogtreecommitdiffhomepage
path: root/objectivec/GPBUtilities_PackagePrivate.h
diff options
context:
space:
mode:
authorGravatar Thomas Van Lenten <thomasvl@google.com>2016-09-15 13:27:17 -0400
committerGravatar Thomas Van Lenten <thomasvl@google.com>2016-09-15 17:22:51 -0400
commit1aa65000568422f0187d2eb4fef00bcdca0cc125 (patch)
tree0e7a0728d64ef3cdec39ab42c6113ee714eab388 /objectivec/GPBUtilities_PackagePrivate.h
parent86fcd879b38505446799b2f2a2929415ddad620a (diff)
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/GPBUtilities_PackagePrivate.h')
-rw-r--r--objectivec/GPBUtilities_PackagePrivate.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/objectivec/GPBUtilities_PackagePrivate.h b/objectivec/GPBUtilities_PackagePrivate.h
index a41ee2ab..274351b7 100644
--- a/objectivec/GPBUtilities_PackagePrivate.h
+++ b/objectivec/GPBUtilities_PackagePrivate.h
@@ -50,6 +50,17 @@ CF_EXTERN_C_BEGIN
// These two are used to inject a runtime check for version mismatch into the
// generated sources to make sure they are linked with a supporting runtime.
+void GPBCheckRuntimeVersionSupport(int32_t objcRuntimeVersion);
+GPB_INLINE void GPB_DEBUG_CHECK_RUNTIME_VERSIONS() {
+ // NOTE: By being inline here, this captures the value from the library's
+ // headers at the time the generated code was compiled.
+#if defined(DEBUG) && DEBUG
+ GPBCheckRuntimeVersionSupport(GOOGLE_PROTOBUF_OBJC_VERSION);
+#endif
+}
+
+// Legacy version of the checks, remove when GOOGLE_PROTOBUF_OBJC_GEN_VERSION
+// goes away (see more info in GPBBootstrap.h).
void GPBCheckRuntimeVersionInternal(int32_t version);
GPB_INLINE void GPBDebugCheckRuntimeVersion() {
#if defined(DEBUG) && DEBUG