[ObjC] Include the version checks in generated impl files.

There's always the chance someone will mix these, so play it safe and have checks in both.

PiperOrigin-RevId: 508114797
pull/11855/head
Protobuf Team Bot 2 years ago committed by Copybara-Service
parent ecde371dcd
commit e4d70bba01
  1. 7
      objectivec/GPBAny.pbobjc.m
  2. 7
      objectivec/GPBApi.pbobjc.m
  3. 7
      objectivec/GPBDuration.pbobjc.m
  4. 7
      objectivec/GPBEmpty.pbobjc.m
  5. 7
      objectivec/GPBFieldMask.pbobjc.m
  6. 7
      objectivec/GPBSourceContext.pbobjc.m
  7. 7
      objectivec/GPBStruct.pbobjc.m
  8. 7
      objectivec/GPBTimestamp.pbobjc.m
  9. 7
      objectivec/GPBType.pbobjc.m
  10. 7
      objectivec/GPBWrappers.pbobjc.m
  11. 38
      src/google/protobuf/compiler/objectivec/file.cc

@ -5,6 +5,13 @@
#import "GPBProtocolBuffers_RuntimeSupport.h" #import "GPBProtocolBuffers_RuntimeSupport.h"
#import "GPBAny.pbobjc.h" #import "GPBAny.pbobjc.h"
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30007
#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.
#endif
#if 30007 < 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) // @@protoc_insertion_point(imports)
#pragma clang diagnostic push #pragma clang diagnostic push

@ -5,6 +5,13 @@
#import "GPBProtocolBuffers_RuntimeSupport.h" #import "GPBProtocolBuffers_RuntimeSupport.h"
#import "GPBApi.pbobjc.h" #import "GPBApi.pbobjc.h"
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30007
#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.
#endif
#if 30007 < 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) // @@protoc_insertion_point(imports)
#pragma clang diagnostic push #pragma clang diagnostic push

@ -5,6 +5,13 @@
#import "GPBProtocolBuffers_RuntimeSupport.h" #import "GPBProtocolBuffers_RuntimeSupport.h"
#import "GPBDuration.pbobjc.h" #import "GPBDuration.pbobjc.h"
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30007
#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.
#endif
#if 30007 < 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) // @@protoc_insertion_point(imports)
#pragma clang diagnostic push #pragma clang diagnostic push

@ -5,6 +5,13 @@
#import "GPBProtocolBuffers_RuntimeSupport.h" #import "GPBProtocolBuffers_RuntimeSupport.h"
#import "GPBEmpty.pbobjc.h" #import "GPBEmpty.pbobjc.h"
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30007
#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.
#endif
#if 30007 < 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) // @@protoc_insertion_point(imports)
#pragma clang diagnostic push #pragma clang diagnostic push

@ -5,6 +5,13 @@
#import "GPBProtocolBuffers_RuntimeSupport.h" #import "GPBProtocolBuffers_RuntimeSupport.h"
#import "GPBFieldMask.pbobjc.h" #import "GPBFieldMask.pbobjc.h"
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30007
#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.
#endif
#if 30007 < 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) // @@protoc_insertion_point(imports)
#pragma clang diagnostic push #pragma clang diagnostic push

@ -5,6 +5,13 @@
#import "GPBProtocolBuffers_RuntimeSupport.h" #import "GPBProtocolBuffers_RuntimeSupport.h"
#import "GPBSourceContext.pbobjc.h" #import "GPBSourceContext.pbobjc.h"
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30007
#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.
#endif
#if 30007 < 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) // @@protoc_insertion_point(imports)
#pragma clang diagnostic push #pragma clang diagnostic push

@ -5,6 +5,13 @@
#import "GPBProtocolBuffers_RuntimeSupport.h" #import "GPBProtocolBuffers_RuntimeSupport.h"
#import "GPBStruct.pbobjc.h" #import "GPBStruct.pbobjc.h"
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30007
#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.
#endif
#if 30007 < 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
#import <stdatomic.h> #import <stdatomic.h>
// @@protoc_insertion_point(imports) // @@protoc_insertion_point(imports)

@ -5,6 +5,13 @@
#import "GPBProtocolBuffers_RuntimeSupport.h" #import "GPBProtocolBuffers_RuntimeSupport.h"
#import "GPBTimestamp.pbobjc.h" #import "GPBTimestamp.pbobjc.h"
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30007
#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.
#endif
#if 30007 < 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) // @@protoc_insertion_point(imports)
#pragma clang diagnostic push #pragma clang diagnostic push

@ -5,6 +5,13 @@
#import "GPBProtocolBuffers_RuntimeSupport.h" #import "GPBProtocolBuffers_RuntimeSupport.h"
#import "GPBType.pbobjc.h" #import "GPBType.pbobjc.h"
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30007
#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.
#endif
#if 30007 < 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
#import <stdatomic.h> #import <stdatomic.h>
// @@protoc_insertion_point(imports) // @@protoc_insertion_point(imports)

@ -5,6 +5,13 @@
#import "GPBProtocolBuffers_RuntimeSupport.h" #import "GPBProtocolBuffers_RuntimeSupport.h"
#import "GPBWrappers.pbobjc.h" #import "GPBWrappers.pbobjc.h"
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30007
#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.
#endif
#if 30007 < 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) // @@protoc_insertion_point(imports)
#pragma clang diagnostic push #pragma clang diagnostic push

@ -530,26 +530,24 @@ void FileGenerator::GenerateFile(
p->Print("\n"); p->Print("\n");
if (file_type == GeneratedFileType::kHeader) { // Add some verification that the generated code matches the source the
// Add some verification that the generated code matches the source the // code is being compiled with.
// code is being compiled with. // NOTE: This captures the raw numeric values at the time the generator was
// NOTE: This captures the raw numeric values at the time the generator was // compiled, since that will be the versions for the ObjC runtime at that
// compiled, since that will be the versions for the ObjC runtime at that // time. The constants in the generated code will then get their values at
// time. The constants in the generated code will then get their values at // compile time (so checking against the headers being used to compile).
// at compile time (so checking against the headers being used to compile). p->Print(
p->Print( // clang-format off
// clang-format off "#if GOOGLE_PROTOBUF_OBJC_VERSION < $google_protobuf_objc_version$\n"
"#if GOOGLE_PROTOBUF_OBJC_VERSION < $google_protobuf_objc_version$\n" "#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.\n"
"#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.\n" "#endif\n"
"#endif\n" "#if $google_protobuf_objc_version$ < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION\n"
"#if $google_protobuf_objc_version$ < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION\n" "#error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources.\n"
"#error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources.\n" "#endif\n"
"#endif\n" "\n",
"\n", // clang-format on
// clang-format on "google_protobuf_objc_version",
"google_protobuf_objc_version", absl::StrCat(GOOGLE_PROTOBUF_OBJC_VERSION));
absl::StrCat(GOOGLE_PROTOBUF_OBJC_VERSION));
}
// Enum implementation uses atomic in the generated code, so add // Enum implementation uses atomic in the generated code, so add
// the system import as needed. // the system import as needed.

Loading…
Cancel
Save