Make it possible to compile with gcc4.6
diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc
index 8910323..088fc6b 100644
--- a/src/compiler/cpp_generator.cc
+++ b/src/compiler/cpp_generator.cc
@@ -300,13 +300,13 @@
(*vars)["Service"] = service->name();
printer->Print(*vars,
- "class $Service$ final {\n"
+ "class $Service$ GRPC_FINAL {\n"
" public:\n");
printer->Indent();
// Client side
printer->Print(
- "class Stub final : public ::grpc::InternalStub {\n"
+ "class Stub GRPC_FINAL : public ::grpc::InternalStub {\n"
" public:\n");
printer->Indent();
for (int i = 0; i < service->method_count(); ++i) {
@@ -331,7 +331,7 @@
for (int i = 0; i < service->method_count(); ++i) {
PrintHeaderServerMethodSync(printer, service->method(i), vars);
}
- printer->Print("::grpc::RpcService* service() override final;\n");
+ printer->Print("::grpc::RpcService* service() GRPC_OVERRIDE GRPC_FINAL;\n");
printer->Outdent();
printer->Print(
" private:\n"
@@ -340,7 +340,7 @@
// Server side - Asynchronous
printer->Print(
- "class AsyncService final : public ::grpc::AsynchronousService {\n"
+ "class AsyncService GRPC_FINAL : public ::grpc::AsynchronousService {\n"
" public:\n");
printer->Indent();
(*vars)["MethodCount"] = as_string(service->method_count());
diff --git a/src/compiler/python_generator.cc b/src/compiler/python_generator.cc
index a93b08c..490c518 100644
--- a/src/compiler/python_generator.cc
+++ b/src/compiler/python_generator.cc
@@ -216,7 +216,8 @@
path_iter != message_path.rend(); ++path_iter) {
message_type += (*path_iter)->name() + ".";
}
- message_type.pop_back();
+ // no pop_back prior to C++11
+ message_type.resize(message_type.size() - 1);
*out = make_pair(module, message_type);
return true;
}
diff --git a/src/compiler/python_plugin.cc b/src/compiler/python_plugin.cc
index ed1e049..0dd2c5b 100644
--- a/src/compiler/python_plugin.cc
+++ b/src/compiler/python_plugin.cc
@@ -56,12 +56,10 @@
class PythonGrpcGenerator : public CodeGenerator {
public:
PythonGrpcGenerator() {}
- ~PythonGrpcGenerator() override {}
+ ~PythonGrpcGenerator() {}
- bool Generate(const FileDescriptor* file,
- const string& parameter,
- GeneratorContext* context,
- string* error) const override {
+ bool Generate(const FileDescriptor* file, const string& parameter,
+ GeneratorContext* context, string* error) const {
// Get output file name.
string file_name;
static const int proto_suffix_length = strlen(".proto");
diff --git a/src/compiler/ruby_plugin.cc b/src/compiler/ruby_plugin.cc
index 6580e5a..4a6e9f7 100644
--- a/src/compiler/ruby_plugin.cc
+++ b/src/compiler/ruby_plugin.cc
@@ -50,12 +50,12 @@
class RubyGrpcGenerator : public google::protobuf::compiler::CodeGenerator {
public:
RubyGrpcGenerator() {}
- ~RubyGrpcGenerator() override {}
+ ~RubyGrpcGenerator() {}
bool Generate(const google::protobuf::FileDescriptor *file,
const std::string ¶meter,
google::protobuf::compiler::GeneratorContext *context,
- std::string *error) const override {
+ std::string *error) const {
std::string code = grpc_ruby_generator::GetServices(file);
if (code.size() == 0) {
return true; // don't generate a file if there are no services