diff --git a/BUILD b/BUILD
index d688ed2f82c..97ddc56b419 100644
--- a/BUILD
+++ b/BUILD
@@ -1402,12 +1402,6 @@ cc_library(
"include/grpc++/impl/server_builder_plugin.h",
"include/grpc++/impl/server_initializer.h",
"include/grpc++/impl/service_type.h",
- "include/grpc++/impl/sync.h",
- "include/grpc++/impl/sync_cxx11.h",
- "include/grpc++/impl/sync_no_cxx11.h",
- "include/grpc++/impl/thd.h",
- "include/grpc++/impl/thd_cxx11.h",
- "include/grpc++/impl/thd_no_cxx11.h",
"include/grpc++/resource_quota.h",
"include/grpc++/security/auth_context.h",
"include/grpc++/security/auth_metadata_processor.h",
@@ -1455,9 +1449,6 @@ cc_library(
"include/grpc++/impl/codegen/status_helper.h",
"include/grpc++/impl/codegen/string_ref.h",
"include/grpc++/impl/codegen/stub_options.h",
- "include/grpc++/impl/codegen/sync.h",
- "include/grpc++/impl/codegen/sync_cxx11.h",
- "include/grpc++/impl/codegen/sync_no_cxx11.h",
"include/grpc++/impl/codegen/sync_stream.h",
"include/grpc++/impl/codegen/time.h",
"include/grpc/impl/codegen/byte_buffer_reader.h",
@@ -1554,12 +1545,6 @@ cc_library(
"include/grpc++/impl/server_builder_plugin.h",
"include/grpc++/impl/server_initializer.h",
"include/grpc++/impl/service_type.h",
- "include/grpc++/impl/sync.h",
- "include/grpc++/impl/sync_cxx11.h",
- "include/grpc++/impl/sync_no_cxx11.h",
- "include/grpc++/impl/thd.h",
- "include/grpc++/impl/thd_cxx11.h",
- "include/grpc++/impl/thd_no_cxx11.h",
"include/grpc++/resource_quota.h",
"include/grpc++/security/auth_context.h",
"include/grpc++/security/auth_metadata_processor.h",
@@ -1607,9 +1592,6 @@ cc_library(
"include/grpc++/impl/codegen/status_helper.h",
"include/grpc++/impl/codegen/string_ref.h",
"include/grpc++/impl/codegen/stub_options.h",
- "include/grpc++/impl/codegen/sync.h",
- "include/grpc++/impl/codegen/sync_cxx11.h",
- "include/grpc++/impl/codegen/sync_no_cxx11.h",
"include/grpc++/impl/codegen/sync_stream.h",
"include/grpc++/impl/codegen/time.h",
"include/grpc/impl/codegen/byte_buffer_reader.h",
@@ -1727,12 +1709,6 @@ cc_library(
"include/grpc++/impl/server_builder_plugin.h",
"include/grpc++/impl/server_initializer.h",
"include/grpc++/impl/service_type.h",
- "include/grpc++/impl/sync.h",
- "include/grpc++/impl/sync_cxx11.h",
- "include/grpc++/impl/sync_no_cxx11.h",
- "include/grpc++/impl/thd.h",
- "include/grpc++/impl/thd_cxx11.h",
- "include/grpc++/impl/thd_no_cxx11.h",
"include/grpc++/resource_quota.h",
"include/grpc++/security/auth_context.h",
"include/grpc++/security/auth_metadata_processor.h",
@@ -1780,9 +1756,6 @@ cc_library(
"include/grpc++/impl/codegen/status_helper.h",
"include/grpc++/impl/codegen/string_ref.h",
"include/grpc++/impl/codegen/stub_options.h",
- "include/grpc++/impl/codegen/sync.h",
- "include/grpc++/impl/codegen/sync_cxx11.h",
- "include/grpc++/impl/codegen/sync_no_cxx11.h",
"include/grpc++/impl/codegen/sync_stream.h",
"include/grpc++/impl/codegen/time.h",
"include/grpc/impl/codegen/byte_buffer_reader.h",
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b97517185c2..4b073b0d684 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1121,12 +1121,6 @@ foreach(_hdr
include/grpc++/impl/server_builder_plugin.h
include/grpc++/impl/server_initializer.h
include/grpc++/impl/service_type.h
- include/grpc++/impl/sync.h
- include/grpc++/impl/sync_cxx11.h
- include/grpc++/impl/sync_no_cxx11.h
- include/grpc++/impl/thd.h
- include/grpc++/impl/thd_cxx11.h
- include/grpc++/impl/thd_no_cxx11.h
include/grpc++/resource_quota.h
include/grpc++/security/auth_context.h
include/grpc++/security/auth_metadata_processor.h
@@ -1174,9 +1168,6 @@ foreach(_hdr
include/grpc++/impl/codegen/status_helper.h
include/grpc++/impl/codegen/string_ref.h
include/grpc++/impl/codegen/stub_options.h
- include/grpc++/impl/codegen/sync.h
- include/grpc++/impl/codegen/sync_cxx11.h
- include/grpc++/impl/codegen/sync_no_cxx11.h
include/grpc++/impl/codegen/sync_stream.h
include/grpc++/impl/codegen/time.h
include/grpc/impl/codegen/byte_buffer_reader.h
@@ -1287,12 +1278,6 @@ foreach(_hdr
include/grpc++/impl/server_builder_plugin.h
include/grpc++/impl/server_initializer.h
include/grpc++/impl/service_type.h
- include/grpc++/impl/sync.h
- include/grpc++/impl/sync_cxx11.h
- include/grpc++/impl/sync_no_cxx11.h
- include/grpc++/impl/thd.h
- include/grpc++/impl/thd_cxx11.h
- include/grpc++/impl/thd_no_cxx11.h
include/grpc++/resource_quota.h
include/grpc++/security/auth_context.h
include/grpc++/security/auth_metadata_processor.h
@@ -1340,9 +1325,6 @@ foreach(_hdr
include/grpc++/impl/codegen/status_helper.h
include/grpc++/impl/codegen/string_ref.h
include/grpc++/impl/codegen/stub_options.h
- include/grpc++/impl/codegen/sync.h
- include/grpc++/impl/codegen/sync_cxx11.h
- include/grpc++/impl/codegen/sync_no_cxx11.h
include/grpc++/impl/codegen/sync_stream.h
include/grpc++/impl/codegen/time.h
include/grpc/impl/codegen/byte_buffer_reader.h
@@ -1491,12 +1473,6 @@ foreach(_hdr
include/grpc++/impl/server_builder_plugin.h
include/grpc++/impl/server_initializer.h
include/grpc++/impl/service_type.h
- include/grpc++/impl/sync.h
- include/grpc++/impl/sync_cxx11.h
- include/grpc++/impl/sync_no_cxx11.h
- include/grpc++/impl/thd.h
- include/grpc++/impl/thd_cxx11.h
- include/grpc++/impl/thd_no_cxx11.h
include/grpc++/resource_quota.h
include/grpc++/security/auth_context.h
include/grpc++/security/auth_metadata_processor.h
@@ -1544,9 +1520,6 @@ foreach(_hdr
include/grpc++/impl/codegen/status_helper.h
include/grpc++/impl/codegen/string_ref.h
include/grpc++/impl/codegen/stub_options.h
- include/grpc++/impl/codegen/sync.h
- include/grpc++/impl/codegen/sync_cxx11.h
- include/grpc++/impl/codegen/sync_no_cxx11.h
include/grpc++/impl/codegen/sync_stream.h
include/grpc++/impl/codegen/time.h
include/grpc/impl/codegen/byte_buffer_reader.h
diff --git a/Makefile b/Makefile
index c71c1b422f1..04f1f9be6a8 100644
--- a/Makefile
+++ b/Makefile
@@ -1078,6 +1078,7 @@ qps_openloop_test: $(BINDIR)/$(CONFIG)/qps_openloop_test
qps_worker: $(BINDIR)/$(CONFIG)/qps_worker
reconnect_interop_client: $(BINDIR)/$(CONFIG)/reconnect_interop_client
reconnect_interop_server: $(BINDIR)/$(CONFIG)/reconnect_interop_server
+round_robin_end2end_test: $(BINDIR)/$(CONFIG)/round_robin_end2end_test
secure_auth_context_test: $(BINDIR)/$(CONFIG)/secure_auth_context_test
secure_sync_unary_ping_pong_test: $(BINDIR)/$(CONFIG)/secure_sync_unary_ping_pong_test
server_builder_plugin_test: $(BINDIR)/$(CONFIG)/server_builder_plugin_test
@@ -1458,6 +1459,7 @@ buildtests_cxx: privatelibs_cxx \
$(BINDIR)/$(CONFIG)/qps_worker \
$(BINDIR)/$(CONFIG)/reconnect_interop_client \
$(BINDIR)/$(CONFIG)/reconnect_interop_server \
+ $(BINDIR)/$(CONFIG)/round_robin_end2end_test \
$(BINDIR)/$(CONFIG)/secure_auth_context_test \
$(BINDIR)/$(CONFIG)/secure_sync_unary_ping_pong_test \
$(BINDIR)/$(CONFIG)/server_builder_plugin_test \
@@ -1549,6 +1551,7 @@ buildtests_cxx: privatelibs_cxx \
$(BINDIR)/$(CONFIG)/qps_worker \
$(BINDIR)/$(CONFIG)/reconnect_interop_client \
$(BINDIR)/$(CONFIG)/reconnect_interop_server \
+ $(BINDIR)/$(CONFIG)/round_robin_end2end_test \
$(BINDIR)/$(CONFIG)/secure_auth_context_test \
$(BINDIR)/$(CONFIG)/secure_sync_unary_ping_pong_test \
$(BINDIR)/$(CONFIG)/server_builder_plugin_test \
@@ -1862,6 +1865,8 @@ test_cxx: buildtests_cxx
$(Q) $(BINDIR)/$(CONFIG)/proto_server_reflection_test || ( echo test proto_server_reflection_test failed ; exit 1 )
$(E) "[RUN] Testing qps_openloop_test"
$(Q) $(BINDIR)/$(CONFIG)/qps_openloop_test || ( echo test qps_openloop_test failed ; exit 1 )
+ $(E) "[RUN] Testing round_robin_end2end_test"
+ $(Q) $(BINDIR)/$(CONFIG)/round_robin_end2end_test || ( echo test round_robin_end2end_test failed ; exit 1 )
$(E) "[RUN] Testing secure_auth_context_test"
$(Q) $(BINDIR)/$(CONFIG)/secure_auth_context_test || ( echo test secure_auth_context_test failed ; exit 1 )
$(E) "[RUN] Testing secure_sync_unary_ping_pong_test"
@@ -3756,12 +3761,6 @@ PUBLIC_HEADERS_CXX += \
include/grpc++/impl/server_builder_plugin.h \
include/grpc++/impl/server_initializer.h \
include/grpc++/impl/service_type.h \
- include/grpc++/impl/sync.h \
- include/grpc++/impl/sync_cxx11.h \
- include/grpc++/impl/sync_no_cxx11.h \
- include/grpc++/impl/thd.h \
- include/grpc++/impl/thd_cxx11.h \
- include/grpc++/impl/thd_no_cxx11.h \
include/grpc++/resource_quota.h \
include/grpc++/security/auth_context.h \
include/grpc++/security/auth_metadata_processor.h \
@@ -3809,9 +3808,6 @@ PUBLIC_HEADERS_CXX += \
include/grpc++/impl/codegen/status_helper.h \
include/grpc++/impl/codegen/string_ref.h \
include/grpc++/impl/codegen/stub_options.h \
- include/grpc++/impl/codegen/sync.h \
- include/grpc++/impl/codegen/sync_cxx11.h \
- include/grpc++/impl/codegen/sync_no_cxx11.h \
include/grpc++/impl/codegen/sync_stream.h \
include/grpc++/impl/codegen/time.h \
include/grpc/impl/codegen/byte_buffer_reader.h \
@@ -3951,12 +3947,6 @@ PUBLIC_HEADERS_CXX += \
include/grpc++/impl/server_builder_plugin.h \
include/grpc++/impl/server_initializer.h \
include/grpc++/impl/service_type.h \
- include/grpc++/impl/sync.h \
- include/grpc++/impl/sync_cxx11.h \
- include/grpc++/impl/sync_no_cxx11.h \
- include/grpc++/impl/thd.h \
- include/grpc++/impl/thd_cxx11.h \
- include/grpc++/impl/thd_no_cxx11.h \
include/grpc++/resource_quota.h \
include/grpc++/security/auth_context.h \
include/grpc++/security/auth_metadata_processor.h \
@@ -4004,9 +3994,6 @@ PUBLIC_HEADERS_CXX += \
include/grpc++/impl/codegen/status_helper.h \
include/grpc++/impl/codegen/string_ref.h \
include/grpc++/impl/codegen/stub_options.h \
- include/grpc++/impl/codegen/sync.h \
- include/grpc++/impl/codegen/sync_cxx11.h \
- include/grpc++/impl/codegen/sync_no_cxx11.h \
include/grpc++/impl/codegen/sync_stream.h \
include/grpc++/impl/codegen/time.h \
include/grpc/impl/codegen/byte_buffer_reader.h \
@@ -4352,9 +4339,6 @@ PUBLIC_HEADERS_CXX += \
include/grpc++/impl/codegen/status_helper.h \
include/grpc++/impl/codegen/string_ref.h \
include/grpc++/impl/codegen/stub_options.h \
- include/grpc++/impl/codegen/sync.h \
- include/grpc++/impl/codegen/sync_cxx11.h \
- include/grpc++/impl/codegen/sync_no_cxx11.h \
include/grpc++/impl/codegen/sync_stream.h \
include/grpc++/impl/codegen/time.h \
include/grpc/impl/codegen/byte_buffer_reader.h \
@@ -4485,12 +4469,6 @@ PUBLIC_HEADERS_CXX += \
include/grpc++/impl/server_builder_plugin.h \
include/grpc++/impl/server_initializer.h \
include/grpc++/impl/service_type.h \
- include/grpc++/impl/sync.h \
- include/grpc++/impl/sync_cxx11.h \
- include/grpc++/impl/sync_no_cxx11.h \
- include/grpc++/impl/thd.h \
- include/grpc++/impl/thd_cxx11.h \
- include/grpc++/impl/thd_no_cxx11.h \
include/grpc++/resource_quota.h \
include/grpc++/security/auth_context.h \
include/grpc++/security/auth_metadata_processor.h \
@@ -4538,9 +4516,6 @@ PUBLIC_HEADERS_CXX += \
include/grpc++/impl/codegen/status_helper.h \
include/grpc++/impl/codegen/string_ref.h \
include/grpc++/impl/codegen/stub_options.h \
- include/grpc++/impl/codegen/sync.h \
- include/grpc++/impl/codegen/sync_cxx11.h \
- include/grpc++/impl/codegen/sync_no_cxx11.h \
include/grpc++/impl/codegen/sync_stream.h \
include/grpc++/impl/codegen/time.h \
include/grpc/impl/codegen/byte_buffer_reader.h \
@@ -13167,6 +13142,49 @@ endif
$(OBJDIR)/$(CONFIG)/test/cpp/interop/reconnect_interop_server.o: $(GENDIR)/src/proto/grpc/testing/empty.pb.cc $(GENDIR)/src/proto/grpc/testing/empty.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/test.pb.cc $(GENDIR)/src/proto/grpc/testing/test.grpc.pb.cc
+ROUND_ROBIN_END2END_TEST_SRC = \
+ test/cpp/end2end/round_robin_end2end_test.cc \
+
+ROUND_ROBIN_END2END_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(ROUND_ROBIN_END2END_TEST_SRC))))
+ifeq ($(NO_SECURE),true)
+
+# You can't build secure targets if you don't have OpenSSL.
+
+$(BINDIR)/$(CONFIG)/round_robin_end2end_test: openssl_dep_error
+
+else
+
+
+
+
+ifeq ($(NO_PROTOBUF),true)
+
+# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+.
+
+$(BINDIR)/$(CONFIG)/round_robin_end2end_test: protobuf_dep_error
+
+else
+
+$(BINDIR)/$(CONFIG)/round_robin_end2end_test: $(PROTOBUF_DEP) $(ROUND_ROBIN_END2END_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
+ $(E) "[LD] Linking $@"
+ $(Q) mkdir -p `dirname $@`
+ $(Q) $(LDXX) $(LDFLAGS) $(ROUND_ROBIN_END2END_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/round_robin_end2end_test
+
+endif
+
+endif
+
+$(OBJDIR)/$(CONFIG)/test/cpp/end2end/round_robin_end2end_test.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
+
+deps_round_robin_end2end_test: $(ROUND_ROBIN_END2END_TEST_OBJS:.o=.dep)
+
+ifneq ($(NO_SECURE),true)
+ifneq ($(NO_DEPS),true)
+-include $(ROUND_ROBIN_END2END_TEST_OBJS:.o=.dep)
+endif
+endif
+
+
SECURE_AUTH_CONTEXT_TEST_SRC = \
test/cpp/common/secure_auth_context_test.cc \
diff --git a/build.yaml b/build.yaml
index 5acfcc74fd8..f2269ed6d93 100644
--- a/build.yaml
+++ b/build.yaml
@@ -684,8 +684,6 @@ filegroups:
deps:
- gpr
secure: true
- uses:
- - grpc_base
- name: grpc++_base
language: c++
public_headers:
@@ -710,12 +708,6 @@ filegroups:
- include/grpc++/impl/server_builder_plugin.h
- include/grpc++/impl/server_initializer.h
- include/grpc++/impl/service_type.h
- - include/grpc++/impl/sync.h
- - include/grpc++/impl/sync_cxx11.h
- - include/grpc++/impl/sync_no_cxx11.h
- - include/grpc++/impl/thd.h
- - include/grpc++/impl/thd_cxx11.h
- - include/grpc++/impl/thd_no_cxx11.h
- include/grpc++/resource_quota.h
- include/grpc++/security/auth_context.h
- include/grpc++/security/auth_metadata_processor.h
@@ -802,9 +794,6 @@ filegroups:
- include/grpc++/impl/codegen/status_helper.h
- include/grpc++/impl/codegen/string_ref.h
- include/grpc++/impl/codegen/stub_options.h
- - include/grpc++/impl/codegen/sync.h
- - include/grpc++/impl/codegen/sync_cxx11.h
- - include/grpc++/impl/codegen/sync_no_cxx11.h
- include/grpc++/impl/codegen/sync_stream.h
- include/grpc++/impl/codegen/time.h
uses:
@@ -3355,6 +3344,19 @@ targets:
- gpr_test_util
- gpr
- grpc++_test_config
+- name: round_robin_end2end_test
+ gtest: true
+ build: test
+ language: c++
+ src:
+ - test/cpp/end2end/round_robin_end2end_test.cc
+ deps:
+ - grpc++_test_util
+ - grpc_test_util
+ - grpc++
+ - grpc
+ - gpr_test_util
+ - gpr
- name: secure_auth_context_test
gtest: true
build: test
diff --git a/doc/cpp-style-guide.md b/doc/cpp-style-guide.md
index 0138ceb7371..a1f91353fe9 100644
--- a/doc/cpp-style-guide.md
+++ b/doc/cpp-style-guide.md
@@ -1,91 +1,9 @@
GRPC C++ STYLE GUIDE
=====================
-Background
-----------
-
-Here we document style rules for C++ usage in the gRPC C++ bindings
-and tests.
-
-General
--------
-
-- The majority of gRPC's C++ requirements are drawn from the [Google C++ style
-guide] (https://google.github.io/styleguide/cppguide.html)
- - However, gRPC has some additional requirements to maintain
- [portability] (#portability)
-- As in C, layout rules are defined by clang-format, and all code
+The majority of gRPC's C++ requirements are drawn from the [Google C++ style
+guide] (https://google.github.io/styleguide/cppguide.html). Additionally,
+as in C, layout rules are defined by clang-format, and all code
should be passed through clang-format. A (docker-based) script to do
so is included in [tools/distrib/clang\_format\_code.sh]
(../tools/distrib/clang_format_code.sh).
-
-
-Portability Restrictions
--------------------
-
-gRPC supports a large number of compilers, ranging from those that are
-missing many key C++11 features to those that have quite detailed
-analysis. As a result, gRPC compiles with a high level of warnings and
-treat all warnings as errors. gRPC also forbids the use of some common
-C++11 constructs. Here are some guidelines, to be extended as needed:
-- Do not use range-based for. Expressions of the form
- ```c
- for (auto& i: vec) {
- // code
- }
- ```
-
- are not allowed and should be replaced with code such as
- ```c
- for (auto it = vec.begin; it != vec.end(); it++) {
- auto& i = *it;
- // code
- }
- ```
-
-- Do not use lambda of any kind (no capture, explicit capture, or
-default capture). Other C++ functional features such as
-`std::function` or `std::bind` are allowed
-- Do not use brace-list initializers.
-- Do not compare a pointer to `nullptr` . This is because gcc 4.4
- does not support `nullptr` directly and gRPC implements a subset of
- its features in [include/grpc++/impl/codegen/config.h]
- (../include/grpc++/impl/codegen/config.h). Instead, pointers should
- be checked for validity using their implicit conversion to `bool`.
- In other words, use `if (p)` rather than `if (p != nullptr)`
-- Do not initialize global/static pointer variables to `nullptr`. Just let
- the compiler implicitly initialize them to `nullptr` (which it will
- definitely do). The reason is that `nullptr` is an actual object in
- our implementation rather than just a constant pointer value, so
- static/global constructors will be called in a potentially
- undesirable sequence.
-- Do not use `final` or `override` as these are not supported by some
- compilers. Instead use `GRPC_FINAL` and `GRPC_OVERRIDE` . These
- compile down to the traditional C++ forms for compilers that support
- them but are just elided if the compiler does not support those features.
-- In the [include] (../../../tree/master/include/grpc++) and [src]
- (../../../tree/master/src/cpp) directory trees, you should also not
- use certain STL objects like `std::mutex`, `std::lock_guard`,
- `std::unique_lock`, `std::nullptr`, `std::thread` . Instead, use
- `grpc::mutex`, `grpc::lock_guard`, etc., which are gRPC
- implementations of the prominent features of these objects that are
- not always available. You can use the `std` versions of those in [test]
- (../../../tree/master/test/cpp)
-- Similarly, in the same directories, do not use `std::chrono` unless
- it is guarded by `#ifndef GRPC_CXX0X_NO_CHRONO` . For platforms that
- lack`std::chrono,` there is a C-language timer called gpr_timespec that can
- be used instead.
-- `std::unique_ptr` must be used with extreme care in any kind of
- collection. For example `vector` does not work in
- gcc 4.4 if the vector is constructed to its full size at
- initialization but does work if elements are added to the vector
- using functions like `push_back`. `map` and other pair-based
- collections do not work with `unique_ptr` under gcc 4.4. The issue
- is that many of these collection implementations assume a copy
- constructor
- to be available.
-- Don't use `std::this_thread` . Use `gpr_sleep_until` for sleeping a thread.
-- [Some adjacent character combinations cause problems]
- (https://en.wikipedia.org/wiki/Digraphs_and_trigraphs#C). If declaring a
- template against some class relative to the global namespace,
- `<::name` will be non-portable. Separate the `<` from the `:` and use `< ::name`.
diff --git a/include/grpc++/alarm.h b/include/grpc++/alarm.h
index 1470fe8d97b..9a15167cc73 100644
--- a/include/grpc++/alarm.h
+++ b/include/grpc++/alarm.h
@@ -78,7 +78,7 @@ class Alarm : private GrpcLibraryCodegen {
class AlarmEntry : public CompletionQueueTag {
public:
AlarmEntry(void* tag) : tag_(tag) {}
- bool FinalizeResult(void** tag, bool* status) GRPC_OVERRIDE {
+ bool FinalizeResult(void** tag, bool* status) override {
*tag = tag_;
return true;
}
diff --git a/include/grpc++/channel.h b/include/grpc++/channel.h
index c535d57bffb..c8360282e7b 100644
--- a/include/grpc++/channel.h
+++ b/include/grpc++/channel.h
@@ -46,16 +46,16 @@ struct grpc_channel;
namespace grpc {
/// Channels represent a connection to an endpoint. Created by \a CreateChannel.
-class Channel GRPC_FINAL : public ChannelInterface,
- public CallHook,
- public std::enable_shared_from_this,
- private GrpcLibraryCodegen {
+class Channel final : public ChannelInterface,
+ public CallHook,
+ public std::enable_shared_from_this,
+ private GrpcLibraryCodegen {
public:
~Channel();
/// Get the current channel state. If the channel is in IDLE and
/// \a try_to_connect is set to true, try to connect.
- grpc_connectivity_state GetState(bool try_to_connect) GRPC_OVERRIDE;
+ grpc_connectivity_state GetState(bool try_to_connect) override;
private:
template
@@ -69,15 +69,15 @@ class Channel GRPC_FINAL : public ChannelInterface,
Channel(const grpc::string& host, grpc_channel* c_channel);
Call CreateCall(const RpcMethod& method, ClientContext* context,
- CompletionQueue* cq) GRPC_OVERRIDE;
- void PerformOpsOnCall(CallOpSetInterface* ops, Call* call) GRPC_OVERRIDE;
- void* RegisterMethod(const char* method) GRPC_OVERRIDE;
+ CompletionQueue* cq) override;
+ void PerformOpsOnCall(CallOpSetInterface* ops, Call* call) override;
+ void* RegisterMethod(const char* method) override;
void NotifyOnStateChangeImpl(grpc_connectivity_state last_observed,
gpr_timespec deadline, CompletionQueue* cq,
- void* tag) GRPC_OVERRIDE;
+ void* tag) override;
bool WaitForStateChangeImpl(grpc_connectivity_state last_observed,
- gpr_timespec deadline) GRPC_OVERRIDE;
+ gpr_timespec deadline) override;
const grpc::string host_;
grpc_channel* const c_channel_; // owned
diff --git a/include/grpc++/ext/proto_server_reflection_plugin.h b/include/grpc++/ext/proto_server_reflection_plugin.h
index 3e54882d41f..66f39eb8760 100644
--- a/include/grpc++/ext/proto_server_reflection_plugin.h
+++ b/include/grpc++/ext/proto_server_reflection_plugin.h
@@ -48,12 +48,12 @@ namespace reflection {
class ProtoServerReflectionPlugin : public ::grpc::ServerBuilderPlugin {
public:
ProtoServerReflectionPlugin();
- ::grpc::string name() GRPC_OVERRIDE;
- void InitServer(::grpc::ServerInitializer* si) GRPC_OVERRIDE;
- void Finish(::grpc::ServerInitializer* si) GRPC_OVERRIDE;
- void ChangeArguments(const ::grpc::string& name, void* value) GRPC_OVERRIDE;
- bool has_async_methods() const GRPC_OVERRIDE;
- bool has_sync_methods() const GRPC_OVERRIDE;
+ ::grpc::string name() override;
+ void InitServer(::grpc::ServerInitializer* si) override;
+ void Finish(::grpc::ServerInitializer* si) override;
+ void ChangeArguments(const ::grpc::string& name, void* value) override;
+ bool has_async_methods() const override;
+ bool has_sync_methods() const override;
private:
std::shared_ptr reflection_service_;
diff --git a/include/grpc++/generic/async_generic_service.h b/include/grpc++/generic/async_generic_service.h
index 24bae521452..66a5d01d96d 100644
--- a/include/grpc++/generic/async_generic_service.h
+++ b/include/grpc++/generic/async_generic_service.h
@@ -44,7 +44,7 @@ namespace grpc {
typedef ServerAsyncReaderWriter
GenericServerAsyncReaderWriter;
-class GenericServerContext GRPC_FINAL : public ServerContext {
+class GenericServerContext final : public ServerContext {
public:
const grpc::string& method() const { return method_; }
const grpc::string& host() const { return host_; }
@@ -57,7 +57,7 @@ class GenericServerContext GRPC_FINAL : public ServerContext {
grpc::string host_;
};
-class AsyncGenericService GRPC_FINAL {
+class AsyncGenericService final {
public:
AsyncGenericService() : server_(nullptr) {}
diff --git a/include/grpc++/generic/generic_stub.h b/include/grpc++/generic/generic_stub.h
index d27deae33a5..02c00d0d45c 100644
--- a/include/grpc++/generic/generic_stub.h
+++ b/include/grpc++/generic/generic_stub.h
@@ -45,7 +45,7 @@ typedef ClientAsyncReaderWriter
// Generic stubs provide a type-unsafe interface to call gRPC methods
// by name.
-class GenericStub GRPC_FINAL {
+class GenericStub final {
public:
explicit GenericStub(std::shared_ptr channel)
: channel_(channel) {}
diff --git a/include/grpc++/impl/codegen/async_stream.h b/include/grpc++/impl/codegen/async_stream.h
index 70533aa4d9f..1a5cbbd45da 100644
--- a/include/grpc++/impl/codegen/async_stream.h
+++ b/include/grpc++/impl/codegen/async_stream.h
@@ -108,7 +108,7 @@ class ClientAsyncReaderInterface : public ClientAsyncStreamingInterface,
public AsyncReaderInterface {};
template
-class ClientAsyncReader GRPC_FINAL : public ClientAsyncReaderInterface {
+class ClientAsyncReader final : public ClientAsyncReaderInterface {
public:
/// Create a stream and write the first request out.
template
@@ -125,7 +125,7 @@ class ClientAsyncReader GRPC_FINAL : public ClientAsyncReaderInterface {
call_.PerformOps(&init_ops_);
}
- void ReadInitialMetadata(void* tag) GRPC_OVERRIDE {
+ void ReadInitialMetadata(void* tag) override {
GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
meta_ops_.set_output_tag(tag);
@@ -133,7 +133,7 @@ class ClientAsyncReader GRPC_FINAL : public ClientAsyncReaderInterface {
call_.PerformOps(&meta_ops_);
}
- void Read(R* msg, void* tag) GRPC_OVERRIDE {
+ void Read(R* msg, void* tag) override {
read_ops_.set_output_tag(tag);
if (!context_->initial_metadata_received_) {
read_ops_.RecvInitialMetadata(context_);
@@ -142,7 +142,7 @@ class ClientAsyncReader GRPC_FINAL : public ClientAsyncReaderInterface {
call_.PerformOps(&read_ops_);
}
- void Finish(Status* status, void* tag) GRPC_OVERRIDE {
+ void Finish(Status* status, void* tag) override {
finish_ops_.set_output_tag(tag);
if (!context_->initial_metadata_received_) {
finish_ops_.RecvInitialMetadata(context_);
@@ -174,7 +174,7 @@ class ClientAsyncWriterInterface : public ClientAsyncStreamingInterface,
};
template
-class ClientAsyncWriter GRPC_FINAL : public ClientAsyncWriterInterface {
+class ClientAsyncWriter final : public ClientAsyncWriterInterface {
public:
template
ClientAsyncWriter(ChannelInterface* channel, CompletionQueue* cq,
@@ -190,7 +190,7 @@ class ClientAsyncWriter GRPC_FINAL : public ClientAsyncWriterInterface {
call_.PerformOps(&init_ops_);
}
- void ReadInitialMetadata(void* tag) GRPC_OVERRIDE {
+ void ReadInitialMetadata(void* tag) override {
GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
meta_ops_.set_output_tag(tag);
@@ -198,20 +198,20 @@ class ClientAsyncWriter GRPC_FINAL : public ClientAsyncWriterInterface {
call_.PerformOps(&meta_ops_);
}
- void Write(const W& msg, void* tag) GRPC_OVERRIDE {
+ void Write(const W& msg, void* tag) override {
write_ops_.set_output_tag(tag);
// TODO(ctiller): don't assert
GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg).ok());
call_.PerformOps(&write_ops_);
}
- void WritesDone(void* tag) GRPC_OVERRIDE {
+ void WritesDone(void* tag) override {
writes_done_ops_.set_output_tag(tag);
writes_done_ops_.ClientSendClose();
call_.PerformOps(&writes_done_ops_);
}
- void Finish(Status* status, void* tag) GRPC_OVERRIDE {
+ void Finish(Status* status, void* tag) override {
finish_ops_.set_output_tag(tag);
if (!context_->initial_metadata_received_) {
finish_ops_.RecvInitialMetadata(context_);
@@ -246,7 +246,7 @@ class ClientAsyncReaderWriterInterface : public ClientAsyncStreamingInterface,
};
template
-class ClientAsyncReaderWriter GRPC_FINAL
+class ClientAsyncReaderWriter final
: public ClientAsyncReaderWriterInterface {
public:
ClientAsyncReaderWriter(ChannelInterface* channel, CompletionQueue* cq,
@@ -259,7 +259,7 @@ class ClientAsyncReaderWriter GRPC_FINAL
call_.PerformOps(&init_ops_);
}
- void ReadInitialMetadata(void* tag) GRPC_OVERRIDE {
+ void ReadInitialMetadata(void* tag) override {
GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
meta_ops_.set_output_tag(tag);
@@ -267,7 +267,7 @@ class ClientAsyncReaderWriter GRPC_FINAL
call_.PerformOps(&meta_ops_);
}
- void Read(R* msg, void* tag) GRPC_OVERRIDE {
+ void Read(R* msg, void* tag) override {
read_ops_.set_output_tag(tag);
if (!context_->initial_metadata_received_) {
read_ops_.RecvInitialMetadata(context_);
@@ -276,20 +276,20 @@ class ClientAsyncReaderWriter GRPC_FINAL
call_.PerformOps(&read_ops_);
}
- void Write(const W& msg, void* tag) GRPC_OVERRIDE {
+ void Write(const W& msg, void* tag) override {
write_ops_.set_output_tag(tag);
// TODO(ctiller): don't assert
GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg).ok());
call_.PerformOps(&write_ops_);
}
- void WritesDone(void* tag) GRPC_OVERRIDE {
+ void WritesDone(void* tag) override {
writes_done_ops_.set_output_tag(tag);
writes_done_ops_.ClientSendClose();
call_.PerformOps(&writes_done_ops_);
}
- void Finish(Status* status, void* tag) GRPC_OVERRIDE {
+ void Finish(Status* status, void* tag) override {
finish_ops_.set_output_tag(tag);
if (!context_->initial_metadata_received_) {
finish_ops_.RecvInitialMetadata(context_);
@@ -319,12 +319,12 @@ class ServerAsyncReaderInterface : public ServerAsyncStreamingInterface,
};
template
-class ServerAsyncReader GRPC_FINAL : public ServerAsyncReaderInterface {
+class ServerAsyncReader final : public ServerAsyncReaderInterface {
public:
explicit ServerAsyncReader(ServerContext* ctx)
: call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
- void SendInitialMetadata(void* tag) GRPC_OVERRIDE {
+ void SendInitialMetadata(void* tag) override {
GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
meta_ops_.set_output_tag(tag);
@@ -337,13 +337,13 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncReaderInterface {
call_.PerformOps(&meta_ops_);
}
- void Read(R* msg, void* tag) GRPC_OVERRIDE {
+ void Read(R* msg, void* tag) override {
read_ops_.set_output_tag(tag);
read_ops_.RecvMessage(msg);
call_.PerformOps(&read_ops_);
}
- void Finish(const W& msg, const Status& status, void* tag) GRPC_OVERRIDE {
+ void Finish(const W& msg, const Status& status, void* tag) override {
finish_ops_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) {
finish_ops_.SendInitialMetadata(ctx_->initial_metadata_,
@@ -363,7 +363,7 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncReaderInterface {
call_.PerformOps(&finish_ops_);
}
- void FinishWithError(const Status& status, void* tag) GRPC_OVERRIDE {
+ void FinishWithError(const Status& status, void* tag) override {
GPR_CODEGEN_ASSERT(!status.ok());
finish_ops_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) {
@@ -379,7 +379,7 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncReaderInterface {
}
private:
- void BindCall(Call* call) GRPC_OVERRIDE { call_ = *call; }
+ void BindCall(Call* call) override { call_ = *call; }
Call call_;
ServerContext* ctx_;
@@ -398,12 +398,12 @@ class ServerAsyncWriterInterface : public ServerAsyncStreamingInterface,
};
template
-class ServerAsyncWriter GRPC_FINAL : public ServerAsyncWriterInterface {
+class ServerAsyncWriter final : public ServerAsyncWriterInterface {
public:
explicit ServerAsyncWriter(ServerContext* ctx)
: call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
- void SendInitialMetadata(void* tag) GRPC_OVERRIDE {
+ void SendInitialMetadata(void* tag) override {
GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
meta_ops_.set_output_tag(tag);
@@ -416,7 +416,7 @@ class ServerAsyncWriter GRPC_FINAL : public ServerAsyncWriterInterface {
call_.PerformOps(&meta_ops_);
}
- void Write(const W& msg, void* tag) GRPC_OVERRIDE {
+ void Write(const W& msg, void* tag) override {
write_ops_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) {
write_ops_.SendInitialMetadata(ctx_->initial_metadata_,
@@ -431,7 +431,7 @@ class ServerAsyncWriter GRPC_FINAL : public ServerAsyncWriterInterface {
call_.PerformOps(&write_ops_);
}
- void Finish(const Status& status, void* tag) GRPC_OVERRIDE {
+ void Finish(const Status& status, void* tag) override {
finish_ops_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) {
finish_ops_.SendInitialMetadata(ctx_->initial_metadata_,
@@ -446,7 +446,7 @@ class ServerAsyncWriter GRPC_FINAL : public ServerAsyncWriterInterface {
}
private:
- void BindCall(Call* call) GRPC_OVERRIDE { call_ = *call; }
+ void BindCall(Call* call) override { call_ = *call; }
Call call_;
ServerContext* ctx_;
@@ -465,13 +465,13 @@ class ServerAsyncReaderWriterInterface : public ServerAsyncStreamingInterface,
};
template
-class ServerAsyncReaderWriter GRPC_FINAL
+class ServerAsyncReaderWriter final
: public ServerAsyncReaderWriterInterface {
public:
explicit ServerAsyncReaderWriter(ServerContext* ctx)
: call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
- void SendInitialMetadata(void* tag) GRPC_OVERRIDE {
+ void SendInitialMetadata(void* tag) override {
GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
meta_ops_.set_output_tag(tag);
@@ -484,13 +484,13 @@ class ServerAsyncReaderWriter GRPC_FINAL
call_.PerformOps(&meta_ops_);
}
- void Read(R* msg, void* tag) GRPC_OVERRIDE {
+ void Read(R* msg, void* tag) override {
read_ops_.set_output_tag(tag);
read_ops_.RecvMessage(msg);
call_.PerformOps(&read_ops_);
}
- void Write(const W& msg, void* tag) GRPC_OVERRIDE {
+ void Write(const W& msg, void* tag) override {
write_ops_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) {
write_ops_.SendInitialMetadata(ctx_->initial_metadata_,
@@ -505,7 +505,7 @@ class ServerAsyncReaderWriter GRPC_FINAL
call_.PerformOps(&write_ops_);
}
- void Finish(const Status& status, void* tag) GRPC_OVERRIDE {
+ void Finish(const Status& status, void* tag) override {
finish_ops_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) {
finish_ops_.SendInitialMetadata(ctx_->initial_metadata_,
@@ -522,7 +522,7 @@ class ServerAsyncReaderWriter GRPC_FINAL
private:
friend class ::grpc::Server;
- void BindCall(Call* call) GRPC_OVERRIDE { call_ = *call; }
+ void BindCall(Call* call) override { call_ = *call; }
Call call_;
ServerContext* ctx_;
diff --git a/include/grpc++/impl/codegen/async_unary_call.h b/include/grpc++/impl/codegen/async_unary_call.h
index 87c94d6507e..b77a16b699f 100644
--- a/include/grpc++/impl/codegen/async_unary_call.h
+++ b/include/grpc++/impl/codegen/async_unary_call.h
@@ -55,7 +55,7 @@ class ClientAsyncResponseReaderInterface {
};
template
-class ClientAsyncResponseReader GRPC_FINAL
+class ClientAsyncResponseReader final
: public ClientAsyncResponseReaderInterface {
public:
template
@@ -113,13 +113,12 @@ class ClientAsyncResponseReader GRPC_FINAL
};
template
-class ServerAsyncResponseWriter GRPC_FINAL
- : public ServerAsyncStreamingInterface {
+class ServerAsyncResponseWriter final : public ServerAsyncStreamingInterface {
public:
explicit ServerAsyncResponseWriter(ServerContext* ctx)
: call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
- void SendInitialMetadata(void* tag) GRPC_OVERRIDE {
+ void SendInitialMetadata(void* tag) override {
GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
meta_buf_.set_output_tag(tag);
@@ -168,7 +167,7 @@ class ServerAsyncResponseWriter GRPC_FINAL
}
private:
- void BindCall(Call* call) GRPC_OVERRIDE { call_ = *call; }
+ void BindCall(Call* call) override { call_ = *call; }
Call call_;
ServerContext* ctx_;
diff --git a/include/grpc++/impl/codegen/call.h b/include/grpc++/impl/codegen/call.h
index e211373e7d4..6ab00612f6e 100644
--- a/include/grpc++/impl/codegen/call.h
+++ b/include/grpc++/impl/codegen/call.h
@@ -337,16 +337,16 @@ class DeserializeFunc {
};
template
-class DeserializeFuncType GRPC_FINAL : public DeserializeFunc {
+class DeserializeFuncType final : public DeserializeFunc {
public:
DeserializeFuncType(R* message) : message_(message) {}
Status Deserialize(grpc_byte_buffer* buf,
- int max_receive_message_size) GRPC_OVERRIDE {
+ int max_receive_message_size) override {
return SerializationTraits::Deserialize(buf, message_,
max_receive_message_size);
}
- ~DeserializeFuncType() GRPC_OVERRIDE {}
+ ~DeserializeFuncType() override {}
private:
R* message_; // Not a managed pointer because management is external to this
@@ -603,7 +603,7 @@ class CallOpSet : public CallOpSetInterface,
public Op6 {
public:
CallOpSet() : return_tag_(this) {}
- void FillOps(grpc_op* ops, size_t* nops) GRPC_OVERRIDE {
+ void FillOps(grpc_op* ops, size_t* nops) override {
this->Op1::AddOp(ops, nops);
this->Op2::AddOp(ops, nops);
this->Op3::AddOp(ops, nops);
@@ -612,7 +612,7 @@ class CallOpSet : public CallOpSetInterface,
this->Op6::AddOp(ops, nops);
}
- bool FinalizeResult(void** tag, bool* status) GRPC_OVERRIDE {
+ bool FinalizeResult(void** tag, bool* status) override {
this->Op1::FinishOp(status, max_receive_message_size_);
this->Op2::FinishOp(status, max_receive_message_size_);
this->Op3::FinishOp(status, max_receive_message_size_);
@@ -639,14 +639,14 @@ template , class Op2 = CallNoOp<2>,
class Op5 = CallNoOp<5>, class Op6 = CallNoOp<6>>
class SneakyCallOpSet : public CallOpSet {
public:
- bool FinalizeResult(void** tag, bool* status) GRPC_OVERRIDE {
+ bool FinalizeResult(void** tag, bool* status) override {
typedef CallOpSet Base;
return Base::FinalizeResult(tag, status) && false;
}
};
// Straightforward wrapping of the C call object
-class Call GRPC_FINAL {
+class Call final {
public:
/* call is owned by the caller */
Call(grpc_call* call, CallHook* call_hook, CompletionQueue* cq)
diff --git a/include/grpc++/impl/codegen/client_context.h b/include/grpc++/impl/codegen/client_context.h
index a330ed06bbe..777b2f8847f 100644
--- a/include/grpc++/impl/codegen/client_context.h
+++ b/include/grpc++/impl/codegen/client_context.h
@@ -51,6 +51,7 @@
#include