c++ remove warning switch contains default but no case

pull/6802/head
Christian Maurer 5 years ago committed by Adam Cozzette
parent 3f4f315266
commit 2fc88527e0
  1. 13
      src/google/protobuf/compiler/cpp/cpp_helpers.cc

@ -1723,8 +1723,8 @@ class ParseLoopGenerator {
"while (!ctx->Done(&ptr)) {\n" "while (!ctx->Done(&ptr)) {\n"
" $uint32$ tag;\n" " $uint32$ tag;\n"
" ptr = $pi_ns$::ReadTag(ptr, &tag);\n" " ptr = $pi_ns$::ReadTag(ptr, &tag);\n"
" CHK_(ptr);\n" " CHK_(ptr);\n");
" switch (tag >> 3) {\n"); if (!ordered_fields.empty()) format_(" switch (tag >> 3) {\n");
format_.Indent(); format_.Indent();
format_.Indent(); format_.Indent();
@ -1787,7 +1787,7 @@ class ParseLoopGenerator {
} // for loop over ordered fields } // for loop over ordered fields
// Default case // Default case
format_("default: {\n"); if (!ordered_fields.empty()) format_("default: {\n");
if (!ordered_fields.empty()) format_("handle_unusual:\n"); if (!ordered_fields.empty()) format_("handle_unusual:\n");
format_( format_(
" if ((tag & 7) == 4 || tag == 0) {\n" " if ((tag & 7) == 4 || tag == 0) {\n"
@ -1828,12 +1828,11 @@ class ParseLoopGenerator {
" CHK_(ptr != nullptr);\n" " CHK_(ptr != nullptr);\n"
" continue;\n"); " continue;\n");
} }
format_("}\n"); // default case if (!ordered_fields.empty()) format_("}\n"); // default case
format_.Outdent(); format_.Outdent();
format_.Outdent(); format_.Outdent();
format_( if (!ordered_fields.empty()) format_(" } // switch\n");
" } // switch\n" format_("} // while\n");
"} // while\n");
} }
}; };

Loading…
Cancel
Save