Add a dummy reference to prevent unused variable warning if there is no rpc method defined.

pull/5196/head
yang-g 9 years ago
parent 9c7961a014
commit e39cb740ca
  1. 1
      src/compiler/cpp_generator.cc

@ -1106,6 +1106,7 @@ void PrintSourceService(grpc::protobuf::io::Printer *printer,
printer->Print(*vars, "$ns$$Service$::Service::Service() {\n"); printer->Print(*vars, "$ns$$Service$::Service::Service() {\n");
printer->Indent(); printer->Indent();
printer->Print(*vars, "(void)$prefix$$Service$_method_names;\n");
for (int i = 0; i < service->method_count(); ++i) { for (int i = 0; i < service->method_count(); ++i) {
const grpc::protobuf::MethodDescriptor *method = service->method(i); const grpc::protobuf::MethodDescriptor *method = service->method(i);
(*vars)["Idx"] = as_string(i); (*vars)["Idx"] = as_string(i);

Loading…
Cancel
Save