Merge pull request #84 from tseaver/fix_80-avoid_INT32_MAX_MIN

Don't rely on non-standard 'INT32_MAX' / 'INT32_MIN'.
This commit is contained in:
Feng Xiao 2014-11-17 18:15:40 -08:00
commit 53c1029362
4 changed files with 2 additions and 5 deletions

View File

@ -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_ = INT32_MIN,\n"
"$classname$_$prefix$INT_MAX_SENTINEL_DO_NOT_USE_ = INT32_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();

View File

@ -105,7 +105,6 @@ void FileGenerator::GenerateHeader(io::Printer* printer) {
"#define PROTOBUF_$filename_identifier$__INCLUDED\n"
"\n"
"#include <string>\n"
"#include <stdint.h>\n" // INT32_MIN, INT32_MAX
"\n",
"filename", file_->name(),
"filename_identifier", filename_identifier);

View File

@ -5,7 +5,6 @@
#define PROTOBUF_google_2fprotobuf_2fcompiler_2fplugin_2eproto__INCLUDED
#include <string>
#include <stdint.h>
#include <google/protobuf/stubs/common.h>

View File

@ -5,7 +5,6 @@
#define PROTOBUF_google_2fprotobuf_2fdescriptor_2eproto__INCLUDED
#include <string>
#include <stdint.h>
#include <google/protobuf/stubs/common.h>