diff --git a/protobuf-c/protobuf-c.h b/protobuf-c/protobuf-c.h index 9732c41..881c0f4 100644 --- a/protobuf-c/protobuf-c.h +++ b/protobuf-c/protobuf-c.h @@ -103,6 +103,12 @@ protobuf_c_version_number(void); */ #define PROTOBUF_C_VERSION_NUMBER 1000000 +/** + * The minimum protoc-c version which works with the current version of the + * protobuf-c headers. + */ +#define PROTOBUF_C_MIN_COMPILER_VERSION 1000000 + typedef int protobuf_c_boolean; typedef enum { diff --git a/protoc-c/c_file.cc b/protoc-c/c_file.cc index fbe8fed..44b6150 100644 --- a/protoc-c/c_file.cc +++ b/protoc-c/c_file.cc @@ -119,6 +119,8 @@ FileGenerator::~FileGenerator() {} void FileGenerator::GenerateHeader(io::Printer* printer) { string filename_identifier = FilenameIdentifier(file_->name()); + static const int min_header_version = 1000000; + // Generate top of header. printer->Print( "/* Generated by the protocol buffer compiler. DO NOT EDIT! */\n" @@ -140,14 +142,13 @@ void FileGenerator::GenerateHeader(io::Printer* printer) { "#if PROTOBUF_C_VERSION_NUMBER < $min_header_version$\n" "# error This file was generated by a newer version of protoc-c which is " "incompatible with your libprotobuf-c headers. Please update your headers.\n" - "#elif $protoc_version$ < PROTOBUF_C_VERSION_NUMBER\n" + "#elif $protoc_version$ < PROTOBUF_C_MIN_COMPILER_VERSION\n" "# error This file was generated by an older version of protoc-c which is " "incompatible with your libprotobuf-c headers. Please regenerate this file " "with a newer version of protoc-c.\n" "#endif\n" "\n", - "min_header_version", - SimpleItoa(PROTOBUF_C_VERSION_NUMBER), + "min_header_version", SimpleItoa(min_header_version), "protoc_version", SimpleItoa(PROTOBUF_C_VERSION_NUMBER)); for (int i = 0; i < file_->dependency_count(); i++) {