|
|
|
@ -530,26 +530,24 @@ void FileGenerator::GenerateFile( |
|
|
|
|
|
|
|
|
|
p->Print("\n"); |
|
|
|
|
|
|
|
|
|
if (file_type == GeneratedFileType::kHeader) { |
|
|
|
|
// Add some verification that the generated code matches the source the
|
|
|
|
|
// code is being compiled with.
|
|
|
|
|
// 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
|
|
|
|
|
// time. The constants in the generated code will then get their values at
|
|
|
|
|
// at compile time (so checking against the headers being used to compile).
|
|
|
|
|
p->Print( |
|
|
|
|
// clang-format off
|
|
|
|
|
"#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" |
|
|
|
|
"#endif\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" |
|
|
|
|
"#endif\n" |
|
|
|
|
"\n", |
|
|
|
|
// clang-format on
|
|
|
|
|
"google_protobuf_objc_version", |
|
|
|
|
absl::StrCat(GOOGLE_PROTOBUF_OBJC_VERSION)); |
|
|
|
|
} |
|
|
|
|
// Add some verification that the generated code matches the source the
|
|
|
|
|
// code is being compiled with.
|
|
|
|
|
// 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
|
|
|
|
|
// time. The constants in the generated code will then get their values at
|
|
|
|
|
// compile time (so checking against the headers being used to compile).
|
|
|
|
|
p->Print( |
|
|
|
|
// clang-format off
|
|
|
|
|
"#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" |
|
|
|
|
"#endif\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" |
|
|
|
|
"#endif\n" |
|
|
|
|
"\n", |
|
|
|
|
// clang-format on
|
|
|
|
|
"google_protobuf_objc_version", |
|
|
|
|
absl::StrCat(GOOGLE_PROTOBUF_OBJC_VERSION)); |
|
|
|
|
|
|
|
|
|
// Enum implementation uses atomic in the generated code, so add
|
|
|
|
|
// the system import as needed.
|
|
|
|
|