Skip to content
Snippets Groups Projects
Commit cf133f41 authored by Craig Tiller's avatar Craig Tiller
Browse files

Make it possible to compile with gcc4.6

parent a1d7f7f7
No related branches found
No related tags found
No related merge requests found
Showing
with 168 additions and 143 deletions
......@@ -152,6 +152,10 @@ $(error Invalid CONFIG value '$(CONFIG)')
endif
 
 
# Detect if we can use C++11
CXX11_CHECK_CMD = $(CXX) -std=c++11 -o /dev/null -c test/build/c++11.cc
HAS_CXX11 = $(shell $(CXX11_CHECK_CMD) 2> /dev/null && echo true || echo false)
# The HOST compiler settings are used to compile the protoc plugins.
# In most cases, you won't have to change anything, but if you are
# cross-compiling, you can override these variables from GNU make's
......@@ -167,7 +171,12 @@ DEFINES += $(DEFINES_$(CONFIG)) INSTALL_PREFIX=\"$(prefix)\"
LDFLAGS += $(LDFLAGS_$(CONFIG))
 
CFLAGS += -std=c89 -pedantic
ifeq ($(HAS_CXX11),true)
CXXFLAGS += -std=c++11
else
CXXFLAGS += -std=c++0x
DEFINES += GRPC_OLD_CXX
endif
CPPFLAGS += -g -fPIC -Wall -Wextra -Werror -Wno-long-long -Wno-unused-parameter
LDFLAGS += -g -fPIC
 
......@@ -897,7 +906,11 @@ third_party/protobuf/configure:
 
$(LIBDIR)/$(CONFIG)/protobuf/libprotobuf.a: third_party/protobuf/configure
$(E) "[MAKE] Building protobuf"
ifeq ($(HAVE_CXX11),true)
$(Q)(cd third_party/protobuf ; CC="$(CC)" CXX="$(CXX)" LDFLAGS="$(LDFLAGS_$(CONFIG)) -g" CXXFLAGS="-DLANG_CXX11 -std=c++11" CPPFLAGS="-fPIC $(CPPFLAGS_$(CONFIG)) -g" ./configure --disable-shared --enable-static)
else
$(Q)(cd third_party/protobuf ; CC="$(CC)" CXX="$(CXX)" LDFLAGS="$(LDFLAGS_$(CONFIG)) -g" CXXFLAGS="-std=c++0x" CPPFLAGS="-fPIC $(CPPFLAGS_$(CONFIG)) -g" ./configure --disable-shared --enable-static)
endif
$(Q)$(MAKE) -C third_party/protobuf clean
$(Q)$(MAKE) -C third_party/protobuf
$(Q)mkdir -p $(LIBDIR)/$(CONFIG)/protobuf
......@@ -61,28 +61,28 @@ class PublisherServiceImpl : public tech::pubsub::PublisherService::Service {
public:
Status CreateTopic(::grpc::ServerContext* context,
const ::tech::pubsub::Topic* request,
::tech::pubsub::Topic* response) override {
::tech::pubsub::Topic* response) GRPC_OVERRIDE {
EXPECT_EQ(request->name(), kTopic);
return Status::OK;
}
Status Publish(ServerContext* context,
const ::tech::pubsub::PublishRequest* request,
::proto2::Empty* response) override {
::proto2::Empty* response) GRPC_OVERRIDE {
EXPECT_EQ(request->message().data(), kMessageData);
return Status::OK;
}
Status GetTopic(ServerContext* context,
const ::tech::pubsub::GetTopicRequest* request,
::tech::pubsub::Topic* response) override {
::tech::pubsub::Topic* response) GRPC_OVERRIDE {
EXPECT_EQ(request->topic(), kTopic);
return Status::OK;
}
Status ListTopics(ServerContext* context,
const ::tech::pubsub::ListTopicsRequest* request,
::tech::pubsub::ListTopicsResponse* response) override {
Status ListTopics(
ServerContext* context, const ::tech::pubsub::ListTopicsRequest* request,
::tech::pubsub::ListTopicsResponse* response) GRPC_OVERRIDE {
std::ostringstream ss;
ss << "cloud.googleapis.com/project in (/projects/" << kProjectId << ")";
EXPECT_EQ(request->query(), ss.str());
......@@ -92,7 +92,7 @@ class PublisherServiceImpl : public tech::pubsub::PublisherService::Service {
Status DeleteTopic(ServerContext* context,
const ::tech::pubsub::DeleteTopicRequest* request,
::proto2::Empty* response) override {
::proto2::Empty* response) GRPC_OVERRIDE {
EXPECT_EQ(request->topic(), kTopic);
return Status::OK;
}
......@@ -102,7 +102,7 @@ class PublisherServiceImpl : public tech::pubsub::PublisherService::Service {
class PublisherTest : public ::testing::Test {
protected:
// Setup a server and a client for PublisherService.
void SetUp() override {
void SetUp() GRPC_OVERRIDE {
int port = grpc_pick_unused_port_or_die();
server_address_ << "localhost:" << port;
ServerBuilder builder;
......@@ -116,7 +116,7 @@ class PublisherTest : public ::testing::Test {
publisher_.reset(new grpc::examples::pubsub::Publisher(channel_));
}
void TearDown() override {
void TearDown() GRPC_OVERRIDE {
server_->Shutdown();
publisher_->Shutdown();
}
......
......@@ -57,9 +57,9 @@ const char kData[] = "Message data";
class SubscriberServiceImpl : public tech::pubsub::SubscriberService::Service {
public:
Status CreateSubscription(ServerContext* context,
const tech::pubsub::Subscription* request,
tech::pubsub::Subscription* response) override {
Status CreateSubscription(
ServerContext* context, const tech::pubsub::Subscription* request,
tech::pubsub::Subscription* response) GRPC_OVERRIDE {
EXPECT_EQ(request->topic(), kTopic);
EXPECT_EQ(request->name(), kSubscriptionName);
return Status::OK;
......@@ -67,7 +67,7 @@ class SubscriberServiceImpl : public tech::pubsub::SubscriberService::Service {
Status GetSubscription(ServerContext* context,
const tech::pubsub::GetSubscriptionRequest* request,
tech::pubsub::Subscription* response) override {
tech::pubsub::Subscription* response) GRPC_OVERRIDE {
EXPECT_EQ(request->subscription(), kSubscriptionName);
response->set_topic(kTopic);
return Status::OK;
......@@ -76,14 +76,13 @@ class SubscriberServiceImpl : public tech::pubsub::SubscriberService::Service {
Status DeleteSubscription(
ServerContext* context,
const tech::pubsub::DeleteSubscriptionRequest* request,
proto2::Empty* response) override {
proto2::Empty* response) GRPC_OVERRIDE {
EXPECT_EQ(request->subscription(), kSubscriptionName);
return Status::OK;
}
Status Pull(ServerContext* context,
const tech::pubsub::PullRequest* request,
tech::pubsub::PullResponse* response) override {
Status Pull(ServerContext* context, const tech::pubsub::PullRequest* request,
tech::pubsub::PullResponse* response) GRPC_OVERRIDE {
EXPECT_EQ(request->subscription(), kSubscriptionName);
response->set_ack_id("1");
response->mutable_pubsub_event()->mutable_message()->set_data(kData);
......@@ -92,7 +91,7 @@ class SubscriberServiceImpl : public tech::pubsub::SubscriberService::Service {
Status Acknowledge(ServerContext* context,
const tech::pubsub::AcknowledgeRequest* request,
proto2::Empty* response) override {
proto2::Empty* response) GRPC_OVERRIDE {
return Status::OK;
}
......@@ -101,7 +100,7 @@ class SubscriberServiceImpl : public tech::pubsub::SubscriberService::Service {
class SubscriberTest : public ::testing::Test {
protected:
// Setup a server and a client for SubscriberService.
void SetUp() override {
void SetUp() GRPC_OVERRIDE {
int port = grpc_pick_unused_port_or_die();
server_address_ << "localhost:" << port;
ServerBuilder builder;
......@@ -115,7 +114,7 @@ class SubscriberTest : public ::testing::Test {
subscriber_.reset(new grpc::examples::pubsub::Subscriber(channel_));
}
void TearDown() override {
void TearDown() GRPC_OVERRIDE {
server_->Shutdown();
subscriber_->Shutdown();
}
......
......@@ -45,7 +45,7 @@
namespace grpc {
template <class R>
class ClientAsyncResponseReader final {
class ClientAsyncResponseReader GRPC_FINAL {
public:
ClientAsyncResponseReader(ChannelInterface* channel, CompletionQueue* cq,
const RpcMethod& method, ClientContext* context,
......@@ -79,7 +79,7 @@ class ClientAsyncResponseReader final {
private:
ClientContext* context_ = nullptr;
ClientContext* context_;
Call call_;
CallOpBuffer init_buf_;
CallOpBuffer meta_buf_;
......@@ -87,7 +87,8 @@ class ClientAsyncResponseReader final {
};
template <class W>
class ServerAsyncResponseWriter final : public ServerAsyncStreamingInterface {
class ServerAsyncResponseWriter GRPC_FINAL
: public ServerAsyncStreamingInterface {
public:
explicit ServerAsyncResponseWriter(ServerContext* ctx)
: call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
......@@ -127,7 +128,7 @@ class ServerAsyncResponseWriter final : public ServerAsyncStreamingInterface {
}
private:
void BindCall(Call* call) override { call_ = *call; }
void BindCall(Call* call) GRPC_OVERRIDE { call_ = *call; }
Call call_;
ServerContext* ctx_;
......
......@@ -139,7 +139,7 @@ class ClientContext {
return authority_;
}
bool initial_metadata_received_ = false;
bool initial_metadata_received_;
grpc_call *call_;
grpc_completion_queue *cq_;
gpr_timespec absolute_deadline_;
......
......@@ -36,6 +36,14 @@
#include <string>
#ifdef GRPC_OLD_CXX
#define GRPC_FINAL
#define GRPC_OVERRIDE
#else
#define GRPC_FINAL final
#define GRPC_OVERRIDE override
#endif
namespace grpc {
typedef std::string string;
......
......@@ -47,7 +47,7 @@ namespace grpc {
// to creating an instance using CredentialsFactory, and passing it down
// during channel construction.
class Credentials final {
class Credentials GRPC_FINAL {
public:
~Credentials();
......
......@@ -35,6 +35,7 @@
#define __GRPCPP_CALL_H__
#include <grpc/grpc.h>
#include <grpc++/config.h>
#include <grpc++/status.h>
#include <grpc++/completion_queue.h>
......@@ -56,7 +57,7 @@ class Call;
class CallOpBuffer : public CompletionQueueTag {
public:
CallOpBuffer() : return_tag_(this) {}
CallOpBuffer();
~CallOpBuffer();
void Reset(void *next_return_tag);
......@@ -80,40 +81,40 @@ class CallOpBuffer : public CompletionQueueTag {
void FillOps(grpc_op *ops, size_t *nops);
// Called by completion queue just prior to returning from Next() or Pluck()
bool FinalizeResult(void **tag, bool *status) override;
bool FinalizeResult(void **tag, bool *status) GRPC_OVERRIDE;
bool got_message = false;
bool got_message;
private:
void *return_tag_ = nullptr;
void *return_tag_;
// Send initial metadata
bool send_initial_metadata_ = false;
size_t initial_metadata_count_ = 0;
grpc_metadata *initial_metadata_ = nullptr;
bool send_initial_metadata_;
size_t initial_metadata_count_;
grpc_metadata *initial_metadata_;
// Recv initial metadta
std::multimap<grpc::string, grpc::string> *recv_initial_metadata_ = nullptr;
grpc_metadata_array recv_initial_metadata_arr_ = {0, 0, nullptr};
std::multimap<grpc::string, grpc::string> *recv_initial_metadata_;
grpc_metadata_array recv_initial_metadata_arr_;
// Send message
const google::protobuf::Message *send_message_ = nullptr;
grpc_byte_buffer *send_message_buf_ = nullptr;
const google::protobuf::Message *send_message_;
grpc_byte_buffer *send_message_buf_;
// Recv message
google::protobuf::Message *recv_message_ = nullptr;
grpc_byte_buffer *recv_message_buf_ = nullptr;
google::protobuf::Message *recv_message_;
grpc_byte_buffer *recv_message_buf_;
// Client send close
bool client_send_close_ = false;
bool client_send_close_;
// Client recv status
std::multimap<grpc::string, grpc::string> *recv_trailing_metadata_ = nullptr;
Status *recv_status_ = nullptr;
grpc_metadata_array recv_trailing_metadata_arr_ = {0, 0, nullptr};
grpc_status_code status_code_ = GRPC_STATUS_OK;
char *status_details_ = nullptr;
size_t status_details_capacity_ = 0;
std::multimap<grpc::string, grpc::string> *recv_trailing_metadata_;
Status *recv_status_;
grpc_metadata_array recv_trailing_metadata_arr_;
grpc_status_code status_code_;
char *status_details_;
size_t status_details_capacity_;
// Server send status
const Status *send_status_ = nullptr;
size_t trailing_metadata_count_ = 0;
grpc_metadata *trailing_metadata_ = nullptr;
const Status *send_status_;
size_t trailing_metadata_count_;
grpc_metadata *trailing_metadata_;
int cancelled_buf_;
bool *recv_closed_ = nullptr;
bool *recv_closed_;
};
// Channel and Server implement this to allow them to hook performing ops
......@@ -124,7 +125,7 @@ class CallHook {
};
// Straightforward wrapping of the C call object
class Call final {
class Call GRPC_FINAL {
public:
/* call is owned by the caller */
Call(grpc_call *call, CallHook *call_hook_, CompletionQueue *cq);
......
......@@ -77,7 +77,7 @@ class RpcMethodHandler : public MethodHandler {
ServiceType* service)
: func_(func), service_(service) {}
Status RunHandler(const HandlerParameter& param) final {
Status RunHandler(const HandlerParameter& param) GRPC_FINAL {
// Invoke application function, cast proto messages to their actual types.
return func_(service_, param.server_context,
dynamic_cast<const RequestType*>(param.request),
......@@ -102,7 +102,7 @@ class ClientStreamingHandler : public MethodHandler {
ServiceType* service)
: func_(func), service_(service) {}
Status RunHandler(const HandlerParameter& param) final {
Status RunHandler(const HandlerParameter& param) GRPC_FINAL {
ServerReader<RequestType> reader(param.call, param.server_context);
return func_(service_, param.server_context, &reader,
dynamic_cast<ResponseType*>(param.response));
......@@ -124,7 +124,7 @@ class ServerStreamingHandler : public MethodHandler {
ServiceType* service)
: func_(func), service_(service) {}
Status RunHandler(const HandlerParameter& param) final {
Status RunHandler(const HandlerParameter& param) GRPC_FINAL {
ServerWriter<ResponseType> writer(param.call, param.server_context);
return func_(service_, param.server_context,
dynamic_cast<const RequestType*>(param.request), &writer);
......@@ -147,7 +147,7 @@ class BidiStreamingHandler : public MethodHandler {
ServiceType* service)
: func_(func), service_(service) {}
Status RunHandler(const HandlerParameter& param) final {
Status RunHandler(const HandlerParameter& param) GRPC_FINAL {
ServerReaderWriter<ResponseType, RequestType> stream(param.call,
param.server_context);
return func_(service_, param.server_context, &stream);
......
......@@ -79,7 +79,11 @@ class AsynchronousService {
AsynchronousService(CompletionQueue* cq, const char** method_names,
size_t method_count)
: cq_(cq), method_names_(method_names), method_count_(method_count) {}
: cq_(cq),
dispatch_impl_(nullptr),
method_names_(method_names),
method_count_(method_count),
request_args_(nullptr) {}
~AsynchronousService() { delete[] request_args_; }
......@@ -116,10 +120,10 @@ class AsynchronousService {
private:
friend class Server;
CompletionQueue* const cq_;
DispatchImpl* dispatch_impl_ = nullptr;
DispatchImpl* dispatch_impl_;
const char** const method_names_;
size_t method_count_;
void** request_args_ = nullptr;
void** request_args_;
};
} // namespace grpc
......
......@@ -61,8 +61,8 @@ class ServerCredentials;
class ThreadPoolInterface;
// Currently it only supports handling rpcs in a single thread.
class Server final : private CallHook,
private AsynchronousService::DispatchImpl {
class Server GRPC_FINAL : private CallHook,
private AsynchronousService::DispatchImpl {
public:
~Server();
......@@ -97,7 +97,7 @@ class Server final : private CallHook,
void RunRpc();
void ScheduleCallback();
void PerformOpsOnCall(CallOpBuffer* ops, Call* call) override;
void PerformOpsOnCall(CallOpBuffer* ops, Call* call) GRPC_OVERRIDE;
// DispatchImpl
void RequestAsyncCall(void* registered_method, ServerContext* context,
......
......@@ -83,7 +83,7 @@ class ServerBuilder {
std::vector<AsynchronousService*> async_services_;
std::vector<grpc::string> ports_;
std::shared_ptr<ServerCredentials> creds_;
ThreadPoolInterface* thread_pool_ = nullptr;
ThreadPoolInterface* thread_pool_;
};
} // namespace grpc
......
......@@ -66,7 +66,7 @@ class CompletionQueue;
class Server;
// Interface of server side rpc context.
class ServerContext final {
class ServerContext GRPC_FINAL {
public:
ServerContext(); // for async calls
~ServerContext();
......@@ -108,12 +108,12 @@ class ServerContext final {
ServerContext(gpr_timespec deadline, grpc_metadata* metadata,
size_t metadata_count);
CompletionOp* completion_op_ = nullptr;
CompletionOp* completion_op_;
std::chrono::system_clock::time_point deadline_;
grpc_call* call_ = nullptr;
CompletionQueue* cq_ = nullptr;
bool sent_initial_metadata_ = false;
grpc_call* call_;
CompletionQueue* cq_;
bool sent_initial_metadata_;
std::multimap<grpc::string, grpc::string> client_metadata_;
std::multimap<grpc::string, grpc::string> initial_metadata_;
std::multimap<grpc::string, grpc::string> trailing_metadata_;
......
......@@ -44,7 +44,7 @@ struct grpc_server_credentials;
namespace grpc {
// grpc_server_credentials wrapper class.
class ServerCredentials final {
class ServerCredentials GRPC_FINAL {
public:
~ServerCredentials();
......
......@@ -83,8 +83,8 @@ class WriterInterface {
};
template <class R>
class ClientReader final : public ClientStreamingInterface,
public ReaderInterface<R> {
class ClientReader GRPC_FINAL : public ClientStreamingInterface,
public ReaderInterface<R> {
public:
// Blocking create a stream and write the first request out.
ClientReader(ChannelInterface* channel, const RpcMethod& method,
......@@ -111,7 +111,7 @@ class ClientReader final : public ClientStreamingInterface,
GPR_ASSERT(cq_.Pluck(&buf));
}
virtual bool Read(R* msg) override {
virtual bool Read(R* msg) GRPC_OVERRIDE {
CallOpBuffer buf;
if (!context_->initial_metadata_received_) {
buf.AddRecvInitialMetadata(context_);
......@@ -121,7 +121,7 @@ class ClientReader final : public ClientStreamingInterface,
return cq_.Pluck(&buf) && buf.got_message;
}
virtual Status Finish() override {
virtual Status Finish() GRPC_OVERRIDE {
CallOpBuffer buf;
Status status;
buf.AddClientRecvStatus(context_, &status);
......@@ -137,8 +137,8 @@ class ClientReader final : public ClientStreamingInterface,
};
template <class W>
class ClientWriter final : public ClientStreamingInterface,
public WriterInterface<W> {
class ClientWriter GRPC_FINAL : public ClientStreamingInterface,
public WriterInterface<W> {
public:
// Blocking create a stream.
ClientWriter(ChannelInterface* channel, const RpcMethod& method,
......@@ -152,7 +152,7 @@ class ClientWriter final : public ClientStreamingInterface,
cq_.Pluck(&buf);
}
virtual bool Write(const W& msg) override {
virtual bool Write(const W& msg) GRPC_OVERRIDE {
CallOpBuffer buf;
buf.AddSendMessage(msg);
call_.PerformOps(&buf);
......@@ -167,7 +167,7 @@ class ClientWriter final : public ClientStreamingInterface,
}
// Read the final response and wait for the final status.
virtual Status Finish() override {
virtual Status Finish() GRPC_OVERRIDE {
CallOpBuffer buf;
Status status;
buf.AddRecvMessage(response_);
......@@ -186,9 +186,9 @@ class ClientWriter final : public ClientStreamingInterface,
// Client-side interface for bi-directional streaming.
template <class W, class R>
class ClientReaderWriter final : public ClientStreamingInterface,
public WriterInterface<W>,
public ReaderInterface<R> {
class ClientReaderWriter GRPC_FINAL : public ClientStreamingInterface,
public WriterInterface<W>,
public ReaderInterface<R> {
public:
// Blocking create a stream.
ClientReaderWriter(ChannelInterface* channel, const RpcMethod& method,
......@@ -213,7 +213,7 @@ class ClientReaderWriter final : public ClientStreamingInterface,
GPR_ASSERT(cq_.Pluck(&buf));
}
virtual bool Read(R* msg) override {
virtual bool Read(R* msg) GRPC_OVERRIDE {
CallOpBuffer buf;
if (!context_->initial_metadata_received_) {
buf.AddRecvInitialMetadata(context_);
......@@ -223,7 +223,7 @@ class ClientReaderWriter final : public ClientStreamingInterface,
return cq_.Pluck(&buf) && buf.got_message;
}
virtual bool Write(const W& msg) override {
virtual bool Write(const W& msg) GRPC_OVERRIDE {
CallOpBuffer buf;
buf.AddSendMessage(msg);
call_.PerformOps(&buf);
......@@ -237,7 +237,7 @@ class ClientReaderWriter final : public ClientStreamingInterface,
return cq_.Pluck(&buf);
}
virtual Status Finish() override {
virtual Status Finish() GRPC_OVERRIDE {
CallOpBuffer buf;
Status status;
buf.AddClientRecvStatus(context_, &status);
......@@ -253,7 +253,7 @@ class ClientReaderWriter final : public ClientStreamingInterface,
};
template <class R>
class ServerReader final : public ReaderInterface<R> {
class ServerReader GRPC_FINAL : public ReaderInterface<R> {
public:
ServerReader(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {}
......@@ -267,7 +267,7 @@ class ServerReader final : public ReaderInterface<R> {
call_->cq()->Pluck(&buf);
}
virtual bool Read(R* msg) override {
virtual bool Read(R* msg) GRPC_OVERRIDE {
CallOpBuffer buf;
buf.AddRecvMessage(msg);
call_->PerformOps(&buf);
......@@ -280,7 +280,7 @@ class ServerReader final : public ReaderInterface<R> {
};
template <class W>
class ServerWriter final : public WriterInterface<W> {
class ServerWriter GRPC_FINAL : public WriterInterface<W> {
public:
ServerWriter(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {}
......@@ -294,7 +294,7 @@ class ServerWriter final : public WriterInterface<W> {
call_->cq()->Pluck(&buf);
}
virtual bool Write(const W& msg) override {
virtual bool Write(const W& msg) GRPC_OVERRIDE {
CallOpBuffer buf;
if (!ctx_->sent_initial_metadata_) {
buf.AddSendInitialMetadata(&ctx_->initial_metadata_);
......@@ -312,8 +312,8 @@ class ServerWriter final : public WriterInterface<W> {
// Server-side interface for bi-directional streaming.
template <class W, class R>
class ServerReaderWriter final : public WriterInterface<W>,
public ReaderInterface<R> {
class ServerReaderWriter GRPC_FINAL : public WriterInterface<W>,
public ReaderInterface<R> {
public:
ServerReaderWriter(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {}
......@@ -327,14 +327,14 @@ class ServerReaderWriter final : public WriterInterface<W>,
call_->cq()->Pluck(&buf);
}
virtual bool Read(R* msg) override {
virtual bool Read(R* msg) GRPC_OVERRIDE {
CallOpBuffer buf;
buf.AddRecvMessage(msg);
call_->PerformOps(&buf);
return call_->cq()->Pluck(&buf) && buf.got_message;
}
virtual bool Write(const W& msg) override {
virtual bool Write(const W& msg) GRPC_OVERRIDE {
CallOpBuffer buf;
if (!ctx_->sent_initial_metadata_) {
buf.AddSendInitialMetadata(&ctx_->initial_metadata_);
......@@ -380,8 +380,8 @@ class AsyncWriterInterface {
};
template <class R>
class ClientAsyncReader final : public ClientAsyncStreamingInterface,
public AsyncReaderInterface<R> {
class ClientAsyncReader GRPC_FINAL : public ClientAsyncStreamingInterface,
public AsyncReaderInterface<R> {
public:
// Create a stream and write the first request out.
ClientAsyncReader(ChannelInterface* channel, CompletionQueue* cq,
......@@ -395,7 +395,7 @@ class ClientAsyncReader final : public ClientAsyncStreamingInterface,
call_.PerformOps(&init_buf_);
}
void ReadInitialMetadata(void* tag) override {
void ReadInitialMetadata(void* tag) GRPC_OVERRIDE {
GPR_ASSERT(!context_->initial_metadata_received_);
meta_buf_.Reset(tag);
......@@ -403,7 +403,7 @@ class ClientAsyncReader final : public ClientAsyncStreamingInterface,
call_.PerformOps(&meta_buf_);
}
void Read(R* msg, void* tag) override {
void Read(R* msg, void* tag) GRPC_OVERRIDE {
read_buf_.Reset(tag);
if (!context_->initial_metadata_received_) {
read_buf_.AddRecvInitialMetadata(context_);
......@@ -412,7 +412,7 @@ class ClientAsyncReader final : public ClientAsyncStreamingInterface,
call_.PerformOps(&read_buf_);
}
void Finish(Status* status, void* tag) override {
void Finish(Status* status, void* tag) GRPC_OVERRIDE {
finish_buf_.Reset(tag);
if (!context_->initial_metadata_received_) {
finish_buf_.AddRecvInitialMetadata(context_);
......@@ -422,7 +422,7 @@ class ClientAsyncReader final : public ClientAsyncStreamingInterface,
}
private:
ClientContext* context_ = nullptr;
ClientContext* context_;
Call call_;
CallOpBuffer init_buf_;
CallOpBuffer meta_buf_;
......@@ -431,8 +431,8 @@ class ClientAsyncReader final : public ClientAsyncStreamingInterface,
};
template <class W>
class ClientAsyncWriter final : public ClientAsyncStreamingInterface,
public AsyncWriterInterface<W> {
class ClientAsyncWriter GRPC_FINAL : public ClientAsyncStreamingInterface,
public AsyncWriterInterface<W> {
public:
ClientAsyncWriter(ChannelInterface* channel, CompletionQueue* cq,
const RpcMethod& method, ClientContext* context,
......@@ -445,7 +445,7 @@ class ClientAsyncWriter final : public ClientAsyncStreamingInterface,
call_.PerformOps(&init_buf_);
}
void ReadInitialMetadata(void* tag) override {
void ReadInitialMetadata(void* tag) GRPC_OVERRIDE {
GPR_ASSERT(!context_->initial_metadata_received_);
meta_buf_.Reset(tag);
......@@ -453,7 +453,7 @@ class ClientAsyncWriter final : public ClientAsyncStreamingInterface,
call_.PerformOps(&meta_buf_);
}
void Write(const W& msg, void* tag) override {
void Write(const W& msg, void* tag) GRPC_OVERRIDE {
write_buf_.Reset(tag);
write_buf_.AddSendMessage(msg);
call_.PerformOps(&write_buf_);
......@@ -465,7 +465,7 @@ class ClientAsyncWriter final : public ClientAsyncStreamingInterface,
call_.PerformOps(&writes_done_buf_);
}
void Finish(Status* status, void* tag) override {
void Finish(Status* status, void* tag) GRPC_OVERRIDE {
finish_buf_.Reset(tag);
if (!context_->initial_metadata_received_) {
finish_buf_.AddRecvInitialMetadata(context_);
......@@ -476,7 +476,7 @@ class ClientAsyncWriter final : public ClientAsyncStreamingInterface,
}
private:
ClientContext* context_ = nullptr;
ClientContext* context_;
google::protobuf::Message* const response_;
Call call_;
CallOpBuffer init_buf_;
......@@ -488,9 +488,9 @@ class ClientAsyncWriter final : public ClientAsyncStreamingInterface,
// Client-side interface for bi-directional streaming.
template <class W, class R>
class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface,
public AsyncWriterInterface<W>,
public AsyncReaderInterface<R> {
class ClientAsyncReaderWriter GRPC_FINAL : public ClientAsyncStreamingInterface,
public AsyncWriterInterface<W>,
public AsyncReaderInterface<R> {
public:
ClientAsyncReaderWriter(ChannelInterface* channel, CompletionQueue* cq,
const RpcMethod& method, ClientContext* context,
......@@ -501,7 +501,7 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface,
call_.PerformOps(&init_buf_);
}
void ReadInitialMetadata(void* tag) override {
void ReadInitialMetadata(void* tag) GRPC_OVERRIDE {
GPR_ASSERT(!context_->initial_metadata_received_);
meta_buf_.Reset(tag);
......@@ -509,7 +509,7 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface,
call_.PerformOps(&meta_buf_);
}
void Read(R* msg, void* tag) override {
void Read(R* msg, void* tag) GRPC_OVERRIDE {
read_buf_.Reset(tag);
if (!context_->initial_metadata_received_) {
read_buf_.AddRecvInitialMetadata(context_);
......@@ -518,7 +518,7 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface,
call_.PerformOps(&read_buf_);
}
void Write(const W& msg, void* tag) override {
void Write(const W& msg, void* tag) GRPC_OVERRIDE {
write_buf_.Reset(tag);
write_buf_.AddSendMessage(msg);
call_.PerformOps(&write_buf_);
......@@ -530,7 +530,7 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface,
call_.PerformOps(&writes_done_buf_);
}
void Finish(Status* status, void* tag) override {
void Finish(Status* status, void* tag) GRPC_OVERRIDE {
finish_buf_.Reset(tag);
if (!context_->initial_metadata_received_) {
finish_buf_.AddRecvInitialMetadata(context_);
......@@ -540,7 +540,7 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface,
}
private:
ClientContext* context_ = nullptr;
ClientContext* context_;
Call call_;
CallOpBuffer init_buf_;
CallOpBuffer meta_buf_;
......@@ -551,13 +551,13 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface,
};
template <class W, class R>
class ServerAsyncReader : public ServerAsyncStreamingInterface,
public AsyncReaderInterface<R> {
class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface,
public AsyncReaderInterface<R> {
public:
explicit ServerAsyncReader(ServerContext* ctx)
: call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
void SendInitialMetadata(void* tag) override {
void SendInitialMetadata(void* tag) GRPC_OVERRIDE {
GPR_ASSERT(!ctx_->sent_initial_metadata_);
meta_buf_.Reset(tag);
......@@ -566,7 +566,7 @@ class ServerAsyncReader : public ServerAsyncStreamingInterface,
call_.PerformOps(&meta_buf_);
}
void Read(R* msg, void* tag) override {
void Read(R* msg, void* tag) GRPC_OVERRIDE {
read_buf_.Reset(tag);
read_buf_.AddRecvMessage(msg);
call_.PerformOps(&read_buf_);
......@@ -598,7 +598,7 @@ class ServerAsyncReader : public ServerAsyncStreamingInterface,
}
private:
void BindCall(Call* call) override { call_ = *call; }
void BindCall(Call* call) GRPC_OVERRIDE { call_ = *call; }
Call call_;
ServerContext* ctx_;
......@@ -608,13 +608,13 @@ class ServerAsyncReader : public ServerAsyncStreamingInterface,
};
template <class W>
class ServerAsyncWriter : public ServerAsyncStreamingInterface,
public AsyncWriterInterface<W> {
class ServerAsyncWriter GRPC_FINAL : public ServerAsyncStreamingInterface,
public AsyncWriterInterface<W> {
public:
explicit ServerAsyncWriter(ServerContext* ctx)
: call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
void SendInitialMetadata(void* tag) override {
void SendInitialMetadata(void* tag) GRPC_OVERRIDE {
GPR_ASSERT(!ctx_->sent_initial_metadata_);
meta_buf_.Reset(tag);
......@@ -623,7 +623,7 @@ class ServerAsyncWriter : public ServerAsyncStreamingInterface,
call_.PerformOps(&meta_buf_);
}
void Write(const W& msg, void* tag) override {
void Write(const W& msg, void* tag) GRPC_OVERRIDE {
write_buf_.Reset(tag);
if (!ctx_->sent_initial_metadata_) {
write_buf_.AddSendInitialMetadata(&ctx_->initial_metadata_);
......@@ -644,7 +644,7 @@ class ServerAsyncWriter : public ServerAsyncStreamingInterface,
}
private:
void BindCall(Call* call) override { call_ = *call; }
void BindCall(Call* call) GRPC_OVERRIDE { call_ = *call; }
Call call_;
ServerContext* ctx_;
......@@ -655,14 +655,14 @@ class ServerAsyncWriter : public ServerAsyncStreamingInterface,
// Server-side interface for bi-directional streaming.
template <class W, class R>
class ServerAsyncReaderWriter : public ServerAsyncStreamingInterface,
public AsyncWriterInterface<W>,
public AsyncReaderInterface<R> {
class ServerAsyncReaderWriter GRPC_FINAL : public ServerAsyncStreamingInterface,
public AsyncWriterInterface<W>,
public AsyncReaderInterface<R> {
public:
explicit ServerAsyncReaderWriter(ServerContext* ctx)
: call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
void SendInitialMetadata(void* tag) override {
void SendInitialMetadata(void* tag) GRPC_OVERRIDE {
GPR_ASSERT(!ctx_->sent_initial_metadata_);
meta_buf_.Reset(tag);
......@@ -671,13 +671,13 @@ class ServerAsyncReaderWriter : public ServerAsyncStreamingInterface,
call_.PerformOps(&meta_buf_);
}
virtual void Read(R* msg, void* tag) override {
virtual void Read(R* msg, void* tag) GRPC_OVERRIDE {
read_buf_.Reset(tag);
read_buf_.AddRecvMessage(msg);
call_.PerformOps(&read_buf_);
}
virtual void Write(const W& msg, void* tag) override {
virtual void Write(const W& msg, void* tag) GRPC_OVERRIDE {
write_buf_.Reset(tag);
if (!ctx_->sent_initial_metadata_) {
write_buf_.AddSendInitialMetadata(&ctx_->initial_metadata_);
......@@ -698,7 +698,7 @@ class ServerAsyncReaderWriter : public ServerAsyncStreamingInterface,
}
private:
void BindCall(Call* call) override { call_ = *call; }
void BindCall(Call* call) GRPC_OVERRIDE { call_ = *call; }
Call call_;
ServerContext* ctx_;
......
......@@ -300,13 +300,13 @@ void PrintHeaderService(google::protobuf::io::Printer *printer,
(*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 @@ void PrintHeaderService(google::protobuf::io::Printer *printer,
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 @@ void PrintHeaderService(google::protobuf::io::Printer *printer,
// 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());
......
......@@ -216,7 +216,8 @@ bool GetModuleAndMessagePath(const Descriptor* type,
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;
}
......
......@@ -56,12 +56,10 @@ using std::strlen;
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");
......
......@@ -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 &parameter,
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
......
......@@ -49,17 +49,17 @@ class CompletionQueue;
class Credentials;
class StreamContextInterface;
class Channel final : public ChannelInterface {
class Channel GRPC_FINAL : public ChannelInterface {
public:
Channel(const grpc::string &target, const ChannelArguments &args);
Channel(const grpc::string &target, const std::unique_ptr<Credentials> &creds,
const ChannelArguments &args);
~Channel() override;
~Channel() GRPC_OVERRIDE;
virtual Call CreateCall(const RpcMethod &method, ClientContext *context,
CompletionQueue *cq) override;
virtual void PerformOpsOnCall(CallOpBuffer *ops, Call *call) override;
CompletionQueue *cq) GRPC_OVERRIDE;
virtual void PerformOpsOnCall(CallOpBuffer *ops, Call *call) GRPC_OVERRIDE;
private:
const grpc::string target_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment