Use 'kint32min'/'kint32max' constants, rather than defining locally.
Incorporates feedback from @xfxyjwf: https://github.com/google/protobuf/pull/84#discussion_r20474781.
This commit is contained in:
parent
83671c0514
commit
8b2aafe7d3
4 changed files with 2 additions and 20 deletions
|
@ -106,8 +106,8 @@ void EnumGenerator::GenerateDefinition(io::Printer* printer) {
|
|||
// INT32_MIN and INT32_MAX
|
||||
if (descriptor_->value_count() > 0) printer->Print(",\n");
|
||||
printer->Print(vars,
|
||||
"$classname$_$prefix$INT_MIN_SENTINEL_DO_NOT_USE_ = PROTOBUF_ENUM_MIN,\n"
|
||||
"$classname$_$prefix$INT_MAX_SENTINEL_DO_NOT_USE_ = PROTOBUF_ENUM_MAX");
|
||||
"$classname$_$prefix$INT_MIN_SENTINEL_DO_NOT_USE_ = ::google::protobuf::kint32min,\n"
|
||||
"$classname$_$prefix$INT_MAX_SENTINEL_DO_NOT_USE_ = ::google::protobuf::kint32max");
|
||||
}
|
||||
|
||||
printer->Outdent();
|
||||
|
|
|
@ -105,12 +105,6 @@ void FileGenerator::GenerateHeader(io::Printer* printer) {
|
|||
"#define PROTOBUF_$filename_identifier$__INCLUDED\n"
|
||||
"\n"
|
||||
"#include <string>\n"
|
||||
"#ifndef PROTOBUF_ENUM_MIN\n"
|
||||
"#define PROTOBUF_ENUM_MIN (int32_t)0x80000000\n"
|
||||
"#endif\n"
|
||||
"#ifndef PROTOBUF_ENUM_MAX\n"
|
||||
"#define PROTOBUF_ENUM_MAX (int32_t)0x7fffffff\n"
|
||||
"#endif\n"
|
||||
"\n",
|
||||
"filename", file_->name(),
|
||||
"filename_identifier", filename_identifier);
|
||||
|
|
|
@ -5,12 +5,6 @@
|
|||
#define PROTOBUF_google_2fprotobuf_2fcompiler_2fplugin_2eproto__INCLUDED
|
||||
|
||||
#include <string>
|
||||
#ifndef PROTOBUF_ENUM_MIN
|
||||
#define PROTOBUF_ENUM_MIN (int32_t)0x80000000
|
||||
#endif
|
||||
#ifndef PROTOBUF_ENUM_MAX
|
||||
#define PROTOBUF_ENUM_MAX (int32_t)0x7fffffff
|
||||
#endif
|
||||
|
||||
#include <google/protobuf/stubs/common.h>
|
||||
|
||||
|
|
|
@ -5,12 +5,6 @@
|
|||
#define PROTOBUF_google_2fprotobuf_2fdescriptor_2eproto__INCLUDED
|
||||
|
||||
#include <string>
|
||||
#ifndef PROTOBUF_ENUM_MIN
|
||||
#define PROTOBUF_ENUM_MIN (int32_t)0x80000000
|
||||
#endif
|
||||
#ifndef PROTOBUF_ENUM_MAX
|
||||
#define PROTOBUF_ENUM_MAX (int32_t)0x7fffffff
|
||||
#endif
|
||||
|
||||
#include <google/protobuf/stubs/common.h>
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue