aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/compiler/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/google/protobuf/compiler/cpp')
-rw-r--r--src/google/protobuf/compiler/cpp/cpp_enum_field.cc6
-rw-r--r--src/google/protobuf/compiler/cpp/cpp_file.cc6
-rw-r--r--src/google/protobuf/compiler/cpp/cpp_message.cc2
3 files changed, 7 insertions, 7 deletions
diff --git a/src/google/protobuf/compiler/cpp/cpp_enum_field.cc b/src/google/protobuf/compiler/cpp/cpp_enum_field.cc
index 50c7b5f3..828d0be5 100644
--- a/src/google/protobuf/compiler/cpp/cpp_enum_field.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_enum_field.cc
@@ -128,7 +128,7 @@ GenerateCopyConstructorCode(io::Printer* printer) const {
void EnumFieldGenerator::
GenerateMergeFromCodedStream(io::Printer* printer) const {
printer->Print(variables_,
- "int value;\n"
+ "int value = 0;\n"
"DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<\n"
" int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(\n"
" input, &value)));\n");
@@ -334,7 +334,7 @@ void RepeatedEnumFieldGenerator::
GenerateMergeFromCodedStream(io::Printer* printer) const {
// Don't use ReadRepeatedPrimitive here so that the enum can be validated.
printer->Print(variables_,
- "int value;\n"
+ "int value = 0;\n"
"DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<\n"
" int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(\n"
" input, &value)));\n");
@@ -399,7 +399,7 @@ GenerateMergeFromCodedStreamWithPacking(io::Printer* printer) const {
"::google::protobuf::io::CodedInputStream::Limit limit = "
"input->PushLimit(static_cast<int>(length));\n"
"while (input->BytesUntilLimit() > 0) {\n"
- " int value;\n"
+ " int value = 0;\n"
" DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<\n"
" int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(\n"
" input, &value)));\n");
diff --git a/src/google/protobuf/compiler/cpp/cpp_file.cc b/src/google/protobuf/compiler/cpp/cpp_file.cc
index 42525687..02f360bb 100644
--- a/src/google/protobuf/compiler/cpp/cpp_file.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_file.cc
@@ -791,7 +791,7 @@ void FileGenerator::GenerateReflectionInitializationCode(io::Printer* printer) {
// AssignDescriptors(). All later times, waits for the first call to
// complete and then returns.
printer->Print(
- "void protobuf_AssignDescriptors() {\n"
+ "static void protobuf_AssignDescriptors() {\n"
// Make sure the file has found its way into the pool. If a descriptor
// is requested *during* static init then AddDescriptors() may not have
// been called yet, so we call it manually. Note that it's fine if
@@ -812,7 +812,7 @@ void FileGenerator::GenerateReflectionInitializationCode(io::Printer* printer) {
printer->Print(
"}\n"
"\n"
- "void protobuf_AssignDescriptorsOnce() {\n"
+ "static void protobuf_AssignDescriptorsOnce() {\n"
" static ::google::protobuf::internal::once_flag once;\n"
" ::google::protobuf::internal::call_once(once, protobuf_AssignDescriptors);\n"
"}\n"
@@ -850,7 +850,7 @@ void FileGenerator::GenerateReflectionInitializationCode(io::Printer* printer) {
// Now generate the AddDescriptors() function.
printer->Print(
- "void AddDescriptorsImpl() {\n"
+ "static void AddDescriptorsImpl() {\n"
" InitDefaults();\n");
printer->Indent();
diff --git a/src/google/protobuf/compiler/cpp/cpp_message.cc b/src/google/protobuf/compiler/cpp/cpp_message.cc
index 8c2336af..778fc406 100644
--- a/src/google/protobuf/compiler/cpp/cpp_message.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_message.cc
@@ -2280,7 +2280,7 @@ GenerateArenaDestructorCode(io::Printer* printer) {
"classname", classname_);
} else {
printer->Print(
- "void $classname$::RegisterArenaDtor(::google::protobuf::Arena* arena) {\n"
+ "void $classname$::RegisterArenaDtor(::google::protobuf::Arena*) {\n"
"}\n",
"classname", classname_);
}