Skip to content
Snippets Groups Projects
Commit c5ba0e56 authored by Craig Tiller's avatar Craig Tiller Committed by Jan Tattermusch
Browse files

Make it possible to compile with gcc4.6

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