浏览代码

Fix macros in header of generated code (#5881)

* Fix macros in header of generated code

* Define PROTOBUF_MIN_PROTOC_VERSION in port_def.inc
* Remove duplicated GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION from common.h

* Send error if the error has been defined

* Undef the new macro
Paul Yang 6 年之前
父节点
当前提交
032a179e47
共有 3 个文件被更改,包括 5 次插入4 次删除
  1. 4 0
      src/google/protobuf/port_def.inc
  2. 1 0
      src/google/protobuf/port_undef.inc
  3. 0 4
      src/google/protobuf/stubs/common.h

+ 4 - 0
src/google/protobuf/port_def.inc

@@ -97,6 +97,9 @@
 #ifdef PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC
 #error PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC was previously defined
 #endif
+#ifdef PROTOBUF_MIN_PROTOC_VERSION
+#error PROTOBUF_MIN_PROTOC_VERSION was previously defined
+#endif
 #ifdef PROTOBUF_PREDICT_TRUE
 #error PROTOBUF_PREDICT_TRUE was previously defined
 #endif
@@ -257,6 +260,7 @@
 
 #define PROTOBUF_VERSION 3007000
 #define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC 3007000
+#define PROTOBUF_MIN_PROTOC_VERSION 3007000
 #define PROTOBUF_VERSION_SUFFIX ""
 
 // The minimum library version which works with the current version of the

+ 1 - 0
src/google/protobuf/port_undef.inc

@@ -50,6 +50,7 @@
 #undef PROTOBUF_VERSION_SUFFIX
 #undef PROTOBUF_FIELD_OFFSET
 #undef PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC
+#undef PROTOBUF_MIN_PROTOC_VERSION
 #undef PROTOBUF_PREDICT_TRUE
 #undef PROTOBUF_PREDICT_FALSE
 #undef PROTOBUF_LONGLONG

+ 0 - 4
src/google/protobuf/stubs/common.h

@@ -86,10 +86,6 @@ namespace internal {
 // A suffix string for alpha, beta or rc releases. Empty for stable releases.
 #define GOOGLE_PROTOBUF_VERSION_SUFFIX ""
 
-// The minimum library version which works with the current version of the
-// headers.
-#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 3007000
-
 // The minimum header version which works with the current version of
 // the library.  This constant should only be used by protoc's C++ code
 // generator.