From b928de86c769ab9f368d65001ad6ca30dd50844d Mon Sep 17 00:00:00 2001 From: Masood Malekghassemi Date: Fri, 28 Oct 2016 15:05:33 -0700 Subject: [PATCH 01/20] Set the long_description setup.py field Somehow ad hoc descriptions don't work anymore for grpcio (probably because the README.rst isn't at the distribution root for grpcio). --- setup.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.py b/setup.py index cdd3bb3f0dd..559a75f6742 100644 --- a/setup.py +++ b/setup.py @@ -52,6 +52,7 @@ PYTHON_STEM = os.path.join('src', 'python', 'grpcio') CORE_INCLUDE = ('include', '.',) BORINGSSL_INCLUDE = (os.path.join('third_party', 'boringssl', 'include'),) ZLIB_INCLUDE = (os.path.join('third_party', 'zlib'),) +README = os.path.join(PYTHON_STEM, 'README.rst') # Ensure we're in the proper directory whether or not we're being used by pip. os.chdir(os.path.dirname(os.path.abspath(__file__))) @@ -259,6 +260,7 @@ setuptools.setup( name='grpcio', version=grpc_version.VERSION, license=LICENSE, + long_description=open(README).read(), ext_modules=CYTHON_EXTENSION_MODULES, packages=list(PACKAGES), package_dir=PACKAGE_DIRECTORIES, From 69259d425111696dd2df5a243e8b714db3dc3dac Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Mon, 31 Oct 2016 14:34:10 -0700 Subject: [PATCH 02/20] Add resource quota support to uv TCP code --- src/core/lib/iomgr/endpoint_pair_uv.c | 5 +- src/core/lib/iomgr/resource_quota.c | 7 ++ src/core/lib/iomgr/resource_quota.h | 5 + src/core/lib/iomgr/tcp_client_uv.c | 36 +++++-- src/core/lib/iomgr/tcp_server_uv.c | 24 ++++- src/core/lib/iomgr/tcp_uv.c | 133 +++++++++++++++++--------- src/core/lib/iomgr/tcp_uv.h | 4 +- 7 files changed, 154 insertions(+), 60 deletions(-) diff --git a/src/core/lib/iomgr/endpoint_pair_uv.c b/src/core/lib/iomgr/endpoint_pair_uv.c index 7941e203886..ff24894c6db 100644 --- a/src/core/lib/iomgr/endpoint_pair_uv.c +++ b/src/core/lib/iomgr/endpoint_pair_uv.c @@ -41,8 +41,9 @@ #include "src/core/lib/iomgr/endpoint_pair.h" -grpc_endpoint_pair grpc_iomgr_create_endpoint_pair(const char *name, - size_t read_slice_size) { +grpc_endpoint_pair grpc_iomgr_create_endpoint_pair( + const char *name, grpc_resource_quota *resource_quota, + size_t read_slice_size) { grpc_endpoint_pair endpoint_pair; // TODO(mlumish): implement this properly under libuv GPR_ASSERT(false && diff --git a/src/core/lib/iomgr/resource_quota.c b/src/core/lib/iomgr/resource_quota.c index bfc905845d6..40c847a1b36 100644 --- a/src/core/lib/iomgr/resource_quota.c +++ b/src/core/lib/iomgr/resource_quota.c @@ -712,3 +712,10 @@ void grpc_resource_user_alloc_slices( grpc_resource_user_alloc(exec_ctx, slice_allocator->resource_user, count * length, &slice_allocator->on_allocated); } + +gpr_slice grpc_resource_user_slice_malloc(grpc_exec_ctx *exec_ctx, + grpc_resource_user *resource_user, + size_t size) { + grpc_resource_user_alloc(exec_ctx, resource_user, size, NULL); + return ru_slice_create(resource_user, size); +} diff --git a/src/core/lib/iomgr/resource_quota.h b/src/core/lib/iomgr/resource_quota.h index 6dfac55f88c..da68f21a2c7 100644 --- a/src/core/lib/iomgr/resource_quota.h +++ b/src/core/lib/iomgr/resource_quota.h @@ -221,4 +221,9 @@ void grpc_resource_user_alloc_slices( grpc_resource_user_slice_allocator *slice_allocator, size_t length, size_t count, gpr_slice_buffer *dest); +/* Allocate one slice of length \a size synchronously. */ +gpr_slice grpc_resource_user_slice_malloc(grpc_exec_ctx *exec_ctx, + grpc_resource_user *resource_user, + size_t size); + #endif /* GRPC_CORE_LIB_IOMGR_RESOURCE_QUOTA_H */ diff --git a/src/core/lib/iomgr/tcp_client_uv.c b/src/core/lib/iomgr/tcp_client_uv.c index 62746670420..b07f9ceffa3 100644 --- a/src/core/lib/iomgr/tcp_client_uv.c +++ b/src/core/lib/iomgr/tcp_client_uv.c @@ -54,9 +54,12 @@ typedef struct grpc_uv_tcp_connect { grpc_endpoint **endpoint; int refs; char *addr_name; + grpc_resource_quota *resource_quota; } grpc_uv_tcp_connect; -static void uv_tcp_connect_cleanup(grpc_uv_tcp_connect *connect) { +static void uv_tcp_connect_cleanup(grpc_exec_ctx *exec_ctx, + grpc_uv_tcp_connect *connect) { + grpc_resource_quota_internal_unref(exec_ctx, connect->resource_quota); gpr_free(connect); } @@ -74,7 +77,7 @@ static void uv_tc_on_alarm(grpc_exec_ctx *exec_ctx, void *acp, } done = (--connect->refs == 0); if (done) { - uv_tcp_connect_cleanup(connect); + uv_tcp_connect_cleanup(exec_ctx, connect); } } @@ -86,8 +89,8 @@ static void uv_tc_on_connect(uv_connect_t *req, int status) { grpc_closure *closure = connect->closure; grpc_timer_cancel(&exec_ctx, &connect->alarm); if (status == 0) { - *connect->endpoint = - grpc_tcp_create(connect->tcp_handle, connect->addr_name); + *connect->endpoint = grpc_tcp_create( + connect->tcp_handle, connect->resource_quota, connect->addr_name); } else { error = GRPC_ERROR_CREATE("Failed to connect to remote host"); error = grpc_error_set_int(error, GRPC_ERROR_INT_ERRNO, -status); @@ -105,7 +108,7 @@ static void uv_tc_on_connect(uv_connect_t *req, int status) { } done = (--connect->refs == 0); if (done) { - uv_tcp_connect_cleanup(connect); + uv_tcp_connect_cleanup(&exec_ctx, connect); } grpc_exec_ctx_sched(&exec_ctx, closure, error, NULL); grpc_exec_ctx_finish(&exec_ctx); @@ -114,16 +117,31 @@ static void uv_tc_on_connect(uv_connect_t *req, int status) { static void tcp_client_connect_impl(grpc_exec_ctx *exec_ctx, grpc_closure *closure, grpc_endpoint **ep, grpc_pollset_set *interested_parties, + const grpc_channel_args *channel_args, const grpc_resolved_address *resolved_addr, gpr_timespec deadline) { grpc_uv_tcp_connect *connect; + grpc_resource_quota *resource_quota = grpc_resource_quota_create(NULL); + (void)channel_args; (void)interested_parties; + + if (channel_args != NULL) { + for (size_t i = 0; i < channel_args->num_args; i++) { + if (0 == strcmp(channel_args->args[i].key, GRPC_ARG_RESOURCE_QUOTA)) { + grpc_resource_quota_internal_unref(exec_ctx, resource_quota); + resource_quota = grpc_resource_quota_internal_ref( + channel_args->args[i].value.pointer.p); + } + } + } + connect = gpr_malloc(sizeof(grpc_uv_tcp_connect)); memset(connect, 0, sizeof(grpc_uv_tcp_connect)); connect->closure = closure; connect->endpoint = ep; connect->tcp_handle = gpr_malloc(sizeof(uv_tcp_t)); connect->addr_name = grpc_sockaddr_to_uri(resolved_addr); + connect->resource_quota = resource_quota; uv_tcp_init(uv_default_loop(), connect->tcp_handle); connect->connect_req.data = connect; // TODO(murgatroid99): figure out what the return value here means @@ -138,16 +156,18 @@ static void tcp_client_connect_impl(grpc_exec_ctx *exec_ctx, // overridden by api_fuzzer.c void (*grpc_tcp_client_connect_impl)( grpc_exec_ctx *exec_ctx, grpc_closure *closure, grpc_endpoint **ep, - grpc_pollset_set *interested_parties, const grpc_resolved_address *addr, + grpc_pollset_set *interested_parties, const grpc_channel_args *channel_args, + const grpc_resolved_address *addr, gpr_timespec deadline) = tcp_client_connect_impl; void grpc_tcp_client_connect(grpc_exec_ctx *exec_ctx, grpc_closure *closure, grpc_endpoint **ep, grpc_pollset_set *interested_parties, + const grpc_channel_args *channel_args, const grpc_resolved_address *addr, gpr_timespec deadline) { - grpc_tcp_client_connect_impl(exec_ctx, closure, ep, interested_parties, addr, - deadline); + grpc_tcp_client_connect_impl(exec_ctx, closure, ep, interested_parties, + channel_args, addr, deadline); } #endif /* GRPC_UV */ diff --git a/src/core/lib/iomgr/tcp_server_uv.c b/src/core/lib/iomgr/tcp_server_uv.c index 73e4db3d650..b5b9b92a20a 100644 --- a/src/core/lib/iomgr/tcp_server_uv.c +++ b/src/core/lib/iomgr/tcp_server_uv.c @@ -76,13 +76,30 @@ struct grpc_tcp_server { /* shutdown callback */ grpc_closure *shutdown_complete; + + grpc_resource_quota *resource_quota; }; -grpc_error *grpc_tcp_server_create(grpc_closure *shutdown_complete, +grpc_error *grpc_tcp_server_create(grpc_exec_ctx *exec_ctx, + grpc_closure *shutdown_complete, const grpc_channel_args *args, grpc_tcp_server **server) { grpc_tcp_server *s = gpr_malloc(sizeof(grpc_tcp_server)); - (void)args; + s->resource_quota = grpc_resource_quota_create(NULL); + for (size_t i = 0; i < (args == NULL ? 0 : args->num_args); i++) { + if (0 == strcmp(GRPC_ARG_RESOURCE_QUOTA, args->args[i].key)) { + if (args->args[i].type == GRPC_ARG_POINTER) { + grpc_resource_quota_internal_unref(exec_ctx, s->resource_quota); + s->resource_quota = + grpc_resource_quota_internal_ref(args->args[i].value.pointer.p); + } else { + grpc_resource_quota_internal_unref(exec_ctx, s->resource_quota); + gpr_free(s); + return GRPC_ERROR_CREATE(GRPC_ARG_RESOURCE_QUOTA + " must be a pointer to a buffer pool"); + } + } + } gpr_ref_init(&s->refs, 1); s->on_accept_cb = NULL; s->on_accept_cb_arg = NULL; @@ -119,6 +136,7 @@ static void finish_shutdown(grpc_exec_ctx *exec_ctx, grpc_tcp_server *s) { gpr_free(sp->handle); gpr_free(sp); } + grpc_resource_quota_internal_unref(exec_ctx, s->resource_quota); gpr_free(s); } @@ -201,7 +219,7 @@ static void on_connect(uv_stream_t *server, int status) { } else { gpr_log(GPR_INFO, "uv_tcp_getpeername error: %s", uv_strerror(status)); } - ep = grpc_tcp_create(client, peer_name_string); + ep = grpc_tcp_create(client, sp->server->resource_quota, peer_name_string); sp->server->on_accept_cb(&exec_ctx, sp->server->on_accept_cb_arg, ep, NULL, &acceptor); grpc_exec_ctx_finish(&exec_ctx); diff --git a/src/core/lib/iomgr/tcp_uv.c b/src/core/lib/iomgr/tcp_uv.c index 3860fe3e9b5..b90e0c80082 100644 --- a/src/core/lib/iomgr/tcp_uv.c +++ b/src/core/lib/iomgr/tcp_uv.c @@ -1,35 +1,35 @@ /* - * - * Copyright 2016, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ +* +* Copyright 2016, Google Inc. +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are +* met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above +* copyright notice, this list of conditions and the following disclaimer +* in the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Google Inc. nor the names of its +* contributors may be used to endorse or promote products derived from +* this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ #include "src/core/lib/iomgr/port.h" @@ -54,6 +54,9 @@ typedef struct { grpc_endpoint base; gpr_refcount refcount; + uv_write_t write_req; + uv_shutdown_t shutdown_req; + uv_tcp_t *handle; grpc_closure *read_cb; @@ -64,14 +67,23 @@ typedef struct { gpr_slice_buffer *write_slices; uv_buf_t *write_buffers; + grpc_resource_user resource_user; + bool shutting_down; + bool resource_user_shutting_down; + char *peer_string; grpc_pollset *pollset; } grpc_tcp; static void uv_close_callback(uv_handle_t *handle) { gpr_free(handle); } -static void tcp_free(grpc_tcp *tcp) { gpr_free(tcp); } +static void tcp_free(grpc_tcp *tcp) { + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_resource_user_destroy(&exec_ctx, &tcp->resource_user); + gpr_free(tcp); + grpc_exec_ctx_finish(&exec_ctx); +} /*#define GRPC_TCP_REFCOUNT_DEBUG*/ #ifdef GRPC_TCP_REFCOUNT_DEBUG @@ -106,11 +118,14 @@ static void tcp_ref(grpc_tcp *tcp) { gpr_ref(&tcp->refcount); } static void alloc_uv_buf(uv_handle_t *handle, size_t suggested_size, uv_buf_t *buf) { + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_tcp *tcp = handle->data; (void)suggested_size; - tcp->read_slice = gpr_slice_malloc(GRPC_TCP_DEFAULT_READ_SLICE_SIZE); + tcp->read_slice = grpc_resource_user_slice_malloc( + &exec_ctx, &tcp->resource_user, GRPC_TCP_DEFAULT_READ_SLICE_SIZE); buf->base = (char *)GPR_SLICE_START_PTR(tcp->read_slice); buf->len = GPR_SLICE_LENGTH(tcp->read_slice); + grpc_exec_ctx_finish(&exec_ctx); } static void read_callback(uv_stream_t *stream, ssize_t nread, @@ -198,7 +213,8 @@ static void write_callback(uv_write_t *req, int status) { gpr_log(GPR_DEBUG, "write complete on %p: error=%s", tcp, str); } gpr_free(tcp->write_buffers); - gpr_free(req); + grpc_resource_user_free(&exec_ctx, &tcp->resource_user, + sizeof(uv_buf_t) * tcp->write_slices->count); grpc_exec_ctx_sched(&exec_ctx, cb, error, NULL); grpc_exec_ctx_finish(&exec_ctx); } @@ -243,12 +259,15 @@ static void uv_endpoint_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, tcp->write_cb = cb; buffer_count = (unsigned int)tcp->write_slices->count; buffers = gpr_malloc(sizeof(uv_buf_t) * buffer_count); + grpc_resource_user_alloc(exec_ctx, &tcp->resource_user, + sizeof(uv_buf_t) * buffer_count, NULL); for (i = 0; i < buffer_count; i++) { slice = &tcp->write_slices->slices[i]; buffers[i].base = (char *)GPR_SLICE_START_PTR(*slice); buffers[i].len = GPR_SLICE_LENGTH(*slice); } - write_req = gpr_malloc(sizeof(uv_write_t)); + tcp->write_buffers = buffers; + write_req = &tcp->write_req; write_req->data = tcp; TCP_REF(tcp, "write"); // TODO(murgatroid99): figure out what the return value here means @@ -274,13 +293,29 @@ static void uv_add_to_pollset_set(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, (void)pollset; } -static void shutdown_callback(uv_shutdown_t *req, int status) { gpr_free(req); } +static void shutdown_callback(uv_shutdown_t *req, int status) {} + +static void resource_user_shutdown_done(grpc_exec_ctx *exec_ctx, void *arg, + grpc_error *error) { + TCP_UNREF(arg, "resource_user"); +} + +static void uv_resource_user_maybe_shutdown(grpc_exec_ctx *exec_ctx, + grpc_tcp *tcp) { + if (!tcp->resource_user_shutting_down) { + tcp->resource_user_shutting_down = true; + TCP_REF(tcp, "resource_user"); + grpc_resource_user_shutdown( + exec_ctx, &tcp->resource_user, + grpc_closure_create(resource_user_shutdown_done, tcp)); + } +} static void uv_endpoint_shutdown(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep) { grpc_tcp *tcp = (grpc_tcp *)ep; if (!tcp->shutting_down) { tcp->shutting_down = true; - uv_shutdown_t *req = gpr_malloc(sizeof(uv_shutdown_t)); + uv_shutdown_t *req = &tcp->shutdown_req; uv_shutdown(req, (uv_stream_t *)tcp->handle, shutdown_callback); } } @@ -289,6 +324,7 @@ static void uv_destroy(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep) { grpc_network_status_unregister_endpoint(ep); grpc_tcp *tcp = (grpc_tcp *)ep; uv_close((uv_handle_t *)tcp->handle, uv_close_callback); + uv_resource_user_maybe_shutdown(exec_ctx, tcp); TCP_UNREF(tcp, "destroy"); } @@ -297,18 +333,21 @@ static char *uv_get_peer(grpc_endpoint *ep) { return gpr_strdup(tcp->peer_string); } +static grpc_resource_user *uv_get_resource_user(grpc_endpoint *ep) { + grpc_tcp *tcp = (grpc_tcp *)ep; + return &tcp->resource_user; +} + static grpc_workqueue *uv_get_workqueue(grpc_endpoint *ep) { return NULL; } -static grpc_endpoint_vtable vtable = {uv_endpoint_read, - uv_endpoint_write, - uv_get_workqueue, - uv_add_to_pollset, - uv_add_to_pollset_set, - uv_endpoint_shutdown, - uv_destroy, - uv_get_peer}; +static grpc_endpoint_vtable vtable = { + uv_endpoint_read, uv_endpoint_write, uv_get_workqueue, + uv_add_to_pollset, uv_add_to_pollset_set, uv_endpoint_shutdown, + uv_destroy, uv_get_resource_user, uv_get_peer}; -grpc_endpoint *grpc_tcp_create(uv_tcp_t *handle, char *peer_string) { +grpc_endpoint *grpc_tcp_create(uv_tcp_t *handle, + grpc_resource_quota *resource_quota, + char *peer_string) { grpc_tcp *tcp = (grpc_tcp *)gpr_malloc(sizeof(grpc_tcp)); if (grpc_tcp_trace) { @@ -325,6 +364,8 @@ grpc_endpoint *grpc_tcp_create(uv_tcp_t *handle, char *peer_string) { gpr_ref_init(&tcp->refcount, 1); tcp->peer_string = gpr_strdup(peer_string); tcp->shutting_down = false; + tcp->resource_user_shutting_down = false; + grpc_resource_user_init(&tcp->resource_user, resource_quota, peer_string); /* Tell network status tracking code about the new endpoint */ grpc_network_status_register_endpoint(&tcp->base); diff --git a/src/core/lib/iomgr/tcp_uv.h b/src/core/lib/iomgr/tcp_uv.h index eed41151ea7..970fcafe4a5 100644 --- a/src/core/lib/iomgr/tcp_uv.h +++ b/src/core/lib/iomgr/tcp_uv.h @@ -52,6 +52,8 @@ extern int grpc_tcp_trace; #define GRPC_TCP_DEFAULT_READ_SLICE_SIZE 8192 -grpc_endpoint *grpc_tcp_create(uv_tcp_t *handle, char *peer_string); +grpc_endpoint *grpc_tcp_create(uv_tcp_t *handle, + grpc_resource_quota *resource_quota, + char *peer_string); #endif /* GRPC_CORE_LIB_IOMGR_TCP_UV_H */ From 82f7f89757cf80e18cf15d316f149bbbb0ea6609 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 1 Nov 2016 09:47:17 -0700 Subject: [PATCH 03/20] Regenerate projects --- tools/run_tests/tests.json | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json index 733bfe3b8fd..39daf859b46 100644 --- a/tools/run_tests/tests.json +++ b/tools/run_tests/tests.json @@ -3003,6 +3003,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c++", From a59c4755d3b83f1cb06ad63d4deaaeec33fd07ba Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 1 Nov 2016 11:34:40 -0700 Subject: [PATCH 04/20] Send a RST_STREAM from the client if servers dont properly close streams --- .../transport/chttp2/transport/hpack_parser.c | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser.c b/src/core/ext/transport/chttp2/transport/hpack_parser.c index 8180f78fc00..9702cb2c814 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_parser.c +++ b/src/core/ext/transport/chttp2/transport/hpack_parser.c @@ -50,6 +50,7 @@ #include #include "src/core/ext/transport/chttp2/transport/bin_encoder.h" +#include "src/core/ext/transport/chttp2/transport/http2_errors.h" #include "src/core/lib/profiling/timers.h" #include "src/core/lib/support/string.h" @@ -1578,6 +1579,20 @@ static const maybe_complete_func_type maybe_complete_funcs[] = { grpc_chttp2_maybe_complete_recv_initial_metadata, grpc_chttp2_maybe_complete_recv_trailing_metadata}; +static void force_client_rst_stream(grpc_exec_ctx *exec_ctx, void *sp, + grpc_error *error) { + grpc_chttp2_stream *s = sp; + grpc_chttp2_transport *t = s->t; + if (!s->write_closed) { + gpr_slice_buffer_add( + &t->qbuf, grpc_chttp2_rst_stream_create(s->id, GRPC_CHTTP2_NO_ERROR, + &s->stats.outgoing)); + grpc_chttp2_initiate_write(exec_ctx, t, false, "force_rst_stream"); + grpc_chttp2_mark_stream_closed(exec_ctx, t, s, true, true, GRPC_ERROR_NONE); + } + GRPC_CHTTP2_STREAM_UNREF(exec_ctx, s, "final_rst"); +} + grpc_error *grpc_chttp2_header_parser_parse(grpc_exec_ctx *exec_ctx, void *hpack_parser, grpc_chttp2_transport *t, @@ -1613,6 +1628,17 @@ grpc_error *grpc_chttp2_header_parser_parse(grpc_exec_ctx *exec_ctx, s->header_frames_received++; } if (parser->is_eof) { + if (t->is_client && !s->write_closed) { + /* server eof ==> complete closure; we may need to forcefully close + the stream. Wait until the combiner lock is ready to be released + however -- it might be that we receive a RST_STREAM following this + and can avoid the extra write */ + GRPC_CHTTP2_STREAM_REF(s, "final_rst"); + grpc_combiner_execute_finally( + exec_ctx, t->combiner, + grpc_closure_create(force_client_rst_stream, s), GRPC_ERROR_NONE, + false); + } grpc_chttp2_mark_stream_closed(exec_ctx, t, s, true, false, GRPC_ERROR_NONE); } From 2afba3a72f28897fcf5444eb7f05af2acaffde1f Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 1 Nov 2016 11:48:46 -0700 Subject: [PATCH 05/20] Ensure something executes the new rst_stream code --- .../server_hanging_response_1_header | Bin 0 -> 18 bytes .../server_hanging_response_2_header2 | Bin 0 -> 27 bytes ..._client_examples_of_bad_closing_streams.py | 49 ++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 test/core/end2end/fuzzers/client_fuzzer_corpus/server_hanging_response_1_header create mode 100644 test/core/end2end/fuzzers/client_fuzzer_corpus/server_hanging_response_2_header2 create mode 100755 test/core/end2end/fuzzers/generate_client_examples_of_bad_closing_streams.py diff --git a/test/core/end2end/fuzzers/client_fuzzer_corpus/server_hanging_response_1_header b/test/core/end2end/fuzzers/client_fuzzer_corpus/server_hanging_response_1_header new file mode 100644 index 0000000000000000000000000000000000000000..d2abd17464c60ac237e196886d309bba43a7014b GIT binary patch literal 18 ScmZQzU|?Z@0!CIKgAo7#ZU77b literal 0 HcmV?d00001 diff --git a/test/core/end2end/fuzzers/client_fuzzer_corpus/server_hanging_response_2_header2 b/test/core/end2end/fuzzers/client_fuzzer_corpus/server_hanging_response_2_header2 new file mode 100644 index 0000000000000000000000000000000000000000..752af468ba6f8c6b1a9bd95cc082ebed73cc3b6a GIT binary patch literal 27 VcmZQzU|?Z@0!9#v5rkPm1ONc+01^NI literal 0 HcmV?d00001 diff --git a/test/core/end2end/fuzzers/generate_client_examples_of_bad_closing_streams.py b/test/core/end2end/fuzzers/generate_client_examples_of_bad_closing_streams.py new file mode 100755 index 00000000000..d80c1e0442b --- /dev/null +++ b/test/core/end2end/fuzzers/generate_client_examples_of_bad_closing_streams.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python2.7 +# Copyright 2015, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import os +import sys + +os.chdir(os.path.dirname(sys.argv[0])) + +streams = { + 'server_hanging_response_1_header': ( + [0,0,0,4,0,0,0,0,0] + # settings frame + [0,0,0,1,5,0,0,0,1] # trailers + ), + 'server_hanging_response_2_header2': ( + [0,0,0,4,0,0,0,0,0] + # settings frame + [0,0,0,1,4,0,0,0,1] + # headers + [0,0,0,1,5,0,0,0,1] # trailers + ), +} + +for name, stream in streams.items(): + open('client_fuzzer_corpus/%s' % name, 'w').write(bytearray(stream)) From 7bc42d2b9caf4860a55605c5e2b42214fdcc396d Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 1 Nov 2016 13:25:04 -0700 Subject: [PATCH 06/20] Missed file --- tools/run_tests/tests.json | 45 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json index 733bfe3b8fd..080bb051dbf 100644 --- a/tools/run_tests/tests.json +++ b/tools/run_tests/tests.json @@ -3003,6 +3003,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c++", @@ -81197,6 +81198,50 @@ ], "uses_polling": false }, + { + "args": [ + "test/core/end2end/fuzzers/client_fuzzer_corpus/server_hanging_response_1_header" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [ + "tsan" + ], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "client_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, + { + "args": [ + "test/core/end2end/fuzzers/client_fuzzer_corpus/server_hanging_response_2_header2" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [ + "tsan" + ], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "client_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, { "args": [ "test/core/end2end/fuzzers/client_fuzzer_corpus/settings_frame_1.bin" From 80b292709caa2a4b7b4ef69506eedfeb57e26dbc Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Tue, 1 Nov 2016 13:38:40 -0700 Subject: [PATCH 07/20] Stop supporting non-C++11 conformant compilers --- doc/cpp-style-guide.md | 88 +--------------------------- include/grpc++/impl/codegen/config.h | 80 ------------------------- 2 files changed, 3 insertions(+), 165 deletions(-) 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++/impl/codegen/config.h b/include/grpc++/impl/codegen/config.h index 0c754388681..cf9a956b1b0 100644 --- a/include/grpc++/impl/codegen/config.h +++ b/include/grpc++/impl/codegen/config.h @@ -34,79 +34,8 @@ #ifndef GRPCXX_IMPL_CODEGEN_CONFIG_H #define GRPCXX_IMPL_CODEGEN_CONFIG_H -#if !defined(GRPC_NO_AUTODETECT_PLATFORM) - -#ifdef _MSC_VER -// Visual Studio 2010 is 1600. -#if _MSC_VER < 1600 -#error "gRPC is only supported with Visual Studio starting at 2010" -// Visual Studio 2013 is 1800. -#elif _MSC_VER < 1800 -#define GRPC_CXX0X_NO_FINAL 1 -#define GRPC_CXX0X_NO_OVERRIDE 1 -#define GRPC_CXX0X_NO_CHRONO 1 -#define GRPC_CXX0X_NO_THREAD 1 -#endif -#endif // Visual Studio - -#ifndef __clang__ -#ifdef __GNUC__ -// nullptr was added in gcc 4.6 -#if (__GNUC__ * 100 + __GNUC_MINOR__ < 406) -#define GRPC_CXX0X_NO_NULLPTR 1 -#define GRPC_CXX0X_LIMITED_TOSTRING 1 -#endif -// final and override were added in gcc 4.7 -#if (__GNUC__ * 100 + __GNUC_MINOR__ < 407) -#define GRPC_CXX0X_NO_FINAL 1 -#define GRPC_CXX0X_NO_OVERRIDE 1 -#endif -#endif -#endif - -#endif - -#ifdef GRPC_CXX0X_NO_FINAL -#define GRPC_FINAL -#else #define GRPC_FINAL final -#endif - -#ifdef GRPC_CXX0X_NO_OVERRIDE -#define GRPC_OVERRIDE -#else #define GRPC_OVERRIDE override -#endif - -#ifdef GRPC_CXX0X_NO_NULLPTR -#include -#include -namespace grpc { -const class { - public: - template - operator T *() const { - return static_cast(0); - } - template - operator std::unique_ptr() const { - return std::unique_ptr(static_cast(0)); - } - template - operator std::shared_ptr() const { - return std::shared_ptr(static_cast(0)); - } - operator bool() const { return false; } - template - operator std::function() const { - return std::function(); - } - - private: - void operator&() const = delete; -} nullptr = {}; -} -#endif #ifndef GRPC_CUSTOM_STRING #include @@ -117,16 +46,7 @@ namespace grpc { typedef GRPC_CUSTOM_STRING string; -#ifdef GRPC_CXX0X_LIMITED_TOSTRING -inline grpc::string to_string(const int x) { - return std::to_string(static_cast(x)); -} -inline grpc::string to_string(const unsigned int x) { - return std::to_string(static_cast(x)); -} -#else using std::to_string; -#endif } // namespace grpc From e3beac9eebadf0a291664f65cc8cdbe8182150d4 Mon Sep 17 00:00:00 2001 From: Matt Kwong Date: Tue, 1 Nov 2016 12:53:04 -0700 Subject: [PATCH 08/20] Disable gcc4.4 C++ tests - DO NOT MERGE INTO V1.0.X --- tools/run_tests/run_tests_matrix.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/run_tests/run_tests_matrix.py b/tools/run_tests/run_tests_matrix.py index 2656f1ac5dc..41db67cdb58 100755 --- a/tools/run_tests/run_tests_matrix.py +++ b/tools/run_tests/run_tests_matrix.py @@ -181,7 +181,17 @@ def _create_portability_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS) # portability C and C++ on x64 for compiler in ['gcc4.4', 'gcc4.6', 'gcc5.3', 'clang3.5', 'clang3.6', 'clang3.7']: - test_jobs += _generate_jobs(languages=['c', 'c++'], + test_jobs += _generate_jobs(languages=['c'], + configs=['dbg'], + platforms=['linux'], + arch='x64', + compiler=compiler, + labels=['portability'], + extra_args=extra_args, + inner_jobs=inner_jobs) + for compiler in ['gcc4.8', 'gcc5.3', + 'clang3.5', 'clang3.6', 'clang3.7']: + test_jobs += _generate_jobs(languages=['c++'], configs=['dbg'], platforms=['linux'], arch='x64', From c0b2acb1a085d6220d2d813c38ebcbb51498f6e9 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Tue, 1 Nov 2016 16:31:56 -0700 Subject: [PATCH 09/20] Use C++11 final and override --- include/grpc++/alarm.h | 2 +- include/grpc++/channel.h | 14 ++-- .../ext/proto_server_reflection_plugin.h | 12 +-- .../grpc++/generic/async_generic_service.h | 4 +- include/grpc++/generic/generic_stub.h | 2 +- include/grpc++/impl/codegen/async_stream.h | 64 ++++++++-------- .../grpc++/impl/codegen/async_unary_call.h | 8 +- include/grpc++/impl/codegen/call.h | 14 ++-- include/grpc++/impl/codegen/config.h | 3 - include/grpc++/impl/codegen/core_codegen.h | 62 +++++++-------- .../grpc++/impl/codegen/method_handler_impl.h | 10 +-- include/grpc++/impl/codegen/proto_utils.h | 22 +++--- .../grpc++/impl/codegen/server_interface.h | 10 +-- include/grpc++/impl/codegen/sync_stream.h | 76 +++++++++---------- include/grpc++/impl/grpc_library.h | 8 +- include/grpc++/resource_quota.h | 2 +- include/grpc++/server.h | 20 ++--- include/grpc++/support/byte_buffer.h | 2 +- include/grpc++/support/slice.h | 2 +- src/compiler/cpp_generator.cc | 48 ++++++------ src/cpp/client/channel_cc.cc | 6 +- src/cpp/client/client_context.cc | 8 +- src/cpp/client/cronet_credentials.cc | 6 +- src/cpp/client/insecure_credentials.cc | 6 +- src/cpp/client/secure_credentials.h | 14 ++-- src/cpp/common/channel_filter.h | 2 +- src/cpp/common/secure_auth_context.h | 20 ++--- src/cpp/ext/proto_server_reflection.h | 4 +- src/cpp/server/dynamic_thread_pool.h | 4 +- src/cpp/server/insecure_server_credentials.cc | 6 +- src/cpp/server/secure_server_credentials.h | 10 +-- src/cpp/server/server_cc.cc | 26 +++---- src/cpp/server/server_context.cc | 6 +- test/cpp/codegen/compiler_test_golden | 52 ++++++------- .../cpp/common/auth_property_iterator_test.cc | 4 +- test/cpp/end2end/async_end2end_test.cc | 8 +- test/cpp/end2end/client_crash_test_server.cc | 4 +- test/cpp/end2end/end2end_test.cc | 16 ++-- test/cpp/end2end/filter_end2end_test.cc | 6 +- test/cpp/end2end/generic_end2end_test.cc | 4 +- test/cpp/end2end/hybrid_end2end_test.cc | 16 ++-- test/cpp/end2end/mock_test.cc | 56 +++++++------- .../end2end/proto_server_reflection_test.cc | 2 +- .../cpp/end2end/server_builder_plugin_test.cc | 20 ++--- test/cpp/end2end/server_crash_test.cc | 6 +- test/cpp/end2end/shutdown_test.cc | 6 +- test/cpp/end2end/streaming_throughput_test.cc | 6 +- test/cpp/end2end/test_service_impl.h | 8 +- test/cpp/end2end/thread_stress_test.cc | 26 +++---- test/cpp/qps/client.h | 2 +- test/cpp/qps/client_async.cc | 40 +++++----- test/cpp/qps/client_sync.cc | 10 +-- test/cpp/qps/gen_build_yaml.py | 0 test/cpp/qps/interarrival.h | 6 +- test/cpp/qps/qps_worker.cc | 12 +-- test/cpp/qps/report.h | 24 +++--- test/cpp/qps/server_async.cc | 18 ++--- test/cpp/qps/server_sync.cc | 8 +- .../cpp/thread_manager/thread_manager_test.cc | 6 +- test/cpp/util/cli_call.h | 2 +- test/cpp/util/cli_call_test.cc | 6 +- test/cpp/util/grpc_tool_test.cc | 8 +- test/cpp/util/metrics_server.h | 6 +- test/cpp/util/proto_file_parser.cc | 4 +- .../proto_reflection_descriptor_database.h | 8 +- test/cpp/util/test_credentials_provider.cc | 10 +-- 66 files changed, 455 insertions(+), 458 deletions(-) mode change 100755 => 100644 test/cpp/qps/gen_build_yaml.py 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..aa492a7c2b2 100644 --- a/include/grpc++/channel.h +++ b/include/grpc++/channel.h @@ -46,7 +46,7 @@ struct grpc_channel; namespace grpc { /// Channels represent a connection to an endpoint. Created by \a CreateChannel. -class Channel GRPC_FINAL : public ChannelInterface, +class Channel final : public ChannelInterface, public CallHook, public std::enable_shared_from_this, private GrpcLibraryCodegen { @@ -55,7 +55,7 @@ class Channel GRPC_FINAL : public ChannelInterface, /// 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..ba2c6ceee9e 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,13 @@ class ClientAsyncResponseReader GRPC_FINAL }; template -class ServerAsyncResponseWriter GRPC_FINAL +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 +168,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/config.h b/include/grpc++/impl/codegen/config.h index cf9a956b1b0..af3ee5a4cf8 100644 --- a/include/grpc++/impl/codegen/config.h +++ b/include/grpc++/impl/codegen/config.h @@ -34,9 +34,6 @@ #ifndef GRPCXX_IMPL_CODEGEN_CONFIG_H #define GRPCXX_IMPL_CODEGEN_CONFIG_H -#define GRPC_FINAL final -#define GRPC_OVERRIDE override - #ifndef GRPC_CUSTOM_STRING #include #define GRPC_CUSTOM_STRING std::string diff --git a/include/grpc++/impl/codegen/core_codegen.h b/include/grpc++/impl/codegen/core_codegen.h index 0ce009e69d2..8d845c40809 100644 --- a/include/grpc++/impl/codegen/core_codegen.h +++ b/include/grpc++/impl/codegen/core_codegen.h @@ -46,55 +46,55 @@ namespace grpc { class CoreCodegen : public CoreCodegenInterface { private: grpc_completion_queue* grpc_completion_queue_create(void* reserved) - GRPC_OVERRIDE; - void grpc_completion_queue_destroy(grpc_completion_queue* cq) GRPC_OVERRIDE; + override; + void grpc_completion_queue_destroy(grpc_completion_queue* cq) override; grpc_event grpc_completion_queue_pluck(grpc_completion_queue* cq, void* tag, gpr_timespec deadline, - void* reserved) GRPC_OVERRIDE; + void* reserved) override; - void* gpr_malloc(size_t size) GRPC_OVERRIDE; - void gpr_free(void* p) GRPC_OVERRIDE; + void* gpr_malloc(size_t size) override; + void gpr_free(void* p) override; - void gpr_mu_init(gpr_mu* mu) GRPC_OVERRIDE; - void gpr_mu_destroy(gpr_mu* mu) GRPC_OVERRIDE; - void gpr_mu_lock(gpr_mu* mu) GRPC_OVERRIDE; - void gpr_mu_unlock(gpr_mu* mu) GRPC_OVERRIDE; - void gpr_cv_init(gpr_cv* cv) GRPC_OVERRIDE; - void gpr_cv_destroy(gpr_cv* cv) GRPC_OVERRIDE; + void gpr_mu_init(gpr_mu* mu) override; + void gpr_mu_destroy(gpr_mu* mu) override; + void gpr_mu_lock(gpr_mu* mu) override; + void gpr_mu_unlock(gpr_mu* mu) override; + void gpr_cv_init(gpr_cv* cv) override; + void gpr_cv_destroy(gpr_cv* cv) override; int gpr_cv_wait(gpr_cv* cv, gpr_mu* mu, - gpr_timespec abs_deadline) GRPC_OVERRIDE; - void gpr_cv_signal(gpr_cv* cv) GRPC_OVERRIDE; - void gpr_cv_broadcast(gpr_cv* cv) GRPC_OVERRIDE; + gpr_timespec abs_deadline) override; + void gpr_cv_signal(gpr_cv* cv) override; + void gpr_cv_broadcast(gpr_cv* cv) override; - void grpc_byte_buffer_destroy(grpc_byte_buffer* bb) GRPC_OVERRIDE; + void grpc_byte_buffer_destroy(grpc_byte_buffer* bb) override; int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader* reader, - grpc_byte_buffer* buffer) GRPC_OVERRIDE; + grpc_byte_buffer* buffer) override; void grpc_byte_buffer_reader_destroy(grpc_byte_buffer_reader* reader) - GRPC_OVERRIDE; + override; int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader* reader, - gpr_slice* slice) GRPC_OVERRIDE; + gpr_slice* slice) override; grpc_byte_buffer* grpc_raw_byte_buffer_create(gpr_slice* slice, - size_t nslices) GRPC_OVERRIDE; + size_t nslices) override; - gpr_slice gpr_slice_malloc(size_t length) GRPC_OVERRIDE; - void gpr_slice_unref(gpr_slice slice) GRPC_OVERRIDE; - gpr_slice gpr_slice_split_tail(gpr_slice* s, size_t split) GRPC_OVERRIDE; + gpr_slice gpr_slice_malloc(size_t length) override; + void gpr_slice_unref(gpr_slice slice) override; + gpr_slice gpr_slice_split_tail(gpr_slice* s, size_t split) override; void gpr_slice_buffer_add(gpr_slice_buffer* sb, - gpr_slice slice) GRPC_OVERRIDE; - void gpr_slice_buffer_pop(gpr_slice_buffer* sb) GRPC_OVERRIDE; + gpr_slice slice) override; + void gpr_slice_buffer_pop(gpr_slice_buffer* sb) override; - void grpc_metadata_array_init(grpc_metadata_array* array) GRPC_OVERRIDE; - void grpc_metadata_array_destroy(grpc_metadata_array* array) GRPC_OVERRIDE; + void grpc_metadata_array_init(grpc_metadata_array* array) override; + void grpc_metadata_array_destroy(grpc_metadata_array* array) override; - gpr_timespec gpr_inf_future(gpr_clock_type type) GRPC_OVERRIDE; - gpr_timespec gpr_time_0(gpr_clock_type type) GRPC_OVERRIDE; + gpr_timespec gpr_inf_future(gpr_clock_type type) override; + gpr_timespec gpr_time_0(gpr_clock_type type) override; - virtual const Status& ok() GRPC_OVERRIDE; - virtual const Status& cancelled() GRPC_OVERRIDE; + virtual const Status& ok() override; + virtual const Status& cancelled() override; - void assert_fail(const char* failed_assertion) GRPC_OVERRIDE; + void assert_fail(const char* failed_assertion) override; }; } // namespace grpc diff --git a/include/grpc++/impl/codegen/method_handler_impl.h b/include/grpc++/impl/codegen/method_handler_impl.h index bb992f0e185..d5d27e15cd6 100644 --- a/include/grpc++/impl/codegen/method_handler_impl.h +++ b/include/grpc++/impl/codegen/method_handler_impl.h @@ -50,7 +50,7 @@ class RpcMethodHandler : public MethodHandler { ServiceType* service) : func_(func), service_(service) {} - void RunHandler(const HandlerParameter& param) GRPC_FINAL { + void RunHandler(const HandlerParameter& param) final { RequestType req; Status status = SerializationTraits::Deserialize( param.request, &req, param.max_receive_message_size); @@ -96,7 +96,7 @@ class ClientStreamingHandler : public MethodHandler { ServiceType* service) : func_(func), service_(service) {} - void RunHandler(const HandlerParameter& param) GRPC_FINAL { + void RunHandler(const HandlerParameter& param) final { ServerReader reader(param.call, param.server_context); ResponseType rsp; Status status = func_(service_, param.server_context, &reader, &rsp); @@ -136,7 +136,7 @@ class ServerStreamingHandler : public MethodHandler { ServiceType* service) : func_(func), service_(service) {} - void RunHandler(const HandlerParameter& param) GRPC_FINAL { + void RunHandler(const HandlerParameter& param) final { RequestType req; Status status = SerializationTraits::Deserialize( param.request, &req, param.max_receive_message_size); @@ -180,7 +180,7 @@ class TemplatedBidiStreamingHandler : public MethodHandler { std::function func) : func_(func), write_needed_(WriteNeeded) {} - void RunHandler(const HandlerParameter& param) GRPC_FINAL { + void RunHandler(const HandlerParameter& param) final { Streamer stream(param.call, param.server_context); Status status = func_(param.server_context, &stream); @@ -266,7 +266,7 @@ class UnknownMethodHandler : public MethodHandler { ops->ServerSendStatus(context->trailing_metadata_, status); } - void RunHandler(const HandlerParameter& param) GRPC_FINAL { + void RunHandler(const HandlerParameter& param) final { CallOpSet ops; FillOps(param.server_context, &ops); param.call->PerformOps(&ops); diff --git a/include/grpc++/impl/codegen/proto_utils.h b/include/grpc++/impl/codegen/proto_utils.h index 6f4786b87be..cbaa3e7bf26 100644 --- a/include/grpc++/impl/codegen/proto_utils.h +++ b/include/grpc++/impl/codegen/proto_utils.h @@ -52,7 +52,7 @@ namespace internal { const int kGrpcBufferWriterMaxBufferLength = 8192; -class GrpcBufferWriter GRPC_FINAL +class GrpcBufferWriter final : public ::grpc::protobuf::io::ZeroCopyOutputStream { public: explicit GrpcBufferWriter(grpc_byte_buffer** bp, int block_size) @@ -61,13 +61,13 @@ class GrpcBufferWriter GRPC_FINAL slice_buffer_ = &(*bp)->data.raw.slice_buffer; } - ~GrpcBufferWriter() GRPC_OVERRIDE { + ~GrpcBufferWriter() override { if (have_backup_) { g_core_codegen_interface->gpr_slice_unref(backup_slice_); } } - bool Next(void** data, int* size) GRPC_OVERRIDE { + bool Next(void** data, int* size) override { if (have_backup_) { slice_ = backup_slice_; have_backup_ = false; @@ -82,7 +82,7 @@ class GrpcBufferWriter GRPC_FINAL return true; } - void BackUp(int count) GRPC_OVERRIDE { + void BackUp(int count) override { g_core_codegen_interface->gpr_slice_buffer_pop(slice_buffer_); if (count == block_size_) { backup_slice_ = slice_; @@ -95,7 +95,7 @@ class GrpcBufferWriter GRPC_FINAL byte_count_ -= count; } - grpc::protobuf::int64 ByteCount() const GRPC_OVERRIDE { return byte_count_; } + grpc::protobuf::int64 ByteCount() const override { return byte_count_; } private: const int block_size_; @@ -106,7 +106,7 @@ class GrpcBufferWriter GRPC_FINAL gpr_slice slice_; }; -class GrpcBufferReader GRPC_FINAL +class GrpcBufferReader final : public ::grpc::protobuf::io::ZeroCopyInputStream { public: explicit GrpcBufferReader(grpc_byte_buffer* buffer) @@ -117,11 +117,11 @@ class GrpcBufferReader GRPC_FINAL "Couldn't initialize byte buffer reader"); } } - ~GrpcBufferReader() GRPC_OVERRIDE { + ~GrpcBufferReader() override { g_core_codegen_interface->grpc_byte_buffer_reader_destroy(&reader_); } - bool Next(const void** data, int* size) GRPC_OVERRIDE { + bool Next(const void** data, int* size) override { if (!status_.ok()) { return false; } @@ -147,9 +147,9 @@ class GrpcBufferReader GRPC_FINAL Status status() const { return status_; } - void BackUp(int count) GRPC_OVERRIDE { backup_count_ = count; } + void BackUp(int count) override { backup_count_ = count; } - bool Skip(int count) GRPC_OVERRIDE { + bool Skip(int count) override { const void* data; int size; while (Next(&data, &size)) { @@ -164,7 +164,7 @@ class GrpcBufferReader GRPC_FINAL return false; } - grpc::protobuf::int64 ByteCount() const GRPC_OVERRIDE { + grpc::protobuf::int64 ByteCount() const override { return byte_count_ - backup_count_; } diff --git a/include/grpc++/impl/codegen/server_interface.h b/include/grpc++/impl/codegen/server_interface.h index 5c41ca51b45..41a64bead03 100644 --- a/include/grpc++/impl/codegen/server_interface.h +++ b/include/grpc++/impl/codegen/server_interface.h @@ -142,7 +142,7 @@ class ServerInterface : public CallHook { bool delete_on_finalize); virtual ~BaseAsyncRequest() {} - bool FinalizeResult(void** tag, bool* status) GRPC_OVERRIDE; + bool FinalizeResult(void** tag, bool* status) override; protected: ServerInterface* const server_; @@ -168,7 +168,7 @@ class ServerInterface : public CallHook { ServerCompletionQueue* notification_cq); }; - class NoPayloadAsyncRequest GRPC_FINAL : public RegisteredAsyncRequest { + class NoPayloadAsyncRequest final : public RegisteredAsyncRequest { public: NoPayloadAsyncRequest(void* registered_method, ServerInterface* server, ServerContext* context, @@ -183,7 +183,7 @@ class ServerInterface : public CallHook { }; template - class PayloadAsyncRequest GRPC_FINAL : public RegisteredAsyncRequest { + class PayloadAsyncRequest final : public RegisteredAsyncRequest { public: PayloadAsyncRequest(void* registered_method, ServerInterface* server, ServerContext* context, @@ -196,7 +196,7 @@ class ServerInterface : public CallHook { IssueRequest(registered_method, &payload_, notification_cq); } - bool FinalizeResult(void** tag, bool* status) GRPC_OVERRIDE { + bool FinalizeResult(void** tag, bool* status) override { bool serialization_status = *status && payload_ && SerializationTraits::Deserialize( @@ -220,7 +220,7 @@ class ServerInterface : public CallHook { ServerCompletionQueue* notification_cq, void* tag, bool delete_on_finalize); - bool FinalizeResult(void** tag, bool* status) GRPC_OVERRIDE; + bool FinalizeResult(void** tag, bool* status) override; private: grpc_call_details call_details_; diff --git a/include/grpc++/impl/codegen/sync_stream.h b/include/grpc++/impl/codegen/sync_stream.h index 9a3efb51193..4d9b074e95f 100644 --- a/include/grpc++/impl/codegen/sync_stream.h +++ b/include/grpc++/impl/codegen/sync_stream.h @@ -131,7 +131,7 @@ class ClientReaderInterface : public ClientStreamingInterface, }; template -class ClientReader GRPC_FINAL : public ClientReaderInterface { +class ClientReader final : public ClientReaderInterface { public: /// Blocking create a stream and write the first request out. template @@ -150,7 +150,7 @@ class ClientReader GRPC_FINAL : public ClientReaderInterface { cq_.Pluck(&ops); } - void WaitForInitialMetadata() GRPC_OVERRIDE { + void WaitForInitialMetadata() override { GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_); CallOpSet ops; @@ -159,12 +159,12 @@ class ClientReader GRPC_FINAL : public ClientReaderInterface { cq_.Pluck(&ops); /// status ignored } - bool NextMessageSize(uint32_t* sz) GRPC_OVERRIDE { + bool NextMessageSize(uint32_t* sz) override { *sz = call_.max_receive_message_size(); return true; } - bool Read(R* msg) GRPC_OVERRIDE { + bool Read(R* msg) override { CallOpSet> ops; if (!context_->initial_metadata_received_) { ops.RecvInitialMetadata(context_); @@ -174,7 +174,7 @@ class ClientReader GRPC_FINAL : public ClientReaderInterface { return cq_.Pluck(&ops) && ops.got_message; } - Status Finish() GRPC_OVERRIDE { + Status Finish() override { CallOpSet ops; Status status; ops.ClientRecvStatus(context_, &status); @@ -230,7 +230,7 @@ class ClientWriter : public ClientWriterInterface { } using WriterInterface::Write; - bool Write(const W& msg, const WriteOptions& options) GRPC_OVERRIDE { + bool Write(const W& msg, const WriteOptions& options) override { CallOpSet ops; if (!ops.SendMessage(msg, options).ok()) { return false; @@ -239,7 +239,7 @@ class ClientWriter : public ClientWriterInterface { return cq_.Pluck(&ops); } - bool WritesDone() GRPC_OVERRIDE { + bool WritesDone() override { CallOpSet ops; ops.ClientSendClose(); call_.PerformOps(&ops); @@ -247,7 +247,7 @@ class ClientWriter : public ClientWriterInterface { } /// Read the final response and wait for the final status. - Status Finish() GRPC_OVERRIDE { + Status Finish() override { Status status; if (!context_->initial_metadata_received_) { finish_ops_.RecvInitialMetadata(context_); @@ -287,7 +287,7 @@ class ClientReaderWriterInterface : public ClientStreamingInterface, }; template -class ClientReaderWriter GRPC_FINAL : public ClientReaderWriterInterface { +class ClientReaderWriter final : public ClientReaderWriterInterface { public: /// Blocking create a stream. ClientReaderWriter(ChannelInterface* channel, const RpcMethod& method, @@ -300,7 +300,7 @@ class ClientReaderWriter GRPC_FINAL : public ClientReaderWriterInterface { cq_.Pluck(&ops); } - void WaitForInitialMetadata() GRPC_OVERRIDE { + void WaitForInitialMetadata() override { GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_); CallOpSet ops; @@ -309,12 +309,12 @@ class ClientReaderWriter GRPC_FINAL : public ClientReaderWriterInterface { cq_.Pluck(&ops); // status ignored } - bool NextMessageSize(uint32_t* sz) GRPC_OVERRIDE { + bool NextMessageSize(uint32_t* sz) override { *sz = call_.max_receive_message_size(); return true; } - bool Read(R* msg) GRPC_OVERRIDE { + bool Read(R* msg) override { CallOpSet> ops; if (!context_->initial_metadata_received_) { ops.RecvInitialMetadata(context_); @@ -325,21 +325,21 @@ class ClientReaderWriter GRPC_FINAL : public ClientReaderWriterInterface { } using WriterInterface::Write; - bool Write(const W& msg, const WriteOptions& options) GRPC_OVERRIDE { + bool Write(const W& msg, const WriteOptions& options) override { CallOpSet ops; if (!ops.SendMessage(msg, options).ok()) return false; call_.PerformOps(&ops); return cq_.Pluck(&ops); } - bool WritesDone() GRPC_OVERRIDE { + bool WritesDone() override { CallOpSet ops; ops.ClientSendClose(); call_.PerformOps(&ops); return cq_.Pluck(&ops); } - Status Finish() GRPC_OVERRIDE { + Status Finish() override { CallOpSet ops; if (!context_->initial_metadata_received_) { ops.RecvInitialMetadata(context_); @@ -363,11 +363,11 @@ class ServerReaderInterface : public ServerStreamingInterface, public ReaderInterface {}; template -class ServerReader GRPC_FINAL : public ServerReaderInterface { +class ServerReader final : public ServerReaderInterface { public: ServerReader(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {} - void SendInitialMetadata() GRPC_OVERRIDE { + void SendInitialMetadata() override { GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_); CallOpSet ops; @@ -381,12 +381,12 @@ class ServerReader GRPC_FINAL : public ServerReaderInterface { call_->cq()->Pluck(&ops); } - bool NextMessageSize(uint32_t* sz) GRPC_OVERRIDE { + bool NextMessageSize(uint32_t* sz) override { *sz = call_->max_receive_message_size(); return true; } - bool Read(R* msg) GRPC_OVERRIDE { + bool Read(R* msg) override { CallOpSet> ops; ops.RecvMessage(msg); call_->PerformOps(&ops); @@ -404,11 +404,11 @@ class ServerWriterInterface : public ServerStreamingInterface, public WriterInterface {}; template -class ServerWriter GRPC_FINAL : public ServerWriterInterface { +class ServerWriter final : public ServerWriterInterface { public: ServerWriter(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {} - void SendInitialMetadata() GRPC_OVERRIDE { + void SendInitialMetadata() override { GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_); CallOpSet ops; @@ -423,7 +423,7 @@ class ServerWriter GRPC_FINAL : public ServerWriterInterface { } using WriterInterface::Write; - bool Write(const W& msg, const WriteOptions& options) GRPC_OVERRIDE { + bool Write(const W& msg, const WriteOptions& options) override { CallOpSet ops; if (!ops.SendMessage(msg, options).ok()) { return false; @@ -454,7 +454,7 @@ class ServerReaderWriterInterface : public ServerStreamingInterface, // Actual implementation of bi-directional streaming namespace internal { template -class ServerReaderWriterBody GRPC_FINAL { +class ServerReaderWriterBody final { public: ServerReaderWriterBody(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {} @@ -510,20 +510,20 @@ class ServerReaderWriterBody GRPC_FINAL { // class to represent the user API for a bidirectional streaming call template -class ServerReaderWriter GRPC_FINAL : public ServerReaderWriterInterface { +class ServerReaderWriter final : public ServerReaderWriterInterface { public: ServerReaderWriter(Call* call, ServerContext* ctx) : body_(call, ctx) {} - void SendInitialMetadata() GRPC_OVERRIDE { body_.SendInitialMetadata(); } + void SendInitialMetadata() override { body_.SendInitialMetadata(); } - bool NextMessageSize(uint32_t* sz) GRPC_OVERRIDE { + bool NextMessageSize(uint32_t* sz) override { return body_.NextMessageSize(sz); } - bool Read(R* msg) GRPC_OVERRIDE { return body_.Read(msg); } + bool Read(R* msg) override { return body_.Read(msg); } using WriterInterface::Write; - bool Write(const W& msg, const WriteOptions& options) GRPC_OVERRIDE { + bool Write(const W& msg, const WriteOptions& options) override { return body_.Write(msg, options); } @@ -541,19 +541,19 @@ class ServerReaderWriter GRPC_FINAL : public ServerReaderWriterInterface { /// must have exactly 1 Read and exactly 1 Write, in that order, to function /// correctly. Otherwise, the RPC is in error. template -class ServerUnaryStreamer GRPC_FINAL +class ServerUnaryStreamer final : public ServerReaderWriterInterface { public: ServerUnaryStreamer(Call* call, ServerContext* ctx) : body_(call, ctx), read_done_(false), write_done_(false) {} - void SendInitialMetadata() GRPC_OVERRIDE { body_.SendInitialMetadata(); } + void SendInitialMetadata() override { body_.SendInitialMetadata(); } - bool NextMessageSize(uint32_t* sz) GRPC_OVERRIDE { + bool NextMessageSize(uint32_t* sz) override { return body_.NextMessageSize(sz); } - bool Read(RequestType* request) GRPC_OVERRIDE { + bool Read(RequestType* request) override { if (read_done_) { return false; } @@ -563,7 +563,7 @@ class ServerUnaryStreamer GRPC_FINAL using WriterInterface::Write; bool Write(const ResponseType& response, - const WriteOptions& options) GRPC_OVERRIDE { + const WriteOptions& options) override { if (write_done_ || !read_done_) { return false; } @@ -583,19 +583,19 @@ class ServerUnaryStreamer GRPC_FINAL /// but the server responds to it as though it were a bidi streaming call that /// must first have exactly 1 Read and then any number of Writes. template -class ServerSplitStreamer GRPC_FINAL +class ServerSplitStreamer final : public ServerReaderWriterInterface { public: ServerSplitStreamer(Call* call, ServerContext* ctx) : body_(call, ctx), read_done_(false) {} - void SendInitialMetadata() GRPC_OVERRIDE { body_.SendInitialMetadata(); } + void SendInitialMetadata() override { body_.SendInitialMetadata(); } - bool NextMessageSize(uint32_t* sz) GRPC_OVERRIDE { + bool NextMessageSize(uint32_t* sz) override { return body_.NextMessageSize(sz); } - bool Read(RequestType* request) GRPC_OVERRIDE { + bool Read(RequestType* request) override { if (read_done_) { return false; } @@ -605,7 +605,7 @@ class ServerSplitStreamer GRPC_FINAL using WriterInterface::Write; bool Write(const ResponseType& response, - const WriteOptions& options) GRPC_OVERRIDE { + const WriteOptions& options) override { return read_done_ && body_.Write(response, options); } diff --git a/include/grpc++/impl/grpc_library.h b/include/grpc++/impl/grpc_library.h index 1184d1bf093..ee1d0a97508 100644 --- a/include/grpc++/impl/grpc_library.h +++ b/include/grpc++/impl/grpc_library.h @@ -44,17 +44,17 @@ namespace grpc { namespace internal { -class GrpcLibrary GRPC_FINAL : public GrpcLibraryInterface { +class GrpcLibrary final : public GrpcLibraryInterface { public: - void init() GRPC_OVERRIDE { grpc_init(); } - void shutdown() GRPC_OVERRIDE { grpc_shutdown(); } + void init() override { grpc_init(); } + void shutdown() override { grpc_shutdown(); } }; static GrpcLibrary g_gli; static CoreCodegen g_core_codegen; /// Instantiating this class ensures the proper initialization of gRPC. -class GrpcLibraryInitializer GRPC_FINAL { +class GrpcLibraryInitializer final { public: GrpcLibraryInitializer() { if (grpc::g_glip == nullptr) { diff --git a/include/grpc++/resource_quota.h b/include/grpc++/resource_quota.h index db5bc8e7be1..75e04d4e2ff 100644 --- a/include/grpc++/resource_quota.h +++ b/include/grpc++/resource_quota.h @@ -44,7 +44,7 @@ namespace grpc { /// A ResourceQuota can be attached to a server (via ServerBuilder), or a client /// channel (via ChannelArguments). gRPC will attempt to keep memory used by /// all attached entities below the ResourceQuota bound. -class ResourceQuota GRPC_FINAL { +class ResourceQuota final { public: explicit ResourceQuota(const grpc::string& name); ResourceQuota(); diff --git a/include/grpc++/server.h b/include/grpc++/server.h index a6d70c7577b..6d0d2d9a8aa 100644 --- a/include/grpc++/server.h +++ b/include/grpc++/server.h @@ -64,7 +64,7 @@ class ThreadPoolInterface; /// Models a gRPC server. /// /// Servers are configured and started via \a grpc::ServerBuilder. -class Server GRPC_FINAL : public ServerInterface, private GrpcLibraryCodegen { +class Server final : public ServerInterface, private GrpcLibraryCodegen { public: ~Server(); @@ -72,7 +72,7 @@ class Server GRPC_FINAL : public ServerInterface, private GrpcLibraryCodegen { /// /// \warning The server must be either shutting down or some other thread must /// call \a Shutdown for this function to ever return. - void Wait() GRPC_OVERRIDE; + void Wait() override; /// Global Callbacks /// @@ -144,11 +144,11 @@ class Server GRPC_FINAL : public ServerInterface, private GrpcLibraryCodegen { /// Register a service. This call does not take ownership of the service. /// The service must exist for the lifetime of the Server instance. bool RegisterService(const grpc::string* host, - Service* service) GRPC_OVERRIDE; + Service* service) override; /// Register a generic service. This call does not take ownership of the /// service. The service must exist for the lifetime of the Server instance. - void RegisterAsyncGenericService(AsyncGenericService* service) GRPC_OVERRIDE; + void RegisterAsyncGenericService(AsyncGenericService* service) override; /// Tries to bind \a server to the given \a addr. /// @@ -162,7 +162,7 @@ class Server GRPC_FINAL : public ServerInterface, private GrpcLibraryCodegen { /// /// \warning It's an error to call this method on an already started server. int AddListeningPort(const grpc::string& addr, - ServerCredentials* creds) GRPC_OVERRIDE; + ServerCredentials* creds) override; /// Start the server. /// @@ -172,17 +172,17 @@ class Server GRPC_FINAL : public ServerInterface, private GrpcLibraryCodegen { /// \param num_cqs How many completion queues does \a cqs hold. /// /// \return true on a successful shutdown. - bool Start(ServerCompletionQueue** cqs, size_t num_cqs) GRPC_OVERRIDE; + bool Start(ServerCompletionQueue** cqs, size_t num_cqs) override; - void PerformOpsOnCall(CallOpSetInterface* ops, Call* call) GRPC_OVERRIDE; + void PerformOpsOnCall(CallOpSetInterface* ops, Call* call) override; - void ShutdownInternal(gpr_timespec deadline) GRPC_OVERRIDE; + void ShutdownInternal(gpr_timespec deadline) override; - int max_receive_message_size() const GRPC_OVERRIDE { + int max_receive_message_size() const override { return max_receive_message_size_; }; - grpc_server* server() GRPC_OVERRIDE { return server_; }; + grpc_server* server() override { return server_; }; ServerInitializer* initializer(); diff --git a/include/grpc++/support/byte_buffer.h b/include/grpc++/support/byte_buffer.h index 06f8969b704..1f317df6634 100644 --- a/include/grpc++/support/byte_buffer.h +++ b/include/grpc++/support/byte_buffer.h @@ -47,7 +47,7 @@ namespace grpc { /// A sequence of bytes. -class ByteBuffer GRPC_FINAL { +class ByteBuffer final { public: /// Constuct an empty buffer. ByteBuffer() : buffer_(nullptr) {} diff --git a/include/grpc++/support/slice.h b/include/grpc++/support/slice.h index 5874b4f5ae3..85561f7f334 100644 --- a/include/grpc++/support/slice.h +++ b/include/grpc++/support/slice.h @@ -44,7 +44,7 @@ namespace grpc { /// A slice represents a contiguous reference counted array of bytes. /// It is cheap to take references to a slice, and it is cheap to create a /// slice pointing to a subset of another slice. -class Slice GRPC_FINAL { +class Slice final { public: /// Construct an empty slice. Slice(); diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc index fa72f9b0d97..755ca11d4e8 100644 --- a/src/compiler/cpp_generator.cc +++ b/src/compiler/cpp_generator.cc @@ -322,7 +322,7 @@ void PrintHeaderClientMethod(Printer *printer, const Method *method, printer->Print( *vars, "::grpc::Status $Method$(::grpc::ClientContext* context, " - "const $Request$& request, $Response$* response) GRPC_OVERRIDE;\n"); + "const $Request$& request, $Response$* response) override;\n"); printer->Print( *vars, "std::unique_ptr< ::grpc::ClientAsyncResponseReader< $Response$>> " @@ -417,37 +417,37 @@ void PrintHeaderClientMethod(Printer *printer, const Method *method, "::grpc::ClientAsyncResponseReader< $Response$>* " "Async$Method$Raw(::grpc::ClientContext* context, " "const $Request$& request, " - "::grpc::CompletionQueue* cq) GRPC_OVERRIDE;\n"); + "::grpc::CompletionQueue* cq) override;\n"); } else if (method->ClientOnlyStreaming()) { printer->Print(*vars, "::grpc::ClientWriter< $Request$>* $Method$Raw(" "::grpc::ClientContext* context, $Response$* response) " - "GRPC_OVERRIDE;\n"); + "override;\n"); printer->Print( *vars, "::grpc::ClientAsyncWriter< $Request$>* Async$Method$Raw(" "::grpc::ClientContext* context, $Response$* response, " - "::grpc::CompletionQueue* cq, void* tag) GRPC_OVERRIDE;\n"); + "::grpc::CompletionQueue* cq, void* tag) override;\n"); } else if (method->ServerOnlyStreaming()) { printer->Print(*vars, "::grpc::ClientReader< $Response$>* $Method$Raw(" "::grpc::ClientContext* context, const $Request$& request)" - " GRPC_OVERRIDE;\n"); + " override;\n"); printer->Print( *vars, "::grpc::ClientAsyncReader< $Response$>* Async$Method$Raw(" "::grpc::ClientContext* context, const $Request$& request, " - "::grpc::CompletionQueue* cq, void* tag) GRPC_OVERRIDE;\n"); + "::grpc::CompletionQueue* cq, void* tag) override;\n"); } else if (method->BidiStreaming()) { printer->Print( *vars, "::grpc::ClientReaderWriter< $Request$, $Response$>* " - "$Method$Raw(::grpc::ClientContext* context) GRPC_OVERRIDE;\n"); + "$Method$Raw(::grpc::ClientContext* context) override;\n"); printer->Print( *vars, "::grpc::ClientAsyncReaderWriter< $Request$, $Response$>* " "Async$Method$Raw(::grpc::ClientContext* context, " - "::grpc::CompletionQueue* cq, void* tag) GRPC_OVERRIDE;\n"); + "::grpc::CompletionQueue* cq, void* tag) override;\n"); } } } @@ -509,7 +509,7 @@ void PrintHeaderServerMethodAsync(Printer *printer, const Method *method, " ::grpc::Service::MarkMethodAsync($Idx$);\n" "}\n"); printer->Print(*vars, - "~WithAsyncMethod_$Method$() GRPC_OVERRIDE {\n" + "~WithAsyncMethod_$Method$() override {\n" " BaseClassMustBeDerivedFromService(this);\n" "}\n"); if (method->NoStreaming()) { @@ -518,7 +518,7 @@ void PrintHeaderServerMethodAsync(Printer *printer, const Method *method, "// disable synchronous version of this method\n" "::grpc::Status $Method$(" "::grpc::ServerContext* context, const $Request$* request, " - "$Response$* response) GRPC_FINAL GRPC_OVERRIDE {\n" + "$Response$* response) final override {\n" " abort();\n" " return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n" "}\n"); @@ -540,7 +540,7 @@ void PrintHeaderServerMethodAsync(Printer *printer, const Method *method, "::grpc::Status $Method$(" "::grpc::ServerContext* context, " "::grpc::ServerReader< $Request$>* reader, " - "$Response$* response) GRPC_FINAL GRPC_OVERRIDE {\n" + "$Response$* response) final override {\n" " abort();\n" " return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n" "}\n"); @@ -561,7 +561,7 @@ void PrintHeaderServerMethodAsync(Printer *printer, const Method *method, "// disable synchronous version of this method\n" "::grpc::Status $Method$(" "::grpc::ServerContext* context, const $Request$* request, " - "::grpc::ServerWriter< $Response$>* writer) GRPC_FINAL GRPC_OVERRIDE " + "::grpc::ServerWriter< $Response$>* writer) final override " "{\n" " abort();\n" " return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n" @@ -585,7 +585,7 @@ void PrintHeaderServerMethodAsync(Printer *printer, const Method *method, "::grpc::Status $Method$(" "::grpc::ServerContext* context, " "::grpc::ServerReaderWriter< $Response$, $Request$>* stream) " - "GRPC_FINAL GRPC_OVERRIDE {\n" + "final override {\n" " abort();\n" " return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n" "}\n"); @@ -632,7 +632,7 @@ void PrintHeaderServerMethodStreamedUnary( "std::placeholders::_2)));\n" "}\n"); printer->Print(*vars, - "~WithStreamedUnaryMethod_$Method$() GRPC_OVERRIDE {\n" + "~WithStreamedUnaryMethod_$Method$() override {\n" " BaseClassMustBeDerivedFromService(this);\n" "}\n"); printer->Print( @@ -640,7 +640,7 @@ void PrintHeaderServerMethodStreamedUnary( "// disable regular version of this method\n" "::grpc::Status $Method$(" "::grpc::ServerContext* context, const $Request$* request, " - "$Response$* response) GRPC_FINAL GRPC_OVERRIDE {\n" + "$Response$* response) final override {\n" " abort();\n" " return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n" "}\n"); @@ -683,7 +683,7 @@ void PrintHeaderServerMethodSplitStreaming( "std::placeholders::_2)));\n" "}\n"); printer->Print(*vars, - "~WithSplitStreamingMethod_$Method$() GRPC_OVERRIDE {\n" + "~WithSplitStreamingMethod_$Method$() override {\n" " BaseClassMustBeDerivedFromService(this);\n" "}\n"); printer->Print( @@ -691,7 +691,7 @@ void PrintHeaderServerMethodSplitStreaming( "// disable regular version of this method\n" "::grpc::Status $Method$(" "::grpc::ServerContext* context, const $Request$* request, " - "::grpc::ServerWriter< $Response$>* writer) GRPC_FINAL GRPC_OVERRIDE " + "::grpc::ServerWriter< $Response$>* writer) final override " "{\n" " abort();\n" " return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n" @@ -727,7 +727,7 @@ void PrintHeaderServerMethodGeneric( " ::grpc::Service::MarkMethodGeneric($Idx$);\n" "}\n"); printer->Print(*vars, - "~WithGenericMethod_$Method$() GRPC_OVERRIDE {\n" + "~WithGenericMethod_$Method$() override {\n" " BaseClassMustBeDerivedFromService(this);\n" "}\n"); if (method->NoStreaming()) { @@ -736,7 +736,7 @@ void PrintHeaderServerMethodGeneric( "// disable synchronous version of this method\n" "::grpc::Status $Method$(" "::grpc::ServerContext* context, const $Request$* request, " - "$Response$* response) GRPC_FINAL GRPC_OVERRIDE {\n" + "$Response$* response) final override {\n" " abort();\n" " return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n" "}\n"); @@ -747,7 +747,7 @@ void PrintHeaderServerMethodGeneric( "::grpc::Status $Method$(" "::grpc::ServerContext* context, " "::grpc::ServerReader< $Request$>* reader, " - "$Response$* response) GRPC_FINAL GRPC_OVERRIDE {\n" + "$Response$* response) final override {\n" " abort();\n" " return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n" "}\n"); @@ -757,7 +757,7 @@ void PrintHeaderServerMethodGeneric( "// disable synchronous version of this method\n" "::grpc::Status $Method$(" "::grpc::ServerContext* context, const $Request$* request, " - "::grpc::ServerWriter< $Response$>* writer) GRPC_FINAL GRPC_OVERRIDE " + "::grpc::ServerWriter< $Response$>* writer) final override " "{\n" " abort();\n" " return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n" @@ -769,7 +769,7 @@ void PrintHeaderServerMethodGeneric( "::grpc::Status $Method$(" "::grpc::ServerContext* context, " "::grpc::ServerReaderWriter< $Response$, $Request$>* stream) " - "GRPC_FINAL GRPC_OVERRIDE {\n" + "final override {\n" " abort();\n" " return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n" "}\n"); @@ -784,7 +784,7 @@ void PrintHeaderService(Printer *printer, const Service *service, printer->Print(service->GetLeadingComments().c_str()); printer->Print(*vars, - "class $Service$ GRPC_FINAL {\n" + "class $Service$ final {\n" " public:\n"); printer->Indent(); @@ -810,7 +810,7 @@ void PrintHeaderService(Printer *printer, const Service *service, printer->Outdent(); printer->Print("};\n"); printer->Print( - "class Stub GRPC_FINAL : public StubInterface" + "class Stub final : public StubInterface" " {\n public:\n"); printer->Indent(); printer->Print( diff --git a/src/cpp/client/channel_cc.cc b/src/cpp/client/channel_cc.cc index 43b3875cb3a..847c8c7dc05 100644 --- a/src/cpp/client/channel_cc.cc +++ b/src/cpp/client/channel_cc.cc @@ -106,11 +106,11 @@ grpc_connectivity_state Channel::GetState(bool try_to_connect) { } namespace { -class TagSaver GRPC_FINAL : public CompletionQueueTag { +class TagSaver final : public CompletionQueueTag { public: explicit TagSaver(void* tag) : tag_(tag) {} - ~TagSaver() GRPC_OVERRIDE {} - bool FinalizeResult(void** tag, bool* status) GRPC_OVERRIDE { + ~TagSaver() override {} + bool FinalizeResult(void** tag, bool* status) override { *tag = tag_; delete this; return true; diff --git a/src/cpp/client/client_context.cc b/src/cpp/client/client_context.cc index b6008f47b13..ca4515d9a19 100644 --- a/src/cpp/client/client_context.cc +++ b/src/cpp/client/client_context.cc @@ -45,12 +45,12 @@ namespace grpc { -class DefaultGlobalClientCallbacks GRPC_FINAL +class DefaultGlobalClientCallbacks final : public ClientContext::GlobalCallbacks { public: - ~DefaultGlobalClientCallbacks() GRPC_OVERRIDE {} - void DefaultConstructor(ClientContext* context) GRPC_OVERRIDE {} - void Destructor(ClientContext* context) GRPC_OVERRIDE {} + ~DefaultGlobalClientCallbacks() override {} + void DefaultConstructor(ClientContext* context) override {} + void Destructor(ClientContext* context) override {} }; static DefaultGlobalClientCallbacks g_default_client_callbacks; diff --git a/src/cpp/client/cronet_credentials.cc b/src/cpp/client/cronet_credentials.cc index 60cad097db5..26bbc24bd92 100644 --- a/src/cpp/client/cronet_credentials.cc +++ b/src/cpp/client/cronet_credentials.cc @@ -40,12 +40,12 @@ namespace grpc { -class CronetChannelCredentialsImpl GRPC_FINAL : public ChannelCredentials { +class CronetChannelCredentialsImpl final : public ChannelCredentials { public: CronetChannelCredentialsImpl(void* engine) : engine_(engine) {} std::shared_ptr CreateChannel( - const string& target, const grpc::ChannelArguments& args) GRPC_OVERRIDE { + const string& target, const grpc::ChannelArguments& args) override { grpc_channel_args channel_args; args.SetChannelArgs(&channel_args); return CreateChannelInternal( @@ -53,7 +53,7 @@ class CronetChannelCredentialsImpl GRPC_FINAL : public ChannelCredentials { &channel_args, nullptr)); } - SecureChannelCredentials* AsSecureCredentials() GRPC_OVERRIDE { + SecureChannelCredentials* AsSecureCredentials() override { return nullptr; } diff --git a/src/cpp/client/insecure_credentials.cc b/src/cpp/client/insecure_credentials.cc index 13019a71171..d73dadad24b 100644 --- a/src/cpp/client/insecure_credentials.cc +++ b/src/cpp/client/insecure_credentials.cc @@ -43,10 +43,10 @@ namespace grpc { namespace { -class InsecureChannelCredentialsImpl GRPC_FINAL : public ChannelCredentials { +class InsecureChannelCredentialsImpl final : public ChannelCredentials { public: std::shared_ptr CreateChannel( - const string& target, const grpc::ChannelArguments& args) GRPC_OVERRIDE { + const string& target, const grpc::ChannelArguments& args) override { grpc_channel_args channel_args; args.SetChannelArgs(&channel_args); return CreateChannelInternal( @@ -54,7 +54,7 @@ class InsecureChannelCredentialsImpl GRPC_FINAL : public ChannelCredentials { grpc_insecure_channel_create(target.c_str(), &channel_args, nullptr)); } - SecureChannelCredentials* AsSecureCredentials() GRPC_OVERRIDE { + SecureChannelCredentials* AsSecureCredentials() override { return nullptr; } }; diff --git a/src/cpp/client/secure_credentials.h b/src/cpp/client/secure_credentials.h index ae41ef80078..281db17e983 100644 --- a/src/cpp/client/secure_credentials.h +++ b/src/cpp/client/secure_credentials.h @@ -43,34 +43,34 @@ namespace grpc { -class SecureChannelCredentials GRPC_FINAL : public ChannelCredentials { +class SecureChannelCredentials final : public ChannelCredentials { public: explicit SecureChannelCredentials(grpc_channel_credentials* c_creds); ~SecureChannelCredentials() { grpc_channel_credentials_release(c_creds_); } grpc_channel_credentials* GetRawCreds() { return c_creds_; } std::shared_ptr CreateChannel( - const string& target, const grpc::ChannelArguments& args) GRPC_OVERRIDE; - SecureChannelCredentials* AsSecureCredentials() GRPC_OVERRIDE { return this; } + const string& target, const grpc::ChannelArguments& args) override; + SecureChannelCredentials* AsSecureCredentials() override { return this; } private: grpc_channel_credentials* const c_creds_; }; -class SecureCallCredentials GRPC_FINAL : public CallCredentials { +class SecureCallCredentials final : public CallCredentials { public: explicit SecureCallCredentials(grpc_call_credentials* c_creds); ~SecureCallCredentials() { grpc_call_credentials_release(c_creds_); } grpc_call_credentials* GetRawCreds() { return c_creds_; } - bool ApplyToCall(grpc_call* call) GRPC_OVERRIDE; - SecureCallCredentials* AsSecureCredentials() GRPC_OVERRIDE { return this; } + bool ApplyToCall(grpc_call* call) override; + SecureCallCredentials* AsSecureCredentials() override { return this; } private: grpc_call_credentials* const c_creds_; }; -class MetadataCredentialsPluginWrapper GRPC_FINAL { +class MetadataCredentialsPluginWrapper final { public: static void Destroy(void* wrapper); static void GetMetadata(void* wrapper, grpc_auth_metadata_context context, diff --git a/src/cpp/common/channel_filter.h b/src/cpp/common/channel_filter.h index ae32e02f699..fc0deff3b39 100644 --- a/src/cpp/common/channel_filter.h +++ b/src/cpp/common/channel_filter.h @@ -268,7 +268,7 @@ namespace internal { // Members of this class correspond to the members of the C // grpc_channel_filter struct. template -class ChannelFilter GRPC_FINAL { +class ChannelFilter final { public: static const size_t channel_data_size = sizeof(ChannelDataType); diff --git a/src/cpp/common/secure_auth_context.h b/src/cpp/common/secure_auth_context.h index c9f1dad1319..d6ad75c1c76 100644 --- a/src/cpp/common/secure_auth_context.h +++ b/src/cpp/common/secure_auth_context.h @@ -40,30 +40,30 @@ struct grpc_auth_context; namespace grpc { -class SecureAuthContext GRPC_FINAL : public AuthContext { +class SecureAuthContext final : public AuthContext { public: SecureAuthContext(grpc_auth_context* ctx, bool take_ownership); - ~SecureAuthContext() GRPC_OVERRIDE; + ~SecureAuthContext() override; - bool IsPeerAuthenticated() const GRPC_OVERRIDE; + bool IsPeerAuthenticated() const override; - std::vector GetPeerIdentity() const GRPC_OVERRIDE; + std::vector GetPeerIdentity() const override; - grpc::string GetPeerIdentityPropertyName() const GRPC_OVERRIDE; + grpc::string GetPeerIdentityPropertyName() const override; std::vector FindPropertyValues( - const grpc::string& name) const GRPC_OVERRIDE; + const grpc::string& name) const override; - AuthPropertyIterator begin() const GRPC_OVERRIDE; + AuthPropertyIterator begin() const override; - AuthPropertyIterator end() const GRPC_OVERRIDE; + AuthPropertyIterator end() const override; void AddProperty(const grpc::string& key, - const grpc::string_ref& value) GRPC_OVERRIDE; + const grpc::string_ref& value) override; virtual bool SetPeerIdentityPropertyName(const grpc::string& name) - GRPC_OVERRIDE; + override; private: grpc_auth_context* ctx_; diff --git a/src/cpp/ext/proto_server_reflection.h b/src/cpp/ext/proto_server_reflection.h index be5f062f9f1..ca0ba97d88f 100644 --- a/src/cpp/ext/proto_server_reflection.h +++ b/src/cpp/ext/proto_server_reflection.h @@ -42,7 +42,7 @@ namespace grpc { -class ProtoServerReflection GRPC_FINAL +class ProtoServerReflection final : public reflection::v1alpha::ServerReflection::Service { public: ProtoServerReflection(); @@ -56,7 +56,7 @@ class ProtoServerReflection GRPC_FINAL ServerContext* context, ServerReaderWriter* stream) - GRPC_OVERRIDE; + override; private: Status ListService(ServerContext* context, diff --git a/src/cpp/server/dynamic_thread_pool.h b/src/cpp/server/dynamic_thread_pool.h index 5ba7533c05f..61b1cc95857 100644 --- a/src/cpp/server/dynamic_thread_pool.h +++ b/src/cpp/server/dynamic_thread_pool.h @@ -46,12 +46,12 @@ namespace grpc { -class DynamicThreadPool GRPC_FINAL : public ThreadPoolInterface { +class DynamicThreadPool final : public ThreadPoolInterface { public: explicit DynamicThreadPool(int reserve_threads); ~DynamicThreadPool(); - void Add(const std::function& callback) GRPC_OVERRIDE; + void Add(const std::function& callback) override; private: class DynamicThread { diff --git a/src/cpp/server/insecure_server_credentials.cc b/src/cpp/server/insecure_server_credentials.cc index ef3cae5fd72..817d0b8bbd4 100644 --- a/src/cpp/server/insecure_server_credentials.cc +++ b/src/cpp/server/insecure_server_credentials.cc @@ -38,14 +38,14 @@ namespace grpc { namespace { -class InsecureServerCredentialsImpl GRPC_FINAL : public ServerCredentials { +class InsecureServerCredentialsImpl final : public ServerCredentials { public: int AddPortToServer(const grpc::string& addr, - grpc_server* server) GRPC_OVERRIDE { + grpc_server* server) override { return grpc_server_add_insecure_http2_port(server, addr.c_str()); } void SetAuthMetadataProcessor( - const std::shared_ptr& processor) GRPC_OVERRIDE { + const std::shared_ptr& processor) override { (void)processor; GPR_ASSERT(0); // Should not be called on InsecureServerCredentials. } diff --git a/src/cpp/server/secure_server_credentials.h b/src/cpp/server/secure_server_credentials.h index 5460f4a02c3..18b5fec4b73 100644 --- a/src/cpp/server/secure_server_credentials.h +++ b/src/cpp/server/secure_server_credentials.h @@ -44,7 +44,7 @@ namespace grpc { -class AuthMetadataProcessorAyncWrapper GRPC_FINAL { +class AuthMetadataProcessorAyncWrapper final { public: static void Destroy(void* wrapper); @@ -64,19 +64,19 @@ class AuthMetadataProcessorAyncWrapper GRPC_FINAL { std::shared_ptr processor_; }; -class SecureServerCredentials GRPC_FINAL : public ServerCredentials { +class SecureServerCredentials final : public ServerCredentials { public: explicit SecureServerCredentials(grpc_server_credentials* creds) : creds_(creds) {} - ~SecureServerCredentials() GRPC_OVERRIDE { + ~SecureServerCredentials() override { grpc_server_credentials_release(creds_); } int AddPortToServer(const grpc::string& addr, - grpc_server* server) GRPC_OVERRIDE; + grpc_server* server) override; void SetAuthMetadataProcessor( - const std::shared_ptr& processor) GRPC_OVERRIDE; + const std::shared_ptr& processor) override; private: grpc_server_credentials* creds_; diff --git a/src/cpp/server/server_cc.cc b/src/cpp/server/server_cc.cc index d46942d2573..7f32848e29e 100644 --- a/src/cpp/server/server_cc.cc +++ b/src/cpp/server/server_cc.cc @@ -55,11 +55,11 @@ namespace grpc { -class DefaultGlobalCallbacks GRPC_FINAL : public Server::GlobalCallbacks { +class DefaultGlobalCallbacks final : public Server::GlobalCallbacks { public: - ~DefaultGlobalCallbacks() GRPC_OVERRIDE {} - void PreSynchronousRequest(ServerContext* context) GRPC_OVERRIDE {} - void PostSynchronousRequest(ServerContext* context) GRPC_OVERRIDE {} + ~DefaultGlobalCallbacks() override {} + void PreSynchronousRequest(ServerContext* context) override {} + void PostSynchronousRequest(ServerContext* context) override {} }; static std::shared_ptr g_callbacks = nullptr; @@ -79,7 +79,7 @@ class Server::UnimplementedAsyncRequestContext { GenericServerAsyncReaderWriter generic_stream_; }; -class Server::UnimplementedAsyncRequest GRPC_FINAL +class Server::UnimplementedAsyncRequest final : public UnimplementedAsyncRequestContext, public GenericAsyncRequest { public: @@ -89,7 +89,7 @@ class Server::UnimplementedAsyncRequest GRPC_FINAL server_(server), cq_(cq) {} - bool FinalizeResult(void** tag, bool* status) GRPC_OVERRIDE; + bool FinalizeResult(void** tag, bool* status) override; ServerContext* context() { return &server_context_; } GenericServerAsyncReaderWriter* stream() { return &generic_stream_; } @@ -101,13 +101,13 @@ class Server::UnimplementedAsyncRequest GRPC_FINAL typedef SneakyCallOpSet UnimplementedAsyncResponseOp; -class Server::UnimplementedAsyncResponse GRPC_FINAL +class Server::UnimplementedAsyncResponse final : public UnimplementedAsyncResponseOp { public: UnimplementedAsyncResponse(UnimplementedAsyncRequest* request); ~UnimplementedAsyncResponse() { delete request_; } - bool FinalizeResult(void** tag, bool* status) GRPC_OVERRIDE { + bool FinalizeResult(void** tag, bool* status) override { bool r = UnimplementedAsyncResponseOp::FinalizeResult(tag, status); delete this; return r; @@ -122,7 +122,7 @@ class ShutdownTag : public CompletionQueueTag { bool FinalizeResult(void** tag, bool* status) { return false; } }; -class Server::SyncRequest GRPC_FINAL : public CompletionQueueTag { +class Server::SyncRequest final : public CompletionQueueTag { public: SyncRequest(RpcServiceMethod* method, void* tag) : method_(method), @@ -170,7 +170,7 @@ class Server::SyncRequest GRPC_FINAL : public CompletionQueueTag { } } - bool FinalizeResult(void** tag, bool* status) GRPC_OVERRIDE { + bool FinalizeResult(void** tag, bool* status) override { if (!*status) { grpc_completion_queue_destroy(cq_); } @@ -182,7 +182,7 @@ class Server::SyncRequest GRPC_FINAL : public CompletionQueueTag { return true; } - class CallData GRPC_FINAL { + class CallData final { public: explicit CallData(Server* server, SyncRequest* mrd) : cq_(mrd->cq_), @@ -255,7 +255,7 @@ class Server::SyncRequestThreadManager : public ThreadManager { cq_timeout_msec_(cq_timeout_msec), global_callbacks_(global_callbacks) {} - WorkStatus PollForWork(void** tag, bool* ok) GRPC_OVERRIDE { + WorkStatus PollForWork(void** tag, bool* ok) override { *tag = nullptr; gpr_timespec deadline = gpr_time_from_millis(cq_timeout_msec_, GPR_TIMESPAN); @@ -272,7 +272,7 @@ class Server::SyncRequestThreadManager : public ThreadManager { GPR_UNREACHABLE_CODE(return TIMEOUT); } - void DoWork(void* tag, bool ok) GRPC_OVERRIDE { + void DoWork(void* tag, bool ok) override { SyncRequest* sync_req = static_cast(tag); if (!sync_req) { diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index 1ca6a2b906e..559b5bf82ad 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -48,7 +48,7 @@ namespace grpc { // CompletionOp -class ServerContext::CompletionOp GRPC_FINAL : public CallOpSetInterface { +class ServerContext::CompletionOp final : public CallOpSetInterface { public: // initial refs: one in the server context, one in the cq CompletionOp() @@ -58,8 +58,8 @@ class ServerContext::CompletionOp GRPC_FINAL : public CallOpSetInterface { finalized_(false), cancelled_(0) {} - void FillOps(grpc_op* ops, size_t* nops) GRPC_OVERRIDE; - bool FinalizeResult(void** tag, bool* status) GRPC_OVERRIDE; + void FillOps(grpc_op* ops, size_t* nops) override; + bool FinalizeResult(void** tag, bool* status) override; bool CheckCancelled(CompletionQueue* cq) { cq->TryPluck(this); diff --git a/test/cpp/codegen/compiler_test_golden b/test/cpp/codegen/compiler_test_golden index 5f0e8246551..0b82f2a59f3 100644 --- a/test/cpp/codegen/compiler_test_golden +++ b/test/cpp/codegen/compiler_test_golden @@ -67,7 +67,7 @@ namespace testing { // ServiceA detached comment 2 // // ServiceA leading comment 1 -class ServiceA GRPC_FINAL { +class ServiceA final { public: class StubInterface { public: @@ -94,10 +94,10 @@ class ServiceA GRPC_FINAL { virtual ::grpc::ClientWriterInterface< ::grpc::testing::Request>* MethodA2Raw(::grpc::ClientContext* context, ::grpc::testing::Response* response) = 0; virtual ::grpc::ClientAsyncWriterInterface< ::grpc::testing::Request>* AsyncMethodA2Raw(::grpc::ClientContext* context, ::grpc::testing::Response* response, ::grpc::CompletionQueue* cq, void* tag) = 0; }; - class Stub GRPC_FINAL : public StubInterface { + class Stub final : public StubInterface { public: Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel); - ::grpc::Status MethodA1(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::testing::Response* response) GRPC_OVERRIDE; + ::grpc::Status MethodA1(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::testing::Response* response) override; std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::grpc::testing::Response>> AsyncMethodA1(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::CompletionQueue* cq) { return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::grpc::testing::Response>>(AsyncMethodA1Raw(context, request, cq)); } @@ -110,9 +110,9 @@ class ServiceA GRPC_FINAL { private: std::shared_ptr< ::grpc::ChannelInterface> channel_; - ::grpc::ClientAsyncResponseReader< ::grpc::testing::Response>* AsyncMethodA1Raw(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::CompletionQueue* cq) GRPC_OVERRIDE; - ::grpc::ClientWriter< ::grpc::testing::Request>* MethodA2Raw(::grpc::ClientContext* context, ::grpc::testing::Response* response) GRPC_OVERRIDE; - ::grpc::ClientAsyncWriter< ::grpc::testing::Request>* AsyncMethodA2Raw(::grpc::ClientContext* context, ::grpc::testing::Response* response, ::grpc::CompletionQueue* cq, void* tag) GRPC_OVERRIDE; + ::grpc::ClientAsyncResponseReader< ::grpc::testing::Response>* AsyncMethodA1Raw(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientWriter< ::grpc::testing::Request>* MethodA2Raw(::grpc::ClientContext* context, ::grpc::testing::Response* response) override; + ::grpc::ClientAsyncWriter< ::grpc::testing::Request>* AsyncMethodA2Raw(::grpc::ClientContext* context, ::grpc::testing::Response* response, ::grpc::CompletionQueue* cq, void* tag) override; const ::grpc::RpcMethod rpcmethod_MethodA1_; const ::grpc::RpcMethod rpcmethod_MethodA2_; }; @@ -140,11 +140,11 @@ class ServiceA GRPC_FINAL { WithAsyncMethod_MethodA1() { ::grpc::Service::MarkMethodAsync(0); } - ~WithAsyncMethod_MethodA1() GRPC_OVERRIDE { + ~WithAsyncMethod_MethodA1() override { BaseClassMustBeDerivedFromService(this); } // disable synchronous version of this method - ::grpc::Status MethodA1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response) GRPC_FINAL GRPC_OVERRIDE { + ::grpc::Status MethodA1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response) final override { abort(); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } @@ -160,11 +160,11 @@ class ServiceA GRPC_FINAL { WithAsyncMethod_MethodA2() { ::grpc::Service::MarkMethodAsync(1); } - ~WithAsyncMethod_MethodA2() GRPC_OVERRIDE { + ~WithAsyncMethod_MethodA2() override { BaseClassMustBeDerivedFromService(this); } // disable synchronous version of this method - ::grpc::Status MethodA2(::grpc::ServerContext* context, ::grpc::ServerReader< ::grpc::testing::Request>* reader, ::grpc::testing::Response* response) GRPC_FINAL GRPC_OVERRIDE { + ::grpc::Status MethodA2(::grpc::ServerContext* context, ::grpc::ServerReader< ::grpc::testing::Request>* reader, ::grpc::testing::Response* response) final override { abort(); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } @@ -181,11 +181,11 @@ class ServiceA GRPC_FINAL { WithGenericMethod_MethodA1() { ::grpc::Service::MarkMethodGeneric(0); } - ~WithGenericMethod_MethodA1() GRPC_OVERRIDE { + ~WithGenericMethod_MethodA1() override { BaseClassMustBeDerivedFromService(this); } // disable synchronous version of this method - ::grpc::Status MethodA1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response) GRPC_FINAL GRPC_OVERRIDE { + ::grpc::Status MethodA1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response) final override { abort(); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } @@ -198,11 +198,11 @@ class ServiceA GRPC_FINAL { WithGenericMethod_MethodA2() { ::grpc::Service::MarkMethodGeneric(1); } - ~WithGenericMethod_MethodA2() GRPC_OVERRIDE { + ~WithGenericMethod_MethodA2() override { BaseClassMustBeDerivedFromService(this); } // disable synchronous version of this method - ::grpc::Status MethodA2(::grpc::ServerContext* context, ::grpc::ServerReader< ::grpc::testing::Request>* reader, ::grpc::testing::Response* response) GRPC_FINAL GRPC_OVERRIDE { + ::grpc::Status MethodA2(::grpc::ServerContext* context, ::grpc::ServerReader< ::grpc::testing::Request>* reader, ::grpc::testing::Response* response) final override { abort(); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } @@ -216,11 +216,11 @@ class ServiceA GRPC_FINAL { ::grpc::Service::MarkMethodStreamed(0, new ::grpc::StreamedUnaryHandler< ::grpc::testing::Request, ::grpc::testing::Response>(std::bind(&WithStreamedUnaryMethod_MethodA1::StreamedMethodA1, this, std::placeholders::_1, std::placeholders::_2))); } - ~WithStreamedUnaryMethod_MethodA1() GRPC_OVERRIDE { + ~WithStreamedUnaryMethod_MethodA1() override { BaseClassMustBeDerivedFromService(this); } // disable regular version of this method - ::grpc::Status MethodA1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response) GRPC_FINAL GRPC_OVERRIDE { + ::grpc::Status MethodA1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response) final override { abort(); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } @@ -233,7 +233,7 @@ class ServiceA GRPC_FINAL { }; // ServiceB leading comment 1 -class ServiceB GRPC_FINAL { +class ServiceB final { public: class StubInterface { public: @@ -247,17 +247,17 @@ class ServiceB GRPC_FINAL { private: virtual ::grpc::ClientAsyncResponseReaderInterface< ::grpc::testing::Response>* AsyncMethodB1Raw(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::CompletionQueue* cq) = 0; }; - class Stub GRPC_FINAL : public StubInterface { + class Stub final : public StubInterface { public: Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel); - ::grpc::Status MethodB1(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::testing::Response* response) GRPC_OVERRIDE; + ::grpc::Status MethodB1(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::testing::Response* response) override; std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::grpc::testing::Response>> AsyncMethodB1(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::CompletionQueue* cq) { return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::grpc::testing::Response>>(AsyncMethodB1Raw(context, request, cq)); } private: std::shared_ptr< ::grpc::ChannelInterface> channel_; - ::grpc::ClientAsyncResponseReader< ::grpc::testing::Response>* AsyncMethodB1Raw(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::CompletionQueue* cq) GRPC_OVERRIDE; + ::grpc::ClientAsyncResponseReader< ::grpc::testing::Response>* AsyncMethodB1Raw(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::CompletionQueue* cq) override; const ::grpc::RpcMethod rpcmethod_MethodB1_; }; static std::unique_ptr NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions()); @@ -278,11 +278,11 @@ class ServiceB GRPC_FINAL { WithAsyncMethod_MethodB1() { ::grpc::Service::MarkMethodAsync(0); } - ~WithAsyncMethod_MethodB1() GRPC_OVERRIDE { + ~WithAsyncMethod_MethodB1() override { BaseClassMustBeDerivedFromService(this); } // disable synchronous version of this method - ::grpc::Status MethodB1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response) GRPC_FINAL GRPC_OVERRIDE { + ::grpc::Status MethodB1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response) final override { abort(); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } @@ -299,11 +299,11 @@ class ServiceB GRPC_FINAL { WithGenericMethod_MethodB1() { ::grpc::Service::MarkMethodGeneric(0); } - ~WithGenericMethod_MethodB1() GRPC_OVERRIDE { + ~WithGenericMethod_MethodB1() override { BaseClassMustBeDerivedFromService(this); } // disable synchronous version of this method - ::grpc::Status MethodB1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response) GRPC_FINAL GRPC_OVERRIDE { + ::grpc::Status MethodB1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response) final override { abort(); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } @@ -317,11 +317,11 @@ class ServiceB GRPC_FINAL { ::grpc::Service::MarkMethodStreamed(0, new ::grpc::StreamedUnaryHandler< ::grpc::testing::Request, ::grpc::testing::Response>(std::bind(&WithStreamedUnaryMethod_MethodB1::StreamedMethodB1, this, std::placeholders::_1, std::placeholders::_2))); } - ~WithStreamedUnaryMethod_MethodB1() GRPC_OVERRIDE { + ~WithStreamedUnaryMethod_MethodB1() override { BaseClassMustBeDerivedFromService(this); } // disable regular version of this method - ::grpc::Status MethodB1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response) GRPC_FINAL GRPC_OVERRIDE { + ::grpc::Status MethodB1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response) final override { abort(); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } diff --git a/test/cpp/common/auth_property_iterator_test.cc b/test/cpp/common/auth_property_iterator_test.cc index 66225ff335c..16bebcab740 100644 --- a/test/cpp/common/auth_property_iterator_test.cc +++ b/test/cpp/common/auth_property_iterator_test.cc @@ -56,7 +56,7 @@ class TestAuthPropertyIterator : public AuthPropertyIterator { class AuthPropertyIteratorTest : public ::testing::Test { protected: - void SetUp() GRPC_OVERRIDE { + void SetUp() override { ctx_ = grpc_auth_context_create(NULL); grpc_auth_context_add_cstring_property(ctx_, "name", "chapi"); grpc_auth_context_add_cstring_property(ctx_, "name", "chapo"); @@ -64,7 +64,7 @@ class AuthPropertyIteratorTest : public ::testing::Test { EXPECT_EQ(1, grpc_auth_context_set_peer_identity_property_name(ctx_, "name")); } - void TearDown() GRPC_OVERRIDE { grpc_auth_context_release(ctx_); } + void TearDown() override { grpc_auth_context_release(ctx_); } grpc_auth_context* ctx_; }; diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index 823f0bd0358..ab314a0dbb2 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -211,10 +211,10 @@ bool plugin_has_sync_methods(std::unique_ptr& plugin) { // that needs to be tested here. class ServerBuilderSyncPluginDisabler : public ::grpc::ServerBuilderOption { public: - void UpdateArguments(ChannelArguments* arg) GRPC_OVERRIDE {} + void UpdateArguments(ChannelArguments* arg) override {} void UpdatePlugins(std::vector>* plugins) - GRPC_OVERRIDE { + override { plugins->erase(std::remove_if(plugins->begin(), plugins->end(), plugin_has_sync_methods), plugins->end()); @@ -246,7 +246,7 @@ class AsyncEnd2endTest : public ::testing::TestWithParam { protected: AsyncEnd2endTest() { GetParam().Log(); } - void SetUp() GRPC_OVERRIDE { + void SetUp() override { poll_overrider_.reset(new PollingOverrider(!GetParam().disable_blocking)); port_ = grpc_pick_unused_port_or_die(); @@ -269,7 +269,7 @@ class AsyncEnd2endTest : public ::testing::TestWithParam { gpr_tls_set(&g_is_async_end2end_test, 1); } - void TearDown() GRPC_OVERRIDE { + void TearDown() override { server_->Shutdown(); void* ignored_tag; bool ignored_ok; diff --git a/test/cpp/end2end/client_crash_test_server.cc b/test/cpp/end2end/client_crash_test_server.cc index 6e1457407c1..e971accd22f 100644 --- a/test/cpp/end2end/client_crash_test_server.cc +++ b/test/cpp/end2end/client_crash_test_server.cc @@ -58,11 +58,11 @@ using namespace gflags; namespace grpc { namespace testing { -class ServiceImpl GRPC_FINAL +class ServiceImpl final : public ::grpc::testing::EchoTestService::Service { Status BidiStream(ServerContext* context, ServerReaderWriter* stream) - GRPC_OVERRIDE { + override { EchoRequest request; EchoResponse response; while (stream->Read(&request)) { diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index 43b7d44255e..29806faa945 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -92,12 +92,12 @@ class TestMetadataCredentialsPlugin : public MetadataCredentialsPlugin { is_blocking_(is_blocking), is_successful_(is_successful) {} - bool IsBlocking() const GRPC_OVERRIDE { return is_blocking_; } + bool IsBlocking() const override { return is_blocking_; } Status GetMetadata(grpc::string_ref service_url, grpc::string_ref method_name, const grpc::AuthContext& channel_auth_context, std::multimap* metadata) - GRPC_OVERRIDE { + override { EXPECT_GT(service_url.length(), 0UL); EXPECT_GT(method_name.length(), 0UL); EXPECT_TRUE(channel_auth_context.IsPeerAuthenticated()); @@ -145,11 +145,11 @@ class TestAuthMetadataProcessor : public AuthMetadataProcessor { } // Interface implementation - bool IsBlocking() const GRPC_OVERRIDE { return is_blocking_; } + bool IsBlocking() const override { return is_blocking_; } Status Process(const InputMetadata& auth_metadata, AuthContext* context, OutputMetadata* consumed_auth_metadata, - OutputMetadata* response_metadata) GRPC_OVERRIDE { + OutputMetadata* response_metadata) override { EXPECT_TRUE(consumed_auth_metadata != nullptr); EXPECT_TRUE(context != nullptr); EXPECT_TRUE(response_metadata != nullptr); @@ -185,7 +185,7 @@ class Proxy : public ::grpc::testing::EchoTestService::Service { : stub_(grpc::testing::EchoTestService::NewStub(channel)) {} Status Echo(ServerContext* server_context, const EchoRequest* request, - EchoResponse* response) GRPC_OVERRIDE { + EchoResponse* response) override { std::unique_ptr client_context = ClientContext::FromServerContext(*server_context); return stub_->Echo(client_context.get(), *request, response); @@ -199,7 +199,7 @@ class TestServiceImplDupPkg : public ::grpc::testing::duplicate::EchoTestService::Service { public: Status Echo(ServerContext* context, const EchoRequest* request, - EchoResponse* response) GRPC_OVERRIDE { + EchoResponse* response) override { response->set_message("no package"); return Status::OK; } @@ -229,7 +229,7 @@ class End2endTest : public ::testing::TestWithParam { GetParam().Log(); } - void TearDown() GRPC_OVERRIDE { + void TearDown() override { if (is_server_started_) { server_->Shutdown(); if (proxy_server_) proxy_server_->Shutdown(); @@ -1496,7 +1496,7 @@ class ResourceQuotaEnd2endTest : public End2endTest { ResourceQuotaEnd2endTest() : server_resource_quota_("server_resource_quota") {} - virtual void ConfigureServerBuilder(ServerBuilder* builder) GRPC_OVERRIDE { + virtual void ConfigureServerBuilder(ServerBuilder* builder) override { builder->SetResourceQuota(server_resource_quota_); } diff --git a/test/cpp/end2end/filter_end2end_test.cc b/test/cpp/end2end/filter_end2end_test.cc index 853720fd0d0..588cabcd42a 100644 --- a/test/cpp/end2end/filter_end2end_test.cc +++ b/test/cpp/end2end/filter_end2end_test.cc @@ -126,7 +126,7 @@ class CallDataImpl : public CallData { : CallData(channel_data) {} void StartTransportStreamOp(grpc_exec_ctx* exec_ctx, grpc_call_element* elem, - TransportStreamOp* op) GRPC_OVERRIDE { + TransportStreamOp* op) override { // Incrementing the counter could be done from the ctor, but we want // to test that the individual methods are actually called correctly. if (op->recv_initial_metadata() != nullptr) IncrementCallCounter(); @@ -138,7 +138,7 @@ class FilterEnd2endTest : public ::testing::Test { protected: FilterEnd2endTest() : server_host_("localhost") {} - void SetUp() GRPC_OVERRIDE { + void SetUp() override { int port = grpc_pick_unused_port_or_die(); server_address_ << server_host_ << ":" << port; // Setup server @@ -150,7 +150,7 @@ class FilterEnd2endTest : public ::testing::Test { server_ = builder.BuildAndStart(); } - void TearDown() GRPC_OVERRIDE { + void TearDown() override { server_->Shutdown(); void* ignored_tag; bool ignored_ok; diff --git a/test/cpp/end2end/generic_end2end_test.cc b/test/cpp/end2end/generic_end2end_test.cc index 57efa5fa17f..25c221bb2b0 100644 --- a/test/cpp/end2end/generic_end2end_test.cc +++ b/test/cpp/end2end/generic_end2end_test.cc @@ -75,7 +75,7 @@ class GenericEnd2endTest : public ::testing::Test { protected: GenericEnd2endTest() : server_host_("localhost") {} - void SetUp() GRPC_OVERRIDE { + void SetUp() override { int port = grpc_pick_unused_port_or_die(); server_address_ << server_host_ << ":" << port; // Setup server @@ -91,7 +91,7 @@ class GenericEnd2endTest : public ::testing::Test { server_ = builder.BuildAndStart(); } - void TearDown() GRPC_OVERRIDE { + void TearDown() override { server_->Shutdown(); void* ignored_tag; bool ignored_ok; diff --git a/test/cpp/end2end/hybrid_end2end_test.cc b/test/cpp/end2end/hybrid_end2end_test.cc index 76a5732f338..d769d41384b 100644 --- a/test/cpp/end2end/hybrid_end2end_test.cc +++ b/test/cpp/end2end/hybrid_end2end_test.cc @@ -188,7 +188,7 @@ class TestServiceImplDupPkg : public ::grpc::testing::duplicate::EchoTestService::Service { public: Status Echo(ServerContext* context, const EchoRequest* request, - EchoResponse* response) GRPC_OVERRIDE { + EchoResponse* response) override { response->set_message(request->message() + "_dup"); return Status::OK; } @@ -230,7 +230,7 @@ class HybridEnd2endTest : public ::testing::Test { server_ = builder.BuildAndStart(); } - void TearDown() GRPC_OVERRIDE { + void TearDown() override { if (server_) { server_->Shutdown(); } @@ -451,7 +451,7 @@ class StreamedUnaryDupPkg public: Status StreamedEcho(ServerContext* context, ServerUnaryStreamer* stream) - GRPC_OVERRIDE { + override { EchoRequest req; EchoResponse resp; uint32_t next_msg_sz; @@ -489,7 +489,7 @@ class FullyStreamedUnaryDupPkg public: Status StreamedEcho(ServerContext* context, ServerUnaryStreamer* stream) - GRPC_OVERRIDE { + override { EchoRequest req; EchoResponse resp; uint32_t next_msg_sz; @@ -528,7 +528,7 @@ class SplitResponseStreamDupPkg public: Status StreamedResponseStream( ServerContext* context, - ServerSplitStreamer* stream) GRPC_OVERRIDE { + ServerSplitStreamer* stream) override { EchoRequest req; EchoResponse resp; uint32_t next_msg_sz; @@ -568,7 +568,7 @@ class FullySplitStreamedDupPkg public: Status StreamedResponseStream( ServerContext* context, - ServerSplitStreamer* stream) GRPC_OVERRIDE { + ServerSplitStreamer* stream) override { EchoRequest req; EchoResponse resp; uint32_t next_msg_sz; @@ -607,7 +607,7 @@ class FullyStreamedDupPkg : public duplicate::EchoTestService::StreamedService { public: Status StreamedEcho(ServerContext* context, ServerUnaryStreamer* stream) - GRPC_OVERRIDE { + override { EchoRequest req; EchoResponse resp; uint32_t next_msg_sz; @@ -620,7 +620,7 @@ class FullyStreamedDupPkg : public duplicate::EchoTestService::StreamedService { } Status StreamedResponseStream( ServerContext* context, - ServerSplitStreamer* stream) GRPC_OVERRIDE { + ServerSplitStreamer* stream) override { EchoRequest req; EchoResponse resp; uint32_t next_msg_sz; diff --git a/test/cpp/end2end/mock_test.cc b/test/cpp/end2end/mock_test.cc index 0da5861b67d..5e9cb823ae4 100644 --- a/test/cpp/end2end/mock_test.cc +++ b/test/cpp/end2end/mock_test.cc @@ -61,46 +61,46 @@ namespace testing { namespace { template -class MockClientReaderWriter GRPC_FINAL +class MockClientReaderWriter final : public ClientReaderWriterInterface { public: - void WaitForInitialMetadata() GRPC_OVERRIDE {} - bool NextMessageSize(uint32_t* sz) GRPC_OVERRIDE { + void WaitForInitialMetadata() override {} + bool NextMessageSize(uint32_t* sz) override { *sz = UINT_MAX; return true; } - bool Read(R* msg) GRPC_OVERRIDE { return true; } - bool Write(const W& msg) GRPC_OVERRIDE { return true; } - bool WritesDone() GRPC_OVERRIDE { return true; } - Status Finish() GRPC_OVERRIDE { return Status::OK; } + bool Read(R* msg) override { return true; } + bool Write(const W& msg) override { return true; } + bool WritesDone() override { return true; } + Status Finish() override { return Status::OK; } }; template <> -class MockClientReaderWriter GRPC_FINAL +class MockClientReaderWriter final : public ClientReaderWriterInterface { public: MockClientReaderWriter() : writes_done_(false) {} - void WaitForInitialMetadata() GRPC_OVERRIDE {} - bool NextMessageSize(uint32_t* sz) GRPC_OVERRIDE { + void WaitForInitialMetadata() override {} + bool NextMessageSize(uint32_t* sz) override { *sz = UINT_MAX; return true; } - bool Read(EchoResponse* msg) GRPC_OVERRIDE { + bool Read(EchoResponse* msg) override { if (writes_done_) return false; msg->set_message(last_message_); return true; } bool Write(const EchoRequest& msg, - const WriteOptions& options) GRPC_OVERRIDE { + const WriteOptions& options) override { gpr_log(GPR_INFO, "mock recv msg %s", msg.message().c_str()); last_message_ = msg.message(); return true; } - bool WritesDone() GRPC_OVERRIDE { + bool WritesDone() override { writes_done_ = true; return true; } - Status Finish() GRPC_OVERRIDE { return Status::OK; } + Status Finish() override { return Status::OK; } private: bool writes_done_; @@ -113,51 +113,51 @@ class MockStub : public EchoTestService::StubInterface { MockStub() {} ~MockStub() {} Status Echo(ClientContext* context, const EchoRequest& request, - EchoResponse* response) GRPC_OVERRIDE { + EchoResponse* response) override { response->set_message(request.message()); return Status::OK; } Status Unimplemented(ClientContext* context, const EchoRequest& request, - EchoResponse* response) GRPC_OVERRIDE { + EchoResponse* response) override { return Status::OK; } private: ClientAsyncResponseReaderInterface* AsyncEchoRaw( ClientContext* context, const EchoRequest& request, - CompletionQueue* cq) GRPC_OVERRIDE { + CompletionQueue* cq) override { return nullptr; } ClientWriterInterface* RequestStreamRaw( - ClientContext* context, EchoResponse* response) GRPC_OVERRIDE { + ClientContext* context, EchoResponse* response) override { return nullptr; } ClientAsyncWriterInterface* AsyncRequestStreamRaw( ClientContext* context, EchoResponse* response, CompletionQueue* cq, - void* tag) GRPC_OVERRIDE { + void* tag) override { return nullptr; } ClientReaderInterface* ResponseStreamRaw( - ClientContext* context, const EchoRequest& request) GRPC_OVERRIDE { + ClientContext* context, const EchoRequest& request) override { return nullptr; } ClientAsyncReaderInterface* AsyncResponseStreamRaw( ClientContext* context, const EchoRequest& request, CompletionQueue* cq, - void* tag) GRPC_OVERRIDE { + void* tag) override { return nullptr; } ClientReaderWriterInterface* BidiStreamRaw( - ClientContext* context) GRPC_OVERRIDE { + ClientContext* context) override { return new MockClientReaderWriter(); } ClientAsyncReaderWriterInterface* AsyncBidiStreamRaw(ClientContext* context, CompletionQueue* cq, - void* tag) GRPC_OVERRIDE { + void* tag) override { return nullptr; } ClientAsyncResponseReaderInterface* AsyncUnimplementedRaw( ClientContext* context, const EchoRequest& request, - CompletionQueue* cq) GRPC_OVERRIDE { + CompletionQueue* cq) override { return nullptr; } }; @@ -216,14 +216,14 @@ class FakeClient { class TestServiceImpl : public EchoTestService::Service { public: Status Echo(ServerContext* context, const EchoRequest* request, - EchoResponse* response) GRPC_OVERRIDE { + EchoResponse* response) override { response->set_message(request->message()); return Status::OK; } Status BidiStream(ServerContext* context, ServerReaderWriter* stream) - GRPC_OVERRIDE { + override { EchoRequest request; EchoResponse response; while (stream->Read(&request)) { @@ -239,7 +239,7 @@ class MockTest : public ::testing::Test { protected: MockTest() {} - void SetUp() GRPC_OVERRIDE { + void SetUp() override { int port = grpc_pick_unused_port_or_die(); server_address_ << "localhost:" << port; // Setup server @@ -250,7 +250,7 @@ class MockTest : public ::testing::Test { server_ = builder.BuildAndStart(); } - void TearDown() GRPC_OVERRIDE { server_->Shutdown(); } + void TearDown() override { server_->Shutdown(); } void ResetStub() { std::shared_ptr channel = diff --git a/test/cpp/end2end/proto_server_reflection_test.cc b/test/cpp/end2end/proto_server_reflection_test.cc index 75efd01f066..8b9688d2003 100644 --- a/test/cpp/end2end/proto_server_reflection_test.cc +++ b/test/cpp/end2end/proto_server_reflection_test.cc @@ -56,7 +56,7 @@ class ProtoServerReflectionTest : public ::testing::Test { public: ProtoServerReflectionTest() {} - void SetUp() GRPC_OVERRIDE { + void SetUp() override { port_ = grpc_pick_unused_port_or_die(); ref_desc_pool_ = protobuf::DescriptorPool::generated_pool(); diff --git a/test/cpp/end2end/server_builder_plugin_test.cc b/test/cpp/end2end/server_builder_plugin_test.cc index b967a5d1e99..06b56469aeb 100644 --- a/test/cpp/end2end/server_builder_plugin_test.cc +++ b/test/cpp/end2end/server_builder_plugin_test.cc @@ -65,29 +65,29 @@ class TestServerBuilderPlugin : public ServerBuilderPlugin { register_service_ = false; } - grpc::string name() GRPC_OVERRIDE { return PLUGIN_NAME; } + grpc::string name() override { return PLUGIN_NAME; } - void InitServer(ServerInitializer* si) GRPC_OVERRIDE { + void InitServer(ServerInitializer* si) override { init_server_is_called_ = true; if (register_service_) { si->RegisterService(service_); } } - void Finish(ServerInitializer* si) GRPC_OVERRIDE { finish_is_called_ = true; } + void Finish(ServerInitializer* si) override { finish_is_called_ = true; } - void ChangeArguments(const grpc::string& name, void* value) GRPC_OVERRIDE { + void ChangeArguments(const grpc::string& name, void* value) override { change_arguments_is_called_ = true; } - bool has_async_methods() const GRPC_OVERRIDE { + bool has_async_methods() const override { if (register_service_) { return service_->has_async_methods(); } return false; } - bool has_sync_methods() const GRPC_OVERRIDE { + bool has_sync_methods() const override { if (register_service_) { return service_->has_synchronous_methods(); } @@ -112,10 +112,10 @@ class InsertPluginServerBuilderOption : public ServerBuilderOption { public: InsertPluginServerBuilderOption() { register_service_ = false; } - void UpdateArguments(ChannelArguments* arg) GRPC_OVERRIDE {} + void UpdateArguments(ChannelArguments* arg) override {} void UpdatePlugins(std::vector>* plugins) - GRPC_OVERRIDE { + override { plugins->clear(); std::unique_ptr plugin( @@ -154,7 +154,7 @@ class ServerBuilderPluginTest : public ::testing::TestWithParam { public: ServerBuilderPluginTest() {} - void SetUp() GRPC_OVERRIDE { + void SetUp() override { port_ = grpc_pick_unused_port_or_die(); builder_.reset(new ServerBuilder()); } @@ -202,7 +202,7 @@ class ServerBuilderPluginTest : public ::testing::TestWithParam { stub_ = grpc::testing::EchoTestService::NewStub(channel_); } - void TearDown() GRPC_OVERRIDE { + void TearDown() override { auto plugin = CheckPresent(); EXPECT_TRUE(plugin); EXPECT_TRUE(plugin->init_server_is_called()); diff --git a/test/cpp/end2end/server_crash_test.cc b/test/cpp/end2end/server_crash_test.cc index 16a5fa23222..9e70dc36f25 100644 --- a/test/cpp/end2end/server_crash_test.cc +++ b/test/cpp/end2end/server_crash_test.cc @@ -60,14 +60,14 @@ namespace testing { namespace { -class ServiceImpl GRPC_FINAL +class ServiceImpl final : public ::grpc::testing::EchoTestService::Service { public: ServiceImpl() : bidi_stream_count_(0), response_stream_count_(0) {} Status BidiStream(ServerContext* context, ServerReaderWriter* stream) - GRPC_OVERRIDE { + override { bidi_stream_count_++; EchoRequest request; EchoResponse response; @@ -82,7 +82,7 @@ class ServiceImpl GRPC_FINAL } Status ResponseStream(ServerContext* context, const EchoRequest* request, - ServerWriter* writer) GRPC_OVERRIDE { + ServerWriter* writer) override { EchoResponse response; response_stream_count_++; for (int i = 0;; i++) { diff --git a/test/cpp/end2end/shutdown_test.cc b/test/cpp/end2end/shutdown_test.cc index 4cba3b1c814..5b52b1fc1aa 100644 --- a/test/cpp/end2end/shutdown_test.cc +++ b/test/cpp/end2end/shutdown_test.cc @@ -61,7 +61,7 @@ class TestServiceImpl : public ::grpc::testing::EchoTestService::Service { explicit TestServiceImpl(gpr_event* ev) : ev_(ev) {} Status Echo(ServerContext* context, const EchoRequest* request, - EchoResponse* response) GRPC_OVERRIDE { + EchoResponse* response) override { gpr_event_set(ev_, (void*)1); while (!context->IsCancelled()) { } @@ -76,7 +76,7 @@ class ShutdownTest : public ::testing::Test { public: ShutdownTest() : shutdown_(false), service_(&ev_) { gpr_event_init(&ev_); } - void SetUp() GRPC_OVERRIDE { + void SetUp() override { port_ = grpc_pick_unused_port_or_die(); server_ = SetUpServer(port_); } @@ -91,7 +91,7 @@ class ShutdownTest : public ::testing::Test { return server; } - void TearDown() GRPC_OVERRIDE { GPR_ASSERT(shutdown_); } + void TearDown() override { GPR_ASSERT(shutdown_); } void ResetStub() { string target = "dns:localhost:" + to_string(port_); diff --git a/test/cpp/end2end/streaming_throughput_test.cc b/test/cpp/end2end/streaming_throughput_test.cc index fbef761ca9c..3cbd77fb653 100644 --- a/test/cpp/end2end/streaming_throughput_test.cc +++ b/test/cpp/end2end/streaming_throughput_test.cc @@ -123,7 +123,7 @@ class TestServiceImpl : public ::grpc::testing::EchoTestService::Service { // Only implement the one method we will be calling for brevity. Status BidiStream(ServerContext* context, ServerReaderWriter* stream) - GRPC_OVERRIDE { + override { EchoRequest request; gpr_atm should_exit; gpr_atm_rel_store(&should_exit, static_cast(0)); @@ -147,7 +147,7 @@ class TestServiceImpl : public ::grpc::testing::EchoTestService::Service { class End2endTest : public ::testing::Test { protected: - void SetUp() GRPC_OVERRIDE { + void SetUp() override { int port = grpc_pick_unused_port_or_die(); server_address_ << "localhost:" << port; // Setup server @@ -158,7 +158,7 @@ class End2endTest : public ::testing::Test { server_ = builder.BuildAndStart(); } - void TearDown() GRPC_OVERRIDE { server_->Shutdown(); } + void TearDown() override { server_->Shutdown(); } void ResetStub() { std::shared_ptr channel = diff --git a/test/cpp/end2end/test_service_impl.h b/test/cpp/end2end/test_service_impl.h index c89f88c900e..ee240649720 100644 --- a/test/cpp/end2end/test_service_impl.h +++ b/test/cpp/end2end/test_service_impl.h @@ -63,20 +63,20 @@ class TestServiceImpl : public ::grpc::testing::EchoTestService::Service { : signal_client_(false), host_(new grpc::string(host)) {} Status Echo(ServerContext* context, const EchoRequest* request, - EchoResponse* response) GRPC_OVERRIDE; + EchoResponse* response) override; // Unimplemented is left unimplemented to test the returned error. Status RequestStream(ServerContext* context, ServerReader* reader, - EchoResponse* response) GRPC_OVERRIDE; + EchoResponse* response) override; Status ResponseStream(ServerContext* context, const EchoRequest* request, - ServerWriter* writer) GRPC_OVERRIDE; + ServerWriter* writer) override; Status BidiStream(ServerContext* context, ServerReaderWriter* stream) - GRPC_OVERRIDE; + override; bool signal_client() { std::unique_lock lock(mu_); diff --git a/test/cpp/end2end/thread_stress_test.cc b/test/cpp/end2end/thread_stress_test.cc index 0b9d4cda9f4..9239198780a 100644 --- a/test/cpp/end2end/thread_stress_test.cc +++ b/test/cpp/end2end/thread_stress_test.cc @@ -86,7 +86,7 @@ class TestServiceImpl : public ::grpc::testing::EchoTestService::Service { TestServiceImpl() : signal_client_(false) {} Status Echo(ServerContext* context, const EchoRequest* request, - EchoResponse* response) GRPC_OVERRIDE { + EchoResponse* response) override { response->set_message(request->message()); MaybeEchoDeadline(context, request, response); if (request->has_param() && request->param().client_cancel_after_us()) { @@ -118,7 +118,7 @@ class TestServiceImpl : public ::grpc::testing::EchoTestService::Service { Status RequestStream(ServerContext* context, ServerReader* reader, - EchoResponse* response) GRPC_OVERRIDE { + EchoResponse* response) override { EchoRequest request; response->set_message(""); while (reader->Read(&request)) { @@ -130,7 +130,7 @@ class TestServiceImpl : public ::grpc::testing::EchoTestService::Service { // Return 3 messages. // TODO(yangg) make it generic by adding a parameter into EchoRequest Status ResponseStream(ServerContext* context, const EchoRequest* request, - ServerWriter* writer) GRPC_OVERRIDE { + ServerWriter* writer) override { EchoResponse response; response.set_message(request->message() + "0"); writer->Write(response); @@ -144,7 +144,7 @@ class TestServiceImpl : public ::grpc::testing::EchoTestService::Service { Status BidiStream(ServerContext* context, ServerReaderWriter* stream) - GRPC_OVERRIDE { + override { EchoRequest request; EchoResponse response; while (stream->Read(&request)) { @@ -169,7 +169,7 @@ class TestServiceImplDupPkg : public ::grpc::testing::duplicate::EchoTestService::Service { public: Status Echo(ServerContext* context, const EchoRequest* request, - EchoResponse* response) GRPC_OVERRIDE { + EchoResponse* response) override { response->set_message("no package"); return Status::OK; } @@ -215,12 +215,12 @@ class CommonStressTest { class CommonStressTestSyncServer : public CommonStressTest { public: - void SetUp() GRPC_OVERRIDE { + void SetUp() override { ServerBuilder builder; SetUpStart(&builder, &service_); SetUpEnd(&builder); } - void TearDown() GRPC_OVERRIDE { + void TearDown() override { TearDownStart(); TearDownEnd(); } @@ -232,7 +232,7 @@ class CommonStressTestSyncServer : public CommonStressTest { class CommonStressTestAsyncServer : public CommonStressTest { public: - void SetUp() GRPC_OVERRIDE { + void SetUp() override { shutting_down_ = false; ServerBuilder builder; SetUpStart(&builder, &service_); @@ -247,7 +247,7 @@ class CommonStressTestAsyncServer new std::thread(&CommonStressTestAsyncServer::ProcessRpcs, this)); } } - void TearDown() GRPC_OVERRIDE { + void TearDown() override { { unique_lock l(mu_); TearDownStart(); @@ -323,8 +323,8 @@ template class End2endTest : public ::testing::Test { protected: End2endTest() {} - void SetUp() GRPC_OVERRIDE { common_.SetUp(); } - void TearDown() GRPC_OVERRIDE { common_.TearDown(); } + void SetUp() override { common_.SetUp(); } + void TearDown() override { common_.TearDown(); } void ResetStub() { common_.ResetStub(); } Common common_; @@ -369,8 +369,8 @@ class AsyncClientEnd2endTest : public ::testing::Test { protected: AsyncClientEnd2endTest() : rpcs_outstanding_(0) {} - void SetUp() GRPC_OVERRIDE { common_.SetUp(); } - void TearDown() GRPC_OVERRIDE { + void SetUp() override { common_.SetUp(); } + void TearDown() override { void* ignored_tag; bool ignored_ok; while (cq_.Next(&ignored_tag, &ignored_ok)) diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h index 9983c8a7b08..a8d125ad281 100644 --- a/test/cpp/qps/client.h +++ b/test/cpp/qps/client.h @@ -113,7 +113,7 @@ class ClientRequestCreator { } }; -class HistogramEntry GRPC_FINAL { +class HistogramEntry final { public: HistogramEntry() : value_used_(false), status_used_(false) {} bool value_used() const { return value_used_; } diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc index 4d36a6ba423..de8a3956739 100644 --- a/test/cpp/qps/client_async.cc +++ b/test/cpp/qps/client_async.cc @@ -93,8 +93,8 @@ class ClientRpcContextUnaryImpl : public ClientRpcContext { callback_(on_done), next_issue_(next_issue), start_req_(start_req) {} - ~ClientRpcContextUnaryImpl() GRPC_OVERRIDE {} - void Start(CompletionQueue* cq) GRPC_OVERRIDE { + ~ClientRpcContextUnaryImpl() override {} + void Start(CompletionQueue* cq) override { cq_ = cq; if (!next_issue_) { // ready to issue RunNextState(true, nullptr); @@ -102,7 +102,7 @@ class ClientRpcContextUnaryImpl : public ClientRpcContext { alarm_.reset(new Alarm(cq_, next_issue_(), ClientRpcContext::tag(this))); } } - bool RunNextState(bool ok, HistogramEntry* entry) GRPC_OVERRIDE { + bool RunNextState(bool ok, HistogramEntry* entry) override { switch (next_state_) { case State::READY: start_ = UsageTimer::Now(); @@ -121,7 +121,7 @@ class ClientRpcContextUnaryImpl : public ClientRpcContext { return false; } } - ClientRpcContext* StartNewClone() GRPC_OVERRIDE { + ClientRpcContext* StartNewClone() override { return new ClientRpcContextUnaryImpl(stub_, req_, next_issue_, start_req_, callback_); } @@ -217,7 +217,7 @@ class AsyncClient : public ClientImpl { } return num_threads; } - void DestroyMultithreading() GRPC_OVERRIDE GRPC_FINAL { + void DestroyMultithreading() override final { for (auto ss = shutdown_state_.begin(); ss != shutdown_state_.end(); ++ss) { std::lock_guard lock((*ss)->mutex); (*ss)->shutdown = true; @@ -229,7 +229,7 @@ class AsyncClient : public ClientImpl { } bool ThreadFunc(HistogramEntry* entry, - size_t thread_idx) GRPC_OVERRIDE GRPC_FINAL { + size_t thread_idx) override final { void* got_tag; bool ok; @@ -279,7 +279,7 @@ static std::unique_ptr BenchmarkStubCreator( return BenchmarkService::NewStub(ch); } -class AsyncUnaryClient GRPC_FINAL +class AsyncUnaryClient final : public AsyncClient { public: explicit AsyncUnaryClient(const ClientConfig& config) @@ -287,7 +287,7 @@ class AsyncUnaryClient GRPC_FINAL config, SetupCtx, BenchmarkStubCreator) { StartThreads(num_async_threads_); } - ~AsyncUnaryClient() GRPC_OVERRIDE {} + ~AsyncUnaryClient() override {} private: static void CheckDone(grpc::Status s, SimpleResponse* response, @@ -329,13 +329,13 @@ class ClientRpcContextStreamingImpl : public ClientRpcContext { callback_(on_done), next_issue_(next_issue), start_req_(start_req) {} - ~ClientRpcContextStreamingImpl() GRPC_OVERRIDE {} - void Start(CompletionQueue* cq) GRPC_OVERRIDE { + ~ClientRpcContextStreamingImpl() override {} + void Start(CompletionQueue* cq) override { cq_ = cq; stream_ = start_req_(stub_, &context_, cq, ClientRpcContext::tag(this)); next_state_ = State::STREAM_IDLE; } - bool RunNextState(bool ok, HistogramEntry* entry) GRPC_OVERRIDE { + bool RunNextState(bool ok, HistogramEntry* entry) override { while (true) { switch (next_state_) { case State::STREAM_IDLE: @@ -377,7 +377,7 @@ class ClientRpcContextStreamingImpl : public ClientRpcContext { } } } - ClientRpcContext* StartNewClone() GRPC_OVERRIDE { + ClientRpcContext* StartNewClone() override { return new ClientRpcContextStreamingImpl(stub_, req_, next_issue_, start_req_, callback_); } @@ -410,7 +410,7 @@ class ClientRpcContextStreamingImpl : public ClientRpcContext { stream_; }; -class AsyncStreamingClient GRPC_FINAL +class AsyncStreamingClient final : public AsyncClient { public: explicit AsyncStreamingClient(const ClientConfig& config) @@ -419,7 +419,7 @@ class AsyncStreamingClient GRPC_FINAL StartThreads(num_async_threads_); } - ~AsyncStreamingClient() GRPC_OVERRIDE {} + ~AsyncStreamingClient() override {} private: static void CheckDone(grpc::Status s, SimpleResponse* response) {} @@ -458,8 +458,8 @@ class ClientRpcContextGenericStreamingImpl : public ClientRpcContext { callback_(on_done), next_issue_(next_issue), start_req_(start_req) {} - ~ClientRpcContextGenericStreamingImpl() GRPC_OVERRIDE {} - void Start(CompletionQueue* cq) GRPC_OVERRIDE { + ~ClientRpcContextGenericStreamingImpl() override {} + void Start(CompletionQueue* cq) override { cq_ = cq; const grpc::string kMethodName( "/grpc.testing.BenchmarkService/StreamingCall"); @@ -467,7 +467,7 @@ class ClientRpcContextGenericStreamingImpl : public ClientRpcContext { ClientRpcContext::tag(this)); next_state_ = State::STREAM_IDLE; } - bool RunNextState(bool ok, HistogramEntry* entry) GRPC_OVERRIDE { + bool RunNextState(bool ok, HistogramEntry* entry) override { while (true) { switch (next_state_) { case State::STREAM_IDLE: @@ -509,7 +509,7 @@ class ClientRpcContextGenericStreamingImpl : public ClientRpcContext { } } } - ClientRpcContext* StartNewClone() GRPC_OVERRIDE { + ClientRpcContext* StartNewClone() override { return new ClientRpcContextGenericStreamingImpl(stub_, req_, next_issue_, start_req_, callback_); } @@ -546,7 +546,7 @@ static std::unique_ptr GenericStubCreator( return std::unique_ptr(new grpc::GenericStub(ch)); } -class GenericAsyncStreamingClient GRPC_FINAL +class GenericAsyncStreamingClient final : public AsyncClient { public: explicit GenericAsyncStreamingClient(const ClientConfig& config) @@ -555,7 +555,7 @@ class GenericAsyncStreamingClient GRPC_FINAL StartThreads(num_async_threads_); } - ~GenericAsyncStreamingClient() GRPC_OVERRIDE {} + ~GenericAsyncStreamingClient() override {} private: static void CheckDone(grpc::Status s, ByteBuffer* response) {} diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc index f61e80d76be..a88a24d89cc 100644 --- a/test/cpp/qps/client_sync.cc +++ b/test/cpp/qps/client_sync.cc @@ -108,10 +108,10 @@ class SynchronousClient std::vector responses_; private: - void DestroyMultithreading() GRPC_OVERRIDE GRPC_FINAL { EndThreads(); } + void DestroyMultithreading() override final { EndThreads(); } }; -class SynchronousUnaryClient GRPC_FINAL : public SynchronousClient { +class SynchronousUnaryClient final : public SynchronousClient { public: SynchronousUnaryClient(const ClientConfig& config) : SynchronousClient(config) { @@ -119,7 +119,7 @@ class SynchronousUnaryClient GRPC_FINAL : public SynchronousClient { } ~SynchronousUnaryClient() {} - bool ThreadFunc(HistogramEntry* entry, size_t thread_idx) GRPC_OVERRIDE { + bool ThreadFunc(HistogramEntry* entry, size_t thread_idx) override { if (!WaitToIssue(thread_idx)) { return true; } @@ -135,7 +135,7 @@ class SynchronousUnaryClient GRPC_FINAL : public SynchronousClient { } }; -class SynchronousStreamingClient GRPC_FINAL : public SynchronousClient { +class SynchronousStreamingClient final : public SynchronousClient { public: SynchronousStreamingClient(const ClientConfig& config) : SynchronousClient(config) { @@ -165,7 +165,7 @@ class SynchronousStreamingClient GRPC_FINAL : public SynchronousClient { delete[] context_; } - bool ThreadFunc(HistogramEntry* entry, size_t thread_idx) GRPC_OVERRIDE { + bool ThreadFunc(HistogramEntry* entry, size_t thread_idx) override { if (!WaitToIssue(thread_idx)) { return true; } diff --git a/test/cpp/qps/gen_build_yaml.py b/test/cpp/qps/gen_build_yaml.py old mode 100755 new mode 100644 diff --git a/test/cpp/qps/interarrival.h b/test/cpp/qps/interarrival.h index 0980d5e8baa..4bef06f566e 100644 --- a/test/cpp/qps/interarrival.h +++ b/test/cpp/qps/interarrival.h @@ -69,11 +69,11 @@ inline RandomDistInterface::~RandomDistInterface() {} // independent identical stationary sources. For more information, // see http://en.wikipedia.org/wiki/Exponential_distribution -class ExpDist GRPC_FINAL : public RandomDistInterface { +class ExpDist final : public RandomDistInterface { public: explicit ExpDist(double lambda) : lambda_recip_(1.0 / lambda) {} - ~ExpDist() GRPC_OVERRIDE {} - double transform(double uni) const GRPC_OVERRIDE { + ~ExpDist() override {} + double transform(double uni) const override { // Note: Use 1.0-uni above to avoid NaN if uni is 0 return lambda_recip_ * (-log(1.0 - uni)); } diff --git a/test/cpp/qps/qps_worker.cc b/test/cpp/qps/qps_worker.cc index d3e53fe14a6..0efd92cb9dc 100644 --- a/test/cpp/qps/qps_worker.cc +++ b/test/cpp/qps/qps_worker.cc @@ -100,7 +100,7 @@ static std::unique_ptr CreateServer(const ServerConfig& config) { abort(); } -class ScopedProfile GRPC_FINAL { +class ScopedProfile final { public: ScopedProfile(const char* filename, bool enable) : enable_(enable) { if (enable_) grpc_profiler_start(filename); @@ -113,14 +113,14 @@ class ScopedProfile GRPC_FINAL { const bool enable_; }; -class WorkerServiceImpl GRPC_FINAL : public WorkerService::Service { +class WorkerServiceImpl final : public WorkerService::Service { public: WorkerServiceImpl(int server_port, QpsWorker* worker) : acquired_(false), server_port_(server_port), worker_(worker) {} Status RunClient(ServerContext* ctx, ServerReaderWriter* stream) - GRPC_OVERRIDE { + override { InstanceGuard g(this); if (!g.Acquired()) { return Status(StatusCode::RESOURCE_EXHAUSTED, "Client worker busy"); @@ -134,7 +134,7 @@ class WorkerServiceImpl GRPC_FINAL : public WorkerService::Service { Status RunServer(ServerContext* ctx, ServerReaderWriter* stream) - GRPC_OVERRIDE { + override { InstanceGuard g(this); if (!g.Acquired()) { return Status(StatusCode::RESOURCE_EXHAUSTED, "Server worker busy"); @@ -147,12 +147,12 @@ class WorkerServiceImpl GRPC_FINAL : public WorkerService::Service { } Status CoreCount(ServerContext* ctx, const CoreRequest*, - CoreResponse* resp) GRPC_OVERRIDE { + CoreResponse* resp) override { resp->set_cores(gpr_cpu_num_cores()); return Status::OK; } - Status QuitWorker(ServerContext* ctx, const Void*, Void*) GRPC_OVERRIDE { + Status QuitWorker(ServerContext* ctx, const Void*, Void*) override { InstanceGuard g(this); if (!g.Acquired()) { return Status(StatusCode::RESOURCE_EXHAUSTED, "Quitting worker busy"); diff --git a/test/cpp/qps/report.h b/test/cpp/qps/report.h index 39cf498e7b2..9dc259e95a7 100644 --- a/test/cpp/qps/report.h +++ b/test/cpp/qps/report.h @@ -82,10 +82,10 @@ class CompositeReporter : public Reporter { /** Adds a \a reporter to the composite. */ void add(std::unique_ptr reporter); - void ReportQPS(const ScenarioResult& result) GRPC_OVERRIDE; - void ReportQPSPerCore(const ScenarioResult& result) GRPC_OVERRIDE; - void ReportLatency(const ScenarioResult& result) GRPC_OVERRIDE; - void ReportTimes(const ScenarioResult& result) GRPC_OVERRIDE; + void ReportQPS(const ScenarioResult& result) override; + void ReportQPSPerCore(const ScenarioResult& result) override; + void ReportLatency(const ScenarioResult& result) override; + void ReportTimes(const ScenarioResult& result) override; private: std::vector > reporters_; @@ -97,10 +97,10 @@ class GprLogReporter : public Reporter { GprLogReporter(const string& name) : Reporter(name) {} private: - void ReportQPS(const ScenarioResult& result) GRPC_OVERRIDE; - void ReportQPSPerCore(const ScenarioResult& result) GRPC_OVERRIDE; - void ReportLatency(const ScenarioResult& result) GRPC_OVERRIDE; - void ReportTimes(const ScenarioResult& result) GRPC_OVERRIDE; + void ReportQPS(const ScenarioResult& result) override; + void ReportQPSPerCore(const ScenarioResult& result) override; + void ReportLatency(const ScenarioResult& result) override; + void ReportTimes(const ScenarioResult& result) override; }; /** Dumps the report to a JSON file. */ @@ -110,10 +110,10 @@ class JsonReporter : public Reporter { : Reporter(name), report_file_(report_file) {} private: - void ReportQPS(const ScenarioResult& result) GRPC_OVERRIDE; - void ReportQPSPerCore(const ScenarioResult& result) GRPC_OVERRIDE; - void ReportLatency(const ScenarioResult& result) GRPC_OVERRIDE; - void ReportTimes(const ScenarioResult& result) GRPC_OVERRIDE; + void ReportQPS(const ScenarioResult& result) override; + void ReportQPSPerCore(const ScenarioResult& result) override; + void ReportLatency(const ScenarioResult& result) override; + void ReportTimes(const ScenarioResult& result) override; const string report_file_; }; diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc index bc4c896d83a..d5662f7ee64 100644 --- a/test/cpp/qps/server_async.cc +++ b/test/cpp/qps/server_async.cc @@ -58,7 +58,7 @@ namespace testing { template -class AsyncQpsServerTest GRPC_FINAL : public grpc::testing::Server { +class AsyncQpsServerTest final : public grpc::testing::Server { public: AsyncQpsServerTest( const ServerConfig &config, @@ -196,7 +196,7 @@ class AsyncQpsServerTest GRPC_FINAL : public grpc::testing::Server { return reinterpret_cast(tag); } - class ServerRpcContextUnaryImpl GRPC_FINAL : public ServerRpcContext { + class ServerRpcContextUnaryImpl final : public ServerRpcContext { public: ServerRpcContextUnaryImpl( std::function*next_state_)(ok); } - void Reset() GRPC_OVERRIDE { + void Reset() override { srv_ctx_.reset(new ServerContextType); req_ = RequestType(); response_writer_ = @@ -257,7 +257,7 @@ class AsyncQpsServerTest GRPC_FINAL : public grpc::testing::Server { grpc::ServerAsyncResponseWriter response_writer_; }; - class ServerRpcContextStreamingImpl GRPC_FINAL : public ServerRpcContext { + class ServerRpcContextStreamingImpl final : public ServerRpcContext { public: ServerRpcContextStreamingImpl( std::function*next_state_)(ok); } - void Reset() GRPC_OVERRIDE { + void Reset() override { srv_ctx_.reset(new ServerContextType); req_ = RequestType(); stream_ = grpc::ServerAsyncReaderWriter( diff --git a/test/cpp/qps/server_sync.cc b/test/cpp/qps/server_sync.cc index 07f48e26447..8076a4a6b9a 100644 --- a/test/cpp/qps/server_sync.cc +++ b/test/cpp/qps/server_sync.cc @@ -48,10 +48,10 @@ namespace grpc { namespace testing { -class BenchmarkServiceImpl GRPC_FINAL : public BenchmarkService::Service { +class BenchmarkServiceImpl final : public BenchmarkService::Service { public: Status UnaryCall(ServerContext* context, const SimpleRequest* request, - SimpleResponse* response) GRPC_OVERRIDE { + SimpleResponse* response) override { if (request->response_size() > 0) { if (!Server::SetPayload(request->response_type(), request->response_size(), @@ -63,7 +63,7 @@ class BenchmarkServiceImpl GRPC_FINAL : public BenchmarkService::Service { } Status StreamingCall( ServerContext* context, - ServerReaderWriter* stream) GRPC_OVERRIDE { + ServerReaderWriter* stream) override { SimpleRequest request; while (stream->Read(&request)) { SimpleResponse response; @@ -80,7 +80,7 @@ class BenchmarkServiceImpl GRPC_FINAL : public BenchmarkService::Service { } }; -class SynchronousServer GRPC_FINAL : public grpc::testing::Server { +class SynchronousServer final : public grpc::testing::Server { public: explicit SynchronousServer(const ServerConfig& config) : Server(config) { ServerBuilder builder; diff --git a/test/cpp/thread_manager/thread_manager_test.cc b/test/cpp/thread_manager/thread_manager_test.cc index 5c70103947d..43c17c85b8c 100644 --- a/test/cpp/thread_manager/thread_manager_test.cc +++ b/test/cpp/thread_manager/thread_manager_test.cc @@ -43,7 +43,7 @@ #include "test/cpp/util/test_config.h" namespace grpc { -class ThreadManagerTest GRPC_FINAL : public grpc::ThreadManager { +class ThreadManagerTest final : public grpc::ThreadManager { public: ThreadManagerTest() : ThreadManager(kMinPollers, kMaxPollers), @@ -52,8 +52,8 @@ class ThreadManagerTest GRPC_FINAL : public grpc::ThreadManager { num_work_found_(0) {} grpc::ThreadManager::WorkStatus PollForWork(void **tag, - bool *ok) GRPC_OVERRIDE; - void DoWork(void *tag, bool ok) GRPC_OVERRIDE; + bool *ok) override; + void DoWork(void *tag, bool ok) override; void PerformTest(); private: diff --git a/test/cpp/util/cli_call.h b/test/cpp/util/cli_call.h index 2fbc9618b64..65da86bd4e7 100644 --- a/test/cpp/util/cli_call.h +++ b/test/cpp/util/cli_call.h @@ -43,7 +43,7 @@ namespace grpc { namespace testing { -class CliCall GRPC_FINAL { +class CliCall final { public: typedef std::multimap OutgoingMetadataContainer; typedef std::multimap diff --git a/test/cpp/util/cli_call_test.cc b/test/cpp/util/cli_call_test.cc index 75e90f824f5..2e8501b2c3a 100644 --- a/test/cpp/util/cli_call_test.cc +++ b/test/cpp/util/cli_call_test.cc @@ -56,7 +56,7 @@ namespace testing { class TestServiceImpl : public ::grpc::testing::EchoTestService::Service { public: Status Echo(ServerContext* context, const EchoRequest* request, - EchoResponse* response) GRPC_OVERRIDE { + EchoResponse* response) override { if (!context->client_metadata().empty()) { for (std::multimap::const_iterator iter = context->client_metadata().begin(); @@ -75,7 +75,7 @@ class CliCallTest : public ::testing::Test { protected: CliCallTest() {} - void SetUp() GRPC_OVERRIDE { + void SetUp() override { int port = grpc_pick_unused_port_or_die(); server_address_ << "localhost:" << port; // Setup server @@ -86,7 +86,7 @@ class CliCallTest : public ::testing::Test { server_ = builder.BuildAndStart(); } - void TearDown() GRPC_OVERRIDE { server_->Shutdown(); } + void TearDown() override { server_->Shutdown(); } void ResetStub() { channel_ = diff --git a/test/cpp/util/grpc_tool_test.cc b/test/cpp/util/grpc_tool_test.cc index bad1579f11e..1699d689ab7 100644 --- a/test/cpp/util/grpc_tool_test.cc +++ b/test/cpp/util/grpc_tool_test.cc @@ -93,13 +93,13 @@ DECLARE_bool(l); namespace { -class TestCliCredentials GRPC_FINAL : public grpc::testing::CliCredentials { +class TestCliCredentials final : public grpc::testing::CliCredentials { public: std::shared_ptr GetCredentials() const - GRPC_OVERRIDE { + override { return InsecureChannelCredentials(); } - const grpc::string GetCredentialUsage() const GRPC_OVERRIDE { return ""; } + const grpc::string GetCredentialUsage() const override { return ""; } }; bool PrintStream(std::stringstream* ss, const grpc::string& output) { @@ -118,7 +118,7 @@ size_t ArraySize(T& a) { class TestServiceImpl : public ::grpc::testing::EchoTestService::Service { public: Status Echo(ServerContext* context, const EchoRequest* request, - EchoResponse* response) GRPC_OVERRIDE { + EchoResponse* response) override { if (!context->client_metadata().empty()) { for (std::multimap::const_iterator iter = context->client_metadata().begin(); diff --git a/test/cpp/util/metrics_server.h b/test/cpp/util/metrics_server.h index aa9bfed23d8..4f1e393a637 100644 --- a/test/cpp/util/metrics_server.h +++ b/test/cpp/util/metrics_server.h @@ -83,13 +83,13 @@ class QpsGauge { std::mutex num_queries_mu_; }; -class MetricsServiceImpl GRPC_FINAL : public MetricsService::Service { +class MetricsServiceImpl final : public MetricsService::Service { public: grpc::Status GetAllGauges(ServerContext* context, const EmptyMessage* request, - ServerWriter* writer) GRPC_OVERRIDE; + ServerWriter* writer) override; grpc::Status GetGauge(ServerContext* context, const GaugeRequest* request, - GaugeResponse* response) GRPC_OVERRIDE; + GaugeResponse* response) override; // Create a QpsGauge with name 'name'. is_present is set to true if the Gauge // is already present in the map. diff --git a/test/cpp/util/proto_file_parser.cc b/test/cpp/util/proto_file_parser.cc index 98dd3f14ad4..3e524227e5c 100644 --- a/test/cpp/util/proto_file_parser.cc +++ b/test/cpp/util/proto_file_parser.cc @@ -61,7 +61,7 @@ class ErrorPrinter : public protobuf::compiler::MultiFileErrorCollector { explicit ErrorPrinter(ProtoFileParser* parser) : parser_(parser) {} void AddError(const grpc::string& filename, int line, int column, - const grpc::string& message) GRPC_OVERRIDE { + const grpc::string& message) override { std::ostringstream oss; oss << "error " << filename << " " << line << " " << column << " " << message << "\n"; @@ -69,7 +69,7 @@ class ErrorPrinter : public protobuf::compiler::MultiFileErrorCollector { } void AddWarning(const grpc::string& filename, int line, int column, - const grpc::string& message) GRPC_OVERRIDE { + const grpc::string& message) override { std::cerr << "warning " << filename << " " << line << " " << column << " " << message << std::endl; } diff --git a/test/cpp/util/proto_reflection_descriptor_database.h b/test/cpp/util/proto_reflection_descriptor_database.h index 4637c043f11..0aa32c33935 100644 --- a/test/cpp/util/proto_reflection_descriptor_database.h +++ b/test/cpp/util/proto_reflection_descriptor_database.h @@ -62,14 +62,14 @@ class ProtoReflectionDescriptorDatabase : public protobuf::DescriptorDatabase { // Find a file by file name. Fills in in *output and returns true if found. // Otherwise, returns false, leaving the contents of *output undefined. bool FindFileByName(const string& filename, - protobuf::FileDescriptorProto* output) GRPC_OVERRIDE; + protobuf::FileDescriptorProto* output) override; // Find the file that declares the given fully-qualified symbol name. // If found, fills in *output and returns true, otherwise returns false // and leaves *output undefined. bool FindFileContainingSymbol(const string& symbol_name, protobuf::FileDescriptorProto* output) - GRPC_OVERRIDE; + override; // Find the file which defines an extension extending the given message type // with the given field number. If found, fills in *output and returns true, @@ -77,7 +77,7 @@ class ProtoReflectionDescriptorDatabase : public protobuf::DescriptorDatabase { // must be a fully-qualified type name. bool FindFileContainingExtension( const string& containing_type, int field_number, - protobuf::FileDescriptorProto* output) GRPC_OVERRIDE; + protobuf::FileDescriptorProto* output) override; // Finds the tag numbers used by all known extensions of // extendee_type, and appends them to output in an undefined @@ -87,7 +87,7 @@ class ProtoReflectionDescriptorDatabase : public protobuf::DescriptorDatabase { // numbers. Returns true if the search was successful, otherwise // returns false and leaves output unchanged. bool FindAllExtensionNumbers(const string& extendee_type, - std::vector* output) GRPC_OVERRIDE; + std::vector* output) override; // Provide a list of full names of registered services bool GetServices(std::vector* output); diff --git a/test/cpp/util/test_credentials_provider.cc b/test/cpp/util/test_credentials_provider.cc index ca15f29795a..df03fabeca3 100644 --- a/test/cpp/util/test_credentials_provider.cc +++ b/test/cpp/util/test_credentials_provider.cc @@ -64,11 +64,11 @@ class CredentialsProvider { class DefaultCredentialsProvider : public CredentialsProvider { public: - ~DefaultCredentialsProvider() GRPC_OVERRIDE {} + ~DefaultCredentialsProvider() override {} void AddSecureType(const grpc::string& type, std::unique_ptr type_provider) - GRPC_OVERRIDE { + override { // This clobbers any existing entry for type, except the defaults, which // can't be clobbered. grpc::unique_lock lock(mu_); @@ -84,7 +84,7 @@ class DefaultCredentialsProvider : public CredentialsProvider { } std::shared_ptr GetChannelCredentials( - const grpc::string& type, ChannelArguments* args) GRPC_OVERRIDE { + const grpc::string& type, ChannelArguments* args) override { if (type == grpc::testing::kInsecureCredentialsType) { return InsecureChannelCredentials(); } else if (type == grpc::testing::kTlsCredentialsType) { @@ -105,7 +105,7 @@ class DefaultCredentialsProvider : public CredentialsProvider { } std::shared_ptr GetServerCredentials( - const grpc::string& type) GRPC_OVERRIDE { + const grpc::string& type) override { if (type == grpc::testing::kInsecureCredentialsType) { return InsecureServerCredentials(); } else if (type == grpc::testing::kTlsCredentialsType) { @@ -127,7 +127,7 @@ class DefaultCredentialsProvider : public CredentialsProvider { ->GetServerCredentials(); } } - std::vector GetSecureCredentialsTypeList() GRPC_OVERRIDE { + std::vector GetSecureCredentialsTypeList() override { std::vector types; types.push_back(grpc::testing::kTlsCredentialsType); grpc::unique_lock lock(mu_); From 713c7b87e11e57ad2a4188a3a127719c38eb998c Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Tue, 1 Nov 2016 16:33:18 -0700 Subject: [PATCH 10/20] clang-format --- include/grpc++/channel.h | 6 ++--- .../grpc++/impl/codegen/async_unary_call.h | 3 +-- include/grpc++/impl/codegen/core_codegen.h | 13 ++++------ include/grpc++/server.h | 3 +-- src/compiler/cpp_generator.cc | 25 ++++++++----------- src/cpp/client/cronet_credentials.cc | 4 +-- src/cpp/client/insecure_credentials.cc | 4 +-- src/cpp/common/secure_auth_context.h | 3 +-- src/cpp/server/insecure_server_credentials.cc | 3 +-- src/cpp/server/secure_server_credentials.h | 3 +-- test/cpp/end2end/async_end2end_test.cc | 4 +-- test/cpp/end2end/client_crash_test_server.cc | 9 +++---- test/cpp/end2end/end2end_test.cc | 8 +++--- test/cpp/end2end/hybrid_end2end_test.cc | 18 ++++++------- test/cpp/end2end/mock_test.cc | 12 ++++----- .../cpp/end2end/server_builder_plugin_test.cc | 4 +-- test/cpp/end2end/server_crash_test.cc | 9 +++---- test/cpp/end2end/streaming_throughput_test.cc | 6 ++--- test/cpp/end2end/test_service_impl.h | 6 ++--- test/cpp/end2end/thread_stress_test.cc | 6 ++--- test/cpp/qps/client_async.cc | 3 +-- test/cpp/qps/qps_worker.cc | 12 ++++----- test/cpp/qps/server_async.cc | 8 ++---- .../cpp/thread_manager/thread_manager_test.cc | 3 +-- test/cpp/util/grpc_tool_test.cc | 3 +-- .../proto_reflection_descriptor_database.h | 3 +-- test/cpp/util/test_credentials_provider.cc | 6 ++--- 27 files changed, 80 insertions(+), 107 deletions(-) diff --git a/include/grpc++/channel.h b/include/grpc++/channel.h index aa492a7c2b2..c8360282e7b 100644 --- a/include/grpc++/channel.h +++ b/include/grpc++/channel.h @@ -47,9 +47,9 @@ struct grpc_channel; namespace grpc { /// Channels represent a connection to an endpoint. Created by \a CreateChannel. class Channel final : public ChannelInterface, - public CallHook, - public std::enable_shared_from_this, - private GrpcLibraryCodegen { + public CallHook, + public std::enable_shared_from_this, + private GrpcLibraryCodegen { public: ~Channel(); diff --git a/include/grpc++/impl/codegen/async_unary_call.h b/include/grpc++/impl/codegen/async_unary_call.h index ba2c6ceee9e..b77a16b699f 100644 --- a/include/grpc++/impl/codegen/async_unary_call.h +++ b/include/grpc++/impl/codegen/async_unary_call.h @@ -113,8 +113,7 @@ class ClientAsyncResponseReader final }; template -class ServerAsyncResponseWriter final - : public ServerAsyncStreamingInterface { +class ServerAsyncResponseWriter final : public ServerAsyncStreamingInterface { public: explicit ServerAsyncResponseWriter(ServerContext* ctx) : call_(nullptr, nullptr, nullptr), ctx_(ctx) {} diff --git a/include/grpc++/impl/codegen/core_codegen.h b/include/grpc++/impl/codegen/core_codegen.h index 8d845c40809..aff88ffa074 100644 --- a/include/grpc++/impl/codegen/core_codegen.h +++ b/include/grpc++/impl/codegen/core_codegen.h @@ -45,8 +45,7 @@ namespace grpc { /// Implementation of the core codegen interface. class CoreCodegen : public CoreCodegenInterface { private: - grpc_completion_queue* grpc_completion_queue_create(void* reserved) - override; + grpc_completion_queue* grpc_completion_queue_create(void* reserved) override; void grpc_completion_queue_destroy(grpc_completion_queue* cq) override; grpc_event grpc_completion_queue_pluck(grpc_completion_queue* cq, void* tag, gpr_timespec deadline, @@ -61,8 +60,7 @@ class CoreCodegen : public CoreCodegenInterface { void gpr_mu_unlock(gpr_mu* mu) override; void gpr_cv_init(gpr_cv* cv) override; void gpr_cv_destroy(gpr_cv* cv) override; - int gpr_cv_wait(gpr_cv* cv, gpr_mu* mu, - gpr_timespec abs_deadline) override; + int gpr_cv_wait(gpr_cv* cv, gpr_mu* mu, gpr_timespec abs_deadline) override; void gpr_cv_signal(gpr_cv* cv) override; void gpr_cv_broadcast(gpr_cv* cv) override; @@ -70,8 +68,8 @@ class CoreCodegen : public CoreCodegenInterface { int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader* reader, grpc_byte_buffer* buffer) override; - void grpc_byte_buffer_reader_destroy(grpc_byte_buffer_reader* reader) - override; + void grpc_byte_buffer_reader_destroy( + grpc_byte_buffer_reader* reader) override; int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader* reader, gpr_slice* slice) override; @@ -81,8 +79,7 @@ class CoreCodegen : public CoreCodegenInterface { gpr_slice gpr_slice_malloc(size_t length) override; void gpr_slice_unref(gpr_slice slice) override; gpr_slice gpr_slice_split_tail(gpr_slice* s, size_t split) override; - void gpr_slice_buffer_add(gpr_slice_buffer* sb, - gpr_slice slice) override; + void gpr_slice_buffer_add(gpr_slice_buffer* sb, gpr_slice slice) override; void gpr_slice_buffer_pop(gpr_slice_buffer* sb) override; void grpc_metadata_array_init(grpc_metadata_array* array) override; diff --git a/include/grpc++/server.h b/include/grpc++/server.h index 6d0d2d9a8aa..8035c63da4b 100644 --- a/include/grpc++/server.h +++ b/include/grpc++/server.h @@ -143,8 +143,7 @@ class Server final : public ServerInterface, private GrpcLibraryCodegen { /// Register a service. This call does not take ownership of the service. /// The service must exist for the lifetime of the Server instance. - bool RegisterService(const grpc::string* host, - Service* service) override; + bool RegisterService(const grpc::string* host, Service* service) override; /// Register a generic service. This call does not take ownership of the /// service. The service must exist for the lifetime of the Server instance. diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc index 755ca11d4e8..a26eeb46b95 100644 --- a/src/compiler/cpp_generator.cc +++ b/src/compiler/cpp_generator.cc @@ -423,11 +423,10 @@ void PrintHeaderClientMethod(Printer *printer, const Method *method, "::grpc::ClientWriter< $Request$>* $Method$Raw(" "::grpc::ClientContext* context, $Response$* response) " "override;\n"); - printer->Print( - *vars, - "::grpc::ClientAsyncWriter< $Request$>* Async$Method$Raw(" - "::grpc::ClientContext* context, $Response$* response, " - "::grpc::CompletionQueue* cq, void* tag) override;\n"); + printer->Print(*vars, + "::grpc::ClientAsyncWriter< $Request$>* Async$Method$Raw(" + "::grpc::ClientContext* context, $Response$* response, " + "::grpc::CompletionQueue* cq, void* tag) override;\n"); } else if (method->ServerOnlyStreaming()) { printer->Print(*vars, "::grpc::ClientReader< $Response$>* $Method$Raw(" @@ -439,15 +438,13 @@ void PrintHeaderClientMethod(Printer *printer, const Method *method, "::grpc::ClientContext* context, const $Request$& request, " "::grpc::CompletionQueue* cq, void* tag) override;\n"); } else if (method->BidiStreaming()) { - printer->Print( - *vars, - "::grpc::ClientReaderWriter< $Request$, $Response$>* " - "$Method$Raw(::grpc::ClientContext* context) override;\n"); - printer->Print( - *vars, - "::grpc::ClientAsyncReaderWriter< $Request$, $Response$>* " - "Async$Method$Raw(::grpc::ClientContext* context, " - "::grpc::CompletionQueue* cq, void* tag) override;\n"); + printer->Print(*vars, + "::grpc::ClientReaderWriter< $Request$, $Response$>* " + "$Method$Raw(::grpc::ClientContext* context) override;\n"); + printer->Print(*vars, + "::grpc::ClientAsyncReaderWriter< $Request$, $Response$>* " + "Async$Method$Raw(::grpc::ClientContext* context, " + "::grpc::CompletionQueue* cq, void* tag) override;\n"); } } } diff --git a/src/cpp/client/cronet_credentials.cc b/src/cpp/client/cronet_credentials.cc index 26bbc24bd92..8e94cf0ad73 100644 --- a/src/cpp/client/cronet_credentials.cc +++ b/src/cpp/client/cronet_credentials.cc @@ -53,9 +53,7 @@ class CronetChannelCredentialsImpl final : public ChannelCredentials { &channel_args, nullptr)); } - SecureChannelCredentials* AsSecureCredentials() override { - return nullptr; - } + SecureChannelCredentials* AsSecureCredentials() override { return nullptr; } private: void* engine_; diff --git a/src/cpp/client/insecure_credentials.cc b/src/cpp/client/insecure_credentials.cc index d73dadad24b..116f1dd4ad6 100644 --- a/src/cpp/client/insecure_credentials.cc +++ b/src/cpp/client/insecure_credentials.cc @@ -54,9 +54,7 @@ class InsecureChannelCredentialsImpl final : public ChannelCredentials { grpc_insecure_channel_create(target.c_str(), &channel_args, nullptr)); } - SecureChannelCredentials* AsSecureCredentials() override { - return nullptr; - } + SecureChannelCredentials* AsSecureCredentials() override { return nullptr; } }; } // namespace diff --git a/src/cpp/common/secure_auth_context.h b/src/cpp/common/secure_auth_context.h index d6ad75c1c76..98f5f09e27c 100644 --- a/src/cpp/common/secure_auth_context.h +++ b/src/cpp/common/secure_auth_context.h @@ -62,8 +62,7 @@ class SecureAuthContext final : public AuthContext { void AddProperty(const grpc::string& key, const grpc::string_ref& value) override; - virtual bool SetPeerIdentityPropertyName(const grpc::string& name) - override; + virtual bool SetPeerIdentityPropertyName(const grpc::string& name) override; private: grpc_auth_context* ctx_; diff --git a/src/cpp/server/insecure_server_credentials.cc b/src/cpp/server/insecure_server_credentials.cc index 817d0b8bbd4..eb5931b7b00 100644 --- a/src/cpp/server/insecure_server_credentials.cc +++ b/src/cpp/server/insecure_server_credentials.cc @@ -40,8 +40,7 @@ namespace grpc { namespace { class InsecureServerCredentialsImpl final : public ServerCredentials { public: - int AddPortToServer(const grpc::string& addr, - grpc_server* server) override { + int AddPortToServer(const grpc::string& addr, grpc_server* server) override { return grpc_server_add_insecure_http2_port(server, addr.c_str()); } void SetAuthMetadataProcessor( diff --git a/src/cpp/server/secure_server_credentials.h b/src/cpp/server/secure_server_credentials.h index 18b5fec4b73..3a301e60c24 100644 --- a/src/cpp/server/secure_server_credentials.h +++ b/src/cpp/server/secure_server_credentials.h @@ -72,8 +72,7 @@ class SecureServerCredentials final : public ServerCredentials { grpc_server_credentials_release(creds_); } - int AddPortToServer(const grpc::string& addr, - grpc_server* server) override; + int AddPortToServer(const grpc::string& addr, grpc_server* server) override; void SetAuthMetadataProcessor( const std::shared_ptr& processor) override; diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index ab314a0dbb2..3845582d5db 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -213,8 +213,8 @@ class ServerBuilderSyncPluginDisabler : public ::grpc::ServerBuilderOption { public: void UpdateArguments(ChannelArguments* arg) override {} - void UpdatePlugins(std::vector>* plugins) - override { + void UpdatePlugins( + std::vector>* plugins) override { plugins->erase(std::remove_if(plugins->begin(), plugins->end(), plugin_has_sync_methods), plugins->end()); diff --git a/test/cpp/end2end/client_crash_test_server.cc b/test/cpp/end2end/client_crash_test_server.cc index e971accd22f..0e0a1059892 100644 --- a/test/cpp/end2end/client_crash_test_server.cc +++ b/test/cpp/end2end/client_crash_test_server.cc @@ -58,11 +58,10 @@ using namespace gflags; namespace grpc { namespace testing { -class ServiceImpl final - : public ::grpc::testing::EchoTestService::Service { - Status BidiStream(ServerContext* context, - ServerReaderWriter* stream) - override { +class ServiceImpl final : public ::grpc::testing::EchoTestService::Service { + Status BidiStream( + ServerContext* context, + ServerReaderWriter* stream) override { EchoRequest request; EchoResponse response; while (stream->Read(&request)) { diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index 29806faa945..4b8749884f8 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -94,10 +94,10 @@ class TestMetadataCredentialsPlugin : public MetadataCredentialsPlugin { bool IsBlocking() const override { return is_blocking_; } - Status GetMetadata(grpc::string_ref service_url, grpc::string_ref method_name, - const grpc::AuthContext& channel_auth_context, - std::multimap* metadata) - override { + Status GetMetadata( + grpc::string_ref service_url, grpc::string_ref method_name, + const grpc::AuthContext& channel_auth_context, + std::multimap* metadata) override { EXPECT_GT(service_url.length(), 0UL); EXPECT_GT(method_name.length(), 0UL); EXPECT_TRUE(channel_auth_context.IsPeerAuthenticated()); diff --git a/test/cpp/end2end/hybrid_end2end_test.cc b/test/cpp/end2end/hybrid_end2end_test.cc index d769d41384b..a4ba76fed14 100644 --- a/test/cpp/end2end/hybrid_end2end_test.cc +++ b/test/cpp/end2end/hybrid_end2end_test.cc @@ -449,9 +449,9 @@ class StreamedUnaryDupPkg : public duplicate::EchoTestService::WithStreamedUnaryMethod_Echo< TestServiceImplDupPkg> { public: - Status StreamedEcho(ServerContext* context, - ServerUnaryStreamer* stream) - override { + Status StreamedEcho( + ServerContext* context, + ServerUnaryStreamer* stream) override { EchoRequest req; EchoResponse resp; uint32_t next_msg_sz; @@ -487,9 +487,9 @@ TEST_F(HybridEnd2endTest, class FullyStreamedUnaryDupPkg : public duplicate::EchoTestService::StreamedUnaryService { public: - Status StreamedEcho(ServerContext* context, - ServerUnaryStreamer* stream) - override { + Status StreamedEcho( + ServerContext* context, + ServerUnaryStreamer* stream) override { EchoRequest req; EchoResponse resp; uint32_t next_msg_sz; @@ -605,9 +605,9 @@ TEST_F(HybridEnd2endTest, // Add a second service that is fully server streamed class FullyStreamedDupPkg : public duplicate::EchoTestService::StreamedService { public: - Status StreamedEcho(ServerContext* context, - ServerUnaryStreamer* stream) - override { + Status StreamedEcho( + ServerContext* context, + ServerUnaryStreamer* stream) override { EchoRequest req; EchoResponse resp; uint32_t next_msg_sz; diff --git a/test/cpp/end2end/mock_test.cc b/test/cpp/end2end/mock_test.cc index 5e9cb823ae4..d6664da5a0f 100644 --- a/test/cpp/end2end/mock_test.cc +++ b/test/cpp/end2end/mock_test.cc @@ -61,8 +61,7 @@ namespace testing { namespace { template -class MockClientReaderWriter final - : public ClientReaderWriterInterface { +class MockClientReaderWriter final : public ClientReaderWriterInterface { public: void WaitForInitialMetadata() override {} bool NextMessageSize(uint32_t* sz) override { @@ -90,8 +89,7 @@ class MockClientReaderWriter final return true; } - bool Write(const EchoRequest& msg, - const WriteOptions& options) override { + bool Write(const EchoRequest& msg, const WriteOptions& options) override { gpr_log(GPR_INFO, "mock recv msg %s", msg.message().c_str()); last_message_ = msg.message(); return true; @@ -221,9 +219,9 @@ class TestServiceImpl : public EchoTestService::Service { return Status::OK; } - Status BidiStream(ServerContext* context, - ServerReaderWriter* stream) - override { + Status BidiStream( + ServerContext* context, + ServerReaderWriter* stream) override { EchoRequest request; EchoResponse response; while (stream->Read(&request)) { diff --git a/test/cpp/end2end/server_builder_plugin_test.cc b/test/cpp/end2end/server_builder_plugin_test.cc index 06b56469aeb..94e4612c4f3 100644 --- a/test/cpp/end2end/server_builder_plugin_test.cc +++ b/test/cpp/end2end/server_builder_plugin_test.cc @@ -114,8 +114,8 @@ class InsertPluginServerBuilderOption : public ServerBuilderOption { void UpdateArguments(ChannelArguments* arg) override {} - void UpdatePlugins(std::vector>* plugins) - override { + void UpdatePlugins( + std::vector>* plugins) override { plugins->clear(); std::unique_ptr plugin( diff --git a/test/cpp/end2end/server_crash_test.cc b/test/cpp/end2end/server_crash_test.cc index 9e70dc36f25..8cee1403dcf 100644 --- a/test/cpp/end2end/server_crash_test.cc +++ b/test/cpp/end2end/server_crash_test.cc @@ -60,14 +60,13 @@ namespace testing { namespace { -class ServiceImpl final - : public ::grpc::testing::EchoTestService::Service { +class ServiceImpl final : public ::grpc::testing::EchoTestService::Service { public: ServiceImpl() : bidi_stream_count_(0), response_stream_count_(0) {} - Status BidiStream(ServerContext* context, - ServerReaderWriter* stream) - override { + Status BidiStream( + ServerContext* context, + ServerReaderWriter* stream) override { bidi_stream_count_++; EchoRequest request; EchoResponse response; diff --git a/test/cpp/end2end/streaming_throughput_test.cc b/test/cpp/end2end/streaming_throughput_test.cc index 3cbd77fb653..302583766b8 100644 --- a/test/cpp/end2end/streaming_throughput_test.cc +++ b/test/cpp/end2end/streaming_throughput_test.cc @@ -121,9 +121,9 @@ class TestServiceImpl : public ::grpc::testing::EchoTestService::Service { } // Only implement the one method we will be calling for brevity. - Status BidiStream(ServerContext* context, - ServerReaderWriter* stream) - override { + Status BidiStream( + ServerContext* context, + ServerReaderWriter* stream) override { EchoRequest request; gpr_atm should_exit; gpr_atm_rel_store(&should_exit, static_cast(0)); diff --git a/test/cpp/end2end/test_service_impl.h b/test/cpp/end2end/test_service_impl.h index ee240649720..88e0be7bca7 100644 --- a/test/cpp/end2end/test_service_impl.h +++ b/test/cpp/end2end/test_service_impl.h @@ -74,9 +74,9 @@ class TestServiceImpl : public ::grpc::testing::EchoTestService::Service { Status ResponseStream(ServerContext* context, const EchoRequest* request, ServerWriter* writer) override; - Status BidiStream(ServerContext* context, - ServerReaderWriter* stream) - override; + Status BidiStream( + ServerContext* context, + ServerReaderWriter* stream) override; bool signal_client() { std::unique_lock lock(mu_); diff --git a/test/cpp/end2end/thread_stress_test.cc b/test/cpp/end2end/thread_stress_test.cc index 9239198780a..107e38664e3 100644 --- a/test/cpp/end2end/thread_stress_test.cc +++ b/test/cpp/end2end/thread_stress_test.cc @@ -142,9 +142,9 @@ class TestServiceImpl : public ::grpc::testing::EchoTestService::Service { return Status::OK; } - Status BidiStream(ServerContext* context, - ServerReaderWriter* stream) - override { + Status BidiStream( + ServerContext* context, + ServerReaderWriter* stream) override { EchoRequest request; EchoResponse response; while (stream->Read(&request)) { diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc index de8a3956739..2ec6a5a23bc 100644 --- a/test/cpp/qps/client_async.cc +++ b/test/cpp/qps/client_async.cc @@ -228,8 +228,7 @@ class AsyncClient : public ClientImpl { this->EndThreads(); // this needed for resolution } - bool ThreadFunc(HistogramEntry* entry, - size_t thread_idx) override final { + bool ThreadFunc(HistogramEntry* entry, size_t thread_idx) override final { void* got_tag; bool ok; diff --git a/test/cpp/qps/qps_worker.cc b/test/cpp/qps/qps_worker.cc index 0efd92cb9dc..d437920e686 100644 --- a/test/cpp/qps/qps_worker.cc +++ b/test/cpp/qps/qps_worker.cc @@ -118,9 +118,9 @@ class WorkerServiceImpl final : public WorkerService::Service { WorkerServiceImpl(int server_port, QpsWorker* worker) : acquired_(false), server_port_(server_port), worker_(worker) {} - Status RunClient(ServerContext* ctx, - ServerReaderWriter* stream) - override { + Status RunClient( + ServerContext* ctx, + ServerReaderWriter* stream) override { InstanceGuard g(this); if (!g.Acquired()) { return Status(StatusCode::RESOURCE_EXHAUSTED, "Client worker busy"); @@ -132,9 +132,9 @@ class WorkerServiceImpl final : public WorkerService::Service { return ret; } - Status RunServer(ServerContext* ctx, - ServerReaderWriter* stream) - override { + Status RunServer( + ServerContext* ctx, + ServerReaderWriter* stream) override { InstanceGuard g(this); if (!g.Acquired()) { return Status(StatusCode::RESOURCE_EXHAUSTED, "Server worker busy"); diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc index d5662f7ee64..f556fbdfa1b 100644 --- a/test/cpp/qps/server_async.cc +++ b/test/cpp/qps/server_async.cc @@ -214,9 +214,7 @@ class AsyncQpsServerTest final : public grpc::testing::Server { AsyncQpsServerTest::tag(this)); } ~ServerRpcContextUnaryImpl() override {} - bool RunNextState(bool ok) override { - return (this->*next_state_)(ok); - } + bool RunNextState(bool ok) override { return (this->*next_state_)(ok); } void Reset() override { srv_ctx_.reset(new ServerContextType); req_ = RequestType(); @@ -274,9 +272,7 @@ class AsyncQpsServerTest final : public grpc::testing::Server { request_method_(srv_ctx_.get(), &stream_, AsyncQpsServerTest::tag(this)); } ~ServerRpcContextStreamingImpl() override {} - bool RunNextState(bool ok) override { - return (this->*next_state_)(ok); - } + bool RunNextState(bool ok) override { return (this->*next_state_)(ok); } void Reset() override { srv_ctx_.reset(new ServerContextType); req_ = RequestType(); diff --git a/test/cpp/thread_manager/thread_manager_test.cc b/test/cpp/thread_manager/thread_manager_test.cc index 43c17c85b8c..284761c53ae 100644 --- a/test/cpp/thread_manager/thread_manager_test.cc +++ b/test/cpp/thread_manager/thread_manager_test.cc @@ -51,8 +51,7 @@ class ThreadManagerTest final : public grpc::ThreadManager { num_poll_for_work_(0), num_work_found_(0) {} - grpc::ThreadManager::WorkStatus PollForWork(void **tag, - bool *ok) override; + grpc::ThreadManager::WorkStatus PollForWork(void **tag, bool *ok) override; void DoWork(void *tag, bool ok) override; void PerformTest(); diff --git a/test/cpp/util/grpc_tool_test.cc b/test/cpp/util/grpc_tool_test.cc index 1699d689ab7..5ab054d04a1 100644 --- a/test/cpp/util/grpc_tool_test.cc +++ b/test/cpp/util/grpc_tool_test.cc @@ -95,8 +95,7 @@ namespace { class TestCliCredentials final : public grpc::testing::CliCredentials { public: - std::shared_ptr GetCredentials() const - override { + std::shared_ptr GetCredentials() const override { return InsecureChannelCredentials(); } const grpc::string GetCredentialUsage() const override { return ""; } diff --git a/test/cpp/util/proto_reflection_descriptor_database.h b/test/cpp/util/proto_reflection_descriptor_database.h index 0aa32c33935..259277ebbe1 100644 --- a/test/cpp/util/proto_reflection_descriptor_database.h +++ b/test/cpp/util/proto_reflection_descriptor_database.h @@ -68,8 +68,7 @@ class ProtoReflectionDescriptorDatabase : public protobuf::DescriptorDatabase { // If found, fills in *output and returns true, otherwise returns false // and leaves *output undefined. bool FindFileContainingSymbol(const string& symbol_name, - protobuf::FileDescriptorProto* output) - override; + protobuf::FileDescriptorProto* output) override; // Find the file which defines an extension extending the given message type // with the given field number. If found, fills in *output and returns true, diff --git a/test/cpp/util/test_credentials_provider.cc b/test/cpp/util/test_credentials_provider.cc index df03fabeca3..ceee2b25cab 100644 --- a/test/cpp/util/test_credentials_provider.cc +++ b/test/cpp/util/test_credentials_provider.cc @@ -66,9 +66,9 @@ class DefaultCredentialsProvider : public CredentialsProvider { public: ~DefaultCredentialsProvider() override {} - void AddSecureType(const grpc::string& type, - std::unique_ptr type_provider) - override { + void AddSecureType( + const grpc::string& type, + std::unique_ptr type_provider) override { // This clobbers any existing entry for type, except the defaults, which // can't be clobbered. grpc::unique_lock lock(mu_); From e08fe4f41e885d83de7670761305768a2569b9a2 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Tue, 1 Nov 2016 16:50:38 -0700 Subject: [PATCH 11/20] Remove separate versions of code based on presence of threading in compiler --- build.yaml | 6 - include/grpc++/impl/codegen/impl/sync.h | 45 -------- include/grpc++/impl/codegen/sync.h | 16 ++- include/grpc++/impl/codegen/sync_cxx11.h | 49 -------- include/grpc++/impl/codegen/sync_no_cxx11.h | 111 ------------------- include/grpc++/impl/thd.h | 12 +- include/grpc++/impl/thd_cxx11.h | 45 -------- include/grpc++/impl/thd_no_cxx11.h | 117 -------------------- 8 files changed, 16 insertions(+), 385 deletions(-) delete mode 100644 include/grpc++/impl/codegen/impl/sync.h delete mode 100644 include/grpc++/impl/codegen/sync_cxx11.h delete mode 100644 include/grpc++/impl/codegen/sync_no_cxx11.h delete mode 100644 include/grpc++/impl/thd_cxx11.h delete mode 100644 include/grpc++/impl/thd_no_cxx11.h diff --git a/build.yaml b/build.yaml index f86d896f6e3..9714e3d5da5 100644 --- a/build.yaml +++ b/build.yaml @@ -711,11 +711,7 @@ filegroups: - 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 @@ -803,8 +799,6 @@ filegroups: - 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: diff --git a/include/grpc++/impl/codegen/impl/sync.h b/include/grpc++/impl/codegen/impl/sync.h deleted file mode 100644 index 88951de6d0d..00000000000 --- a/include/grpc++/impl/codegen/impl/sync.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef GRPCXX_IMPL_CODEGEN_IMPL_SYNC_H -#define GRPCXX_IMPL_CODEGEN_IMPL_SYNC_H - -#include - -#ifdef GRPC_CXX0X_NO_THREAD -#include -#else -#include -#endif - -#endif // GRPCXX_IMPL_CODEGEN_IMPL_SYNC_H diff --git a/include/grpc++/impl/codegen/sync.h b/include/grpc++/impl/codegen/sync.h index 62194c77081..b94649b79fa 100644 --- a/include/grpc++/impl/codegen/sync.h +++ b/include/grpc++/impl/codegen/sync.h @@ -34,12 +34,16 @@ #ifndef GRPCXX_IMPL_CODEGEN_SYNC_H #define GRPCXX_IMPL_CODEGEN_SYNC_H -#include +#include +#include -#ifdef GRPC_CXX0X_NO_THREAD -#include -#else -#include -#endif +namespace grpc { + +using std::condition_variable; +using std::mutex; +using std::lock_guard; +using std::unique_lock; + +} // namespace grpc #endif // GRPCXX_IMPL_CODEGEN_SYNC_H diff --git a/include/grpc++/impl/codegen/sync_cxx11.h b/include/grpc++/impl/codegen/sync_cxx11.h deleted file mode 100644 index 6626ca1f94c..00000000000 --- a/include/grpc++/impl/codegen/sync_cxx11.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef GRPCXX_IMPL_CODEGEN_SYNC_CXX11_H -#define GRPCXX_IMPL_CODEGEN_SYNC_CXX11_H - -#include -#include - -namespace grpc { - -using std::condition_variable; -using std::mutex; -using std::lock_guard; -using std::unique_lock; - -} // namespace grpc - -#endif // GRPCXX_IMPL_CODEGEN_SYNC_CXX11_H diff --git a/include/grpc++/impl/codegen/sync_no_cxx11.h b/include/grpc++/impl/codegen/sync_no_cxx11.h deleted file mode 100644 index 87a6594f7df..00000000000 --- a/include/grpc++/impl/codegen/sync_no_cxx11.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef GRPCXX_IMPL_CODEGEN_SYNC_NO_CXX11_H -#define GRPCXX_IMPL_CODEGEN_SYNC_NO_CXX11_H - -#include - -namespace grpc { - -extern CoreCodegenInterface *g_core_codegen_interface; - -template -class lock_guard; -class condition_variable; - -class mutex { - public: - mutex() { g_core_codegen_interface->gpr_mu_init(&mu_); } - ~mutex() { g_core_codegen_interface->gpr_mu_destroy(&mu_); } - - private: - ::gpr_mu mu_; - template - friend class lock_guard; - friend class condition_variable; -}; - -template -class lock_guard { - public: - lock_guard(mutex &mu) : mu_(mu), locked(true) { - g_core_codegen_interface->gpr_mu_lock(&mu.mu_); - } - ~lock_guard() { unlock_internal(); } - - protected: - void lock_internal() { - if (!locked) g_core_codegen_interface->gpr_mu_lock(&mu_.mu_); - locked = true; - } - void unlock_internal() { - if (locked) g_core_codegen_interface->gpr_mu_unlock(&mu_.mu_); - locked = false; - } - - private: - mutex &mu_; - bool locked; - friend class condition_variable; -}; - -template -class unique_lock : public lock_guard { - public: - unique_lock(mutex &mu) : lock_guard(mu) {} - void lock() { this->lock_internal(); } - void unlock() { this->unlock_internal(); } -}; - -class condition_variable { - public: - condition_variable() { g_core_codegen_interface->gpr_cv_init(&cv_); } - ~condition_variable() { g_core_codegen_interface->gpr_cv_destroy(&cv_); } - void wait(lock_guard &mu) { - mu.locked = false; - g_core_codegen_interface->gpr_cv_wait( - &cv_, &mu.mu_.mu_, - g_core_codegen_interface->gpr_inf_future(GPR_CLOCK_REALTIME)); - mu.locked = true; - } - void notify_one() { g_core_codegen_interface->gpr_cv_signal(&cv_); } - void notify_all() { g_core_codegen_interface->gpr_cv_broadcast(&cv_); } - - private: - gpr_cv cv_; -}; - -} // namespace grpc - -#endif // GRPCXX_IMPL_CODEGEN_SYNC_NO_CXX11_H diff --git a/include/grpc++/impl/thd.h b/include/grpc++/impl/thd.h index f8d4258ac61..87e1005d973 100644 --- a/include/grpc++/impl/thd.h +++ b/include/grpc++/impl/thd.h @@ -34,12 +34,12 @@ #ifndef GRPCXX_IMPL_THD_H #define GRPCXX_IMPL_THD_H -#include +#include -#ifdef GRPC_CXX0X_NO_THREAD -#include -#else -#include -#endif +namespace grpc { + +using std::thread; + +} // namespace grpc #endif // GRPCXX_IMPL_THD_H diff --git a/include/grpc++/impl/thd_cxx11.h b/include/grpc++/impl/thd_cxx11.h deleted file mode 100644 index 2055b1d5389..00000000000 --- a/include/grpc++/impl/thd_cxx11.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef GRPCXX_IMPL_THD_CXX11_H -#define GRPCXX_IMPL_THD_CXX11_H - -#include - -namespace grpc { - -using std::thread; - -} // namespace grpc - -#endif // GRPCXX_IMPL_THD_CXX11_H diff --git a/include/grpc++/impl/thd_no_cxx11.h b/include/grpc++/impl/thd_no_cxx11.h deleted file mode 100644 index 3f981d3770f..00000000000 --- a/include/grpc++/impl/thd_no_cxx11.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef GRPCXX_IMPL_THD_NO_CXX11_H -#define GRPCXX_IMPL_THD_NO_CXX11_H - -#include - -namespace grpc { - -class thread { - public: - template - thread(void (T::*fptr)(), T *obj) { - func_ = new thread_function(fptr, obj); - joined_ = false; - start(); - } - template - thread(void (T::*fptr)(U arg), T *obj, U arg) { - func_ = new thread_function_arg(fptr, obj, arg); - joined_ = false; - start(); - } - ~thread() { - if (!joined_) std::terminate(); - delete func_; - } - thread(thread &&other) - : func_(other.func_), thd_(other.thd_), joined_(other.joined_) { - other.joined_ = true; - other.func_ = NULL; - } - void join() { - gpr_thd_join(thd_); - joined_ = true; - } - - private: - void start() { - gpr_thd_options options = gpr_thd_options_default(); - gpr_thd_options_set_joinable(&options); - gpr_thd_new(&thd_, thread_func, (void *)func_, &options); - } - static void thread_func(void *arg) { - thread_function_base *func = (thread_function_base *)arg; - func->call(); - } - class thread_function_base { - public: - virtual ~thread_function_base() {} - virtual void call() = 0; - }; - template - class thread_function : public thread_function_base { - public: - thread_function(void (T::*fptr)(), T *obj) : fptr_(fptr), obj_(obj) {} - virtual void call() { (obj_->*fptr_)(); } - - private: - void (T::*fptr_)(); - T *obj_; - }; - template - class thread_function_arg : public thread_function_base { - public: - thread_function_arg(void (T::*fptr)(U arg), T *obj, U arg) - : fptr_(fptr), obj_(obj), arg_(arg) {} - virtual void call() { (obj_->*fptr_)(arg_); } - - private: - void (T::*fptr_)(U arg); - T *obj_; - U arg_; - }; - thread_function_base *func_; - gpr_thd_id thd_; - bool joined_; - - // Disallow copy and assign. - thread(const thread &); - void operator=(const thread &); -}; - -} // namespace grpc - -#endif // GRPCXX_IMPL_THD_NO_CXX11_H From e140d5c60d6a7592dad827f73c7aa922918de5b5 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Tue, 1 Nov 2016 16:53:21 -0700 Subject: [PATCH 12/20] Regenerate all projects --- BUILD | 18 ----------------- CMakeLists.txt | 18 ----------------- Makefile | 20 ------------------- test/cpp/qps/gen_build_yaml.py | 0 tools/doxygen/Doxyfile.c++ | 6 ------ tools/doxygen/Doxyfile.c++.internal | 6 ------ tools/run_tests/sources_and_headers.json | 12 ----------- tools/run_tests/tests.json | 1 + vsprojects/vcxproj/grpc++/grpc++.vcxproj | 6 ------ .../vcxproj/grpc++/grpc++.vcxproj.filters | 18 ----------------- .../grpc++_test_util/grpc++_test_util.vcxproj | 2 -- .../grpc++_test_util.vcxproj.filters | 6 ------ .../grpc++_unsecure/grpc++_unsecure.vcxproj | 6 ------ .../grpc++_unsecure.vcxproj.filters | 18 ----------------- .../codegen_test_full.vcxproj | 2 -- .../codegen_test_full.vcxproj.filters | 6 ------ .../codegen_test_minimal.vcxproj | 2 -- .../codegen_test_minimal.vcxproj.filters | 6 ------ .../grpc_tool_test/grpc_tool_test.vcxproj | 2 -- .../grpc_tool_test.vcxproj.filters | 6 ------ 20 files changed, 1 insertion(+), 160 deletions(-) mode change 100644 => 100755 test/cpp/qps/gen_build_yaml.py diff --git a/BUILD b/BUILD index d688ed2f82c..9d38b712682 100644 --- a/BUILD +++ b/BUILD @@ -1403,11 +1403,7 @@ cc_library( "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", @@ -1456,8 +1452,6 @@ cc_library( "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", @@ -1555,11 +1549,7 @@ cc_library( "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", @@ -1608,8 +1598,6 @@ cc_library( "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", @@ -1728,11 +1716,7 @@ cc_library( "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", @@ -1781,8 +1765,6 @@ cc_library( "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..d5fbbcf7f63 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1122,11 +1122,7 @@ foreach(_hdr 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 @@ -1175,8 +1171,6 @@ foreach(_hdr 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 @@ -1288,11 +1282,7 @@ foreach(_hdr 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 @@ -1341,8 +1331,6 @@ foreach(_hdr 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 @@ -1492,11 +1480,7 @@ foreach(_hdr 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 @@ -1545,8 +1529,6 @@ foreach(_hdr 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 88fef5652cc..3dace8065de 100644 --- a/Makefile +++ b/Makefile @@ -3747,11 +3747,7 @@ PUBLIC_HEADERS_CXX += \ 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 \ @@ -3800,8 +3796,6 @@ PUBLIC_HEADERS_CXX += \ 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 \ @@ -3942,11 +3936,7 @@ PUBLIC_HEADERS_CXX += \ 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 \ @@ -3995,8 +3985,6 @@ PUBLIC_HEADERS_CXX += \ 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 \ @@ -4343,8 +4331,6 @@ PUBLIC_HEADERS_CXX += \ 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 \ @@ -4476,11 +4462,7 @@ PUBLIC_HEADERS_CXX += \ 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 \ @@ -4529,8 +4511,6 @@ PUBLIC_HEADERS_CXX += \ 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/test/cpp/qps/gen_build_yaml.py b/test/cpp/qps/gen_build_yaml.py old mode 100644 new mode 100755 diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index 00f970a4cbd..d0f771489e5 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -782,11 +782,7 @@ 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 \ @@ -835,8 +831,6 @@ 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/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 6c2b475ed0a..8cff9e06da8 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -782,11 +782,7 @@ 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 \ @@ -835,8 +831,6 @@ 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/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index 80242adf21e..3e77e4194ed 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -7439,11 +7439,7 @@ "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", @@ -7497,11 +7493,7 @@ "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", @@ -7591,8 +7583,6 @@ "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" ], @@ -7627,8 +7617,6 @@ "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" ], diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json index 733bfe3b8fd..39daf859b46 100644 --- a/tools/run_tests/tests.json +++ b/tools/run_tests/tests.json @@ -3003,6 +3003,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c++", diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj b/vsprojects/vcxproj/grpc++/grpc++.vcxproj index bf9c3a5c9d4..34cc10b9fc1 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj @@ -280,11 +280,7 @@ - - - - @@ -333,8 +329,6 @@ - - diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters index b88a78ad92d..93e0ae2ace4 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters @@ -177,21 +177,9 @@ include\grpc++\impl - - include\grpc++\impl - - - include\grpc++\impl - include\grpc++\impl - - include\grpc++\impl - - - include\grpc++\impl - include\grpc++ @@ -336,12 +324,6 @@ include\grpc++\impl\codegen - - include\grpc++\impl\codegen - - - include\grpc++\impl\codegen - include\grpc++\impl\codegen diff --git a/vsprojects/vcxproj/grpc++_test_util/grpc++_test_util.vcxproj b/vsprojects/vcxproj/grpc++_test_util/grpc++_test_util.vcxproj index 17e91995543..533771f6250 100644 --- a/vsprojects/vcxproj/grpc++_test_util/grpc++_test_util.vcxproj +++ b/vsprojects/vcxproj/grpc++_test_util/grpc++_test_util.vcxproj @@ -174,8 +174,6 @@ - - diff --git a/vsprojects/vcxproj/grpc++_test_util/grpc++_test_util.vcxproj.filters b/vsprojects/vcxproj/grpc++_test_util/grpc++_test_util.vcxproj.filters index 25a1752479c..a328cba327c 100644 --- a/vsprojects/vcxproj/grpc++_test_util/grpc++_test_util.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++_test_util/grpc++_test_util.vcxproj.filters @@ -114,12 +114,6 @@ include\grpc++\impl\codegen - - include\grpc++\impl\codegen - - - include\grpc++\impl\codegen - include\grpc++\impl\codegen diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj index 5d0759790c8..1183056da88 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj @@ -280,11 +280,7 @@ - - - - @@ -333,8 +329,6 @@ - - diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters index bdb71340817..a8871cbe5c5 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters @@ -162,21 +162,9 @@ include\grpc++\impl - - include\grpc++\impl - - - include\grpc++\impl - include\grpc++\impl - - include\grpc++\impl - - - include\grpc++\impl - include\grpc++ @@ -321,12 +309,6 @@ include\grpc++\impl\codegen - - include\grpc++\impl\codegen - - - include\grpc++\impl\codegen - include\grpc++\impl\codegen diff --git a/vsprojects/vcxproj/test/codegen_test_full/codegen_test_full.vcxproj b/vsprojects/vcxproj/test/codegen_test_full/codegen_test_full.vcxproj index 2d75735728b..0e4bd0f07c6 100644 --- a/vsprojects/vcxproj/test/codegen_test_full/codegen_test_full.vcxproj +++ b/vsprojects/vcxproj/test/codegen_test_full/codegen_test_full.vcxproj @@ -187,8 +187,6 @@ - - diff --git a/vsprojects/vcxproj/test/codegen_test_full/codegen_test_full.vcxproj.filters b/vsprojects/vcxproj/test/codegen_test_full/codegen_test_full.vcxproj.filters index dda79675fbd..ff50a90b3aa 100644 --- a/vsprojects/vcxproj/test/codegen_test_full/codegen_test_full.vcxproj.filters +++ b/vsprojects/vcxproj/test/codegen_test_full/codegen_test_full.vcxproj.filters @@ -102,12 +102,6 @@ include\grpc++\impl\codegen - - include\grpc++\impl\codegen - - - include\grpc++\impl\codegen - include\grpc++\impl\codegen diff --git a/vsprojects/vcxproj/test/codegen_test_minimal/codegen_test_minimal.vcxproj b/vsprojects/vcxproj/test/codegen_test_minimal/codegen_test_minimal.vcxproj index 270c2a3a062..881fd4ece46 100644 --- a/vsprojects/vcxproj/test/codegen_test_minimal/codegen_test_minimal.vcxproj +++ b/vsprojects/vcxproj/test/codegen_test_minimal/codegen_test_minimal.vcxproj @@ -187,8 +187,6 @@ - - diff --git a/vsprojects/vcxproj/test/codegen_test_minimal/codegen_test_minimal.vcxproj.filters b/vsprojects/vcxproj/test/codegen_test_minimal/codegen_test_minimal.vcxproj.filters index dc5e321649b..cc2668ed065 100644 --- a/vsprojects/vcxproj/test/codegen_test_minimal/codegen_test_minimal.vcxproj.filters +++ b/vsprojects/vcxproj/test/codegen_test_minimal/codegen_test_minimal.vcxproj.filters @@ -105,12 +105,6 @@ include\grpc++\impl\codegen - - include\grpc++\impl\codegen - - - include\grpc++\impl\codegen - include\grpc++\impl\codegen diff --git a/vsprojects/vcxproj/test/grpc_tool_test/grpc_tool_test.vcxproj b/vsprojects/vcxproj/test/grpc_tool_test/grpc_tool_test.vcxproj index 945c8d2811f..acb11e11119 100644 --- a/vsprojects/vcxproj/test/grpc_tool_test/grpc_tool_test.vcxproj +++ b/vsprojects/vcxproj/test/grpc_tool_test/grpc_tool_test.vcxproj @@ -188,8 +188,6 @@ - - diff --git a/vsprojects/vcxproj/test/grpc_tool_test/grpc_tool_test.vcxproj.filters b/vsprojects/vcxproj/test/grpc_tool_test/grpc_tool_test.vcxproj.filters index ab7d5ef5cc5..3d8459d8126 100644 --- a/vsprojects/vcxproj/test/grpc_tool_test/grpc_tool_test.vcxproj.filters +++ b/vsprojects/vcxproj/test/grpc_tool_test/grpc_tool_test.vcxproj.filters @@ -96,12 +96,6 @@ include\grpc++\impl\codegen - - include\grpc++\impl\codegen - - - include\grpc++\impl\codegen - include\grpc++\impl\codegen From 5c41bab92cb65d57def5eca8f83da1beb4ae5f40 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Tue, 1 Nov 2016 16:57:42 -0700 Subject: [PATCH 13/20] Remove references to NO_CHRONO option --- include/grpc++/impl/codegen/client_context.h | 2 -- include/grpc++/impl/codegen/server_context.h | 2 -- include/grpc++/impl/codegen/time.h | 4 ---- src/cpp/util/time_cc.cc | 5 ----- 4 files changed, 13 deletions(-) diff --git a/include/grpc++/impl/codegen/client_context.h b/include/grpc++/impl/codegen/client_context.h index a330ed06bbe..9b156bdc417 100644 --- a/include/grpc++/impl/codegen/client_context.h +++ b/include/grpc++/impl/codegen/client_context.h @@ -235,12 +235,10 @@ class ClientContext { /// DEPRECATED: Use set_wait_for_ready() instead. void set_fail_fast(bool fail_fast) { set_wait_for_ready(!fail_fast); } -#ifndef GRPC_CXX0X_NO_CHRONO /// Return the deadline for the client call. std::chrono::system_clock::time_point deadline() const { return Timespec2Timepoint(deadline_); } -#endif // !GRPC_CXX0X_NO_CHRONO /// Return a \a gpr_timespec representation of the client call's deadline. gpr_timespec raw_deadline() const { return deadline_; } diff --git a/include/grpc++/impl/codegen/server_context.h b/include/grpc++/impl/codegen/server_context.h index ddf50b019da..dd305763796 100644 --- a/include/grpc++/impl/codegen/server_context.h +++ b/include/grpc++/impl/codegen/server_context.h @@ -94,11 +94,9 @@ class ServerContext { ServerContext(); // for async calls ~ServerContext(); -#ifndef GRPC_CXX0X_NO_CHRONO std::chrono::system_clock::time_point deadline() const { return Timespec2Timepoint(deadline_); } -#endif // !GRPC_CXX0X_NO_CHRONO gpr_timespec raw_deadline() const { return deadline_; } diff --git a/include/grpc++/impl/codegen/time.h b/include/grpc++/impl/codegen/time.h index 87c5112d0d2..e090ece7567 100644 --- a/include/grpc++/impl/codegen/time.h +++ b/include/grpc++/impl/codegen/time.h @@ -75,8 +75,6 @@ class TimePoint { } // namespace grpc -#ifndef GRPC_CXX0X_NO_CHRONO - #include #include @@ -106,6 +104,4 @@ class TimePoint { } // namespace grpc -#endif // !GRPC_CXX0X_NO_CHRONO - #endif // GRPCXX_IMPL_CODEGEN_TIME_H diff --git a/src/cpp/util/time_cc.cc b/src/cpp/util/time_cc.cc index c43d848cc60..cd59a197032 100644 --- a/src/cpp/util/time_cc.cc +++ b/src/cpp/util/time_cc.cc @@ -32,9 +32,6 @@ */ #include - -#ifndef GRPC_CXX0X_NO_CHRONO - #include #include @@ -91,5 +88,3 @@ system_clock::time_point Timespec2Timepoint(gpr_timespec t) { } } // namespace grpc - -#endif // !GRPC_CXX0X_NO_CHRONO From 320ed13d3e6c568d3db6a39b85ebbc080f7ee083 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Tue, 1 Nov 2016 17:16:55 -0700 Subject: [PATCH 14/20] Deprecate grpc::thread and sync in favor of std::thread,mutex,etc --- BUILD | 9 ---- CMakeLists.txt | 9 ---- Makefile | 10 ---- build.yaml | 3 -- include/grpc++/impl/codegen/client_context.h | 4 +- include/grpc++/impl/codegen/sync.h | 49 ------------------- include/grpc++/impl/sync.h | 39 --------------- include/grpc++/impl/thd.h | 45 ----------------- include/grpc++/server.h | 7 +-- src/cpp/client/client_context.cc | 4 +- src/cpp/server/dynamic_thread_pool.cc | 16 +++--- src/cpp/server/dynamic_thread_pool.h | 13 ++--- src/cpp/server/server_cc.cc | 6 +-- src/cpp/server/server_context.cc | 11 +++-- src/cpp/thread_manager/thread_manager.cc | 29 +++++------ src/cpp/thread_manager/thread_manager.h | 13 ++--- test/cpp/end2end/filter_end2end_test.cc | 14 +++--- .../cpp/end2end/server_builder_plugin_test.cc | 7 +-- test/cpp/end2end/thread_stress_test.cc | 22 ++++----- test/cpp/interop/stress_test.cc | 5 +- test/cpp/util/test_credentials_provider.cc | 12 ++--- tools/doxygen/Doxyfile.c++ | 3 -- tools/doxygen/Doxyfile.c++.internal | 3 -- tools/run_tests/sources_and_headers.json | 6 --- vsprojects/vcxproj/grpc++/grpc++.vcxproj | 3 -- .../vcxproj/grpc++/grpc++.vcxproj.filters | 9 ---- .../grpc++_test_util/grpc++_test_util.vcxproj | 1 - .../grpc++_test_util.vcxproj.filters | 3 -- .../grpc++_unsecure/grpc++_unsecure.vcxproj | 3 -- .../grpc++_unsecure.vcxproj.filters | 9 ---- .../codegen_test_full.vcxproj | 1 - .../codegen_test_full.vcxproj.filters | 3 -- .../codegen_test_minimal.vcxproj | 1 - .../codegen_test_minimal.vcxproj.filters | 3 -- .../grpc_tool_test/grpc_tool_test.vcxproj | 1 - .../grpc_tool_test.vcxproj.filters | 3 -- 36 files changed, 84 insertions(+), 295 deletions(-) delete mode 100644 include/grpc++/impl/codegen/sync.h delete mode 100644 include/grpc++/impl/sync.h delete mode 100644 include/grpc++/impl/thd.h diff --git a/BUILD b/BUILD index 9d38b712682..97ddc56b419 100644 --- a/BUILD +++ b/BUILD @@ -1402,8 +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/thd.h", "include/grpc++/resource_quota.h", "include/grpc++/security/auth_context.h", "include/grpc++/security/auth_metadata_processor.h", @@ -1451,7 +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_stream.h", "include/grpc++/impl/codegen/time.h", "include/grpc/impl/codegen/byte_buffer_reader.h", @@ -1548,8 +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/thd.h", "include/grpc++/resource_quota.h", "include/grpc++/security/auth_context.h", "include/grpc++/security/auth_metadata_processor.h", @@ -1597,7 +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_stream.h", "include/grpc++/impl/codegen/time.h", "include/grpc/impl/codegen/byte_buffer_reader.h", @@ -1715,8 +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/thd.h", "include/grpc++/resource_quota.h", "include/grpc++/security/auth_context.h", "include/grpc++/security/auth_metadata_processor.h", @@ -1764,7 +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_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 d5fbbcf7f63..4b073b0d684 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1121,8 +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/thd.h include/grpc++/resource_quota.h include/grpc++/security/auth_context.h include/grpc++/security/auth_metadata_processor.h @@ -1170,7 +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_stream.h include/grpc++/impl/codegen/time.h include/grpc/impl/codegen/byte_buffer_reader.h @@ -1281,8 +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/thd.h include/grpc++/resource_quota.h include/grpc++/security/auth_context.h include/grpc++/security/auth_metadata_processor.h @@ -1330,7 +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_stream.h include/grpc++/impl/codegen/time.h include/grpc/impl/codegen/byte_buffer_reader.h @@ -1479,8 +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/thd.h include/grpc++/resource_quota.h include/grpc++/security/auth_context.h include/grpc++/security/auth_metadata_processor.h @@ -1528,7 +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_stream.h include/grpc++/impl/codegen/time.h include/grpc/impl/codegen/byte_buffer_reader.h diff --git a/Makefile b/Makefile index 3dace8065de..0421ab832e6 100644 --- a/Makefile +++ b/Makefile @@ -3746,8 +3746,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/thd.h \ include/grpc++/resource_quota.h \ include/grpc++/security/auth_context.h \ include/grpc++/security/auth_metadata_processor.h \ @@ -3795,7 +3793,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_stream.h \ include/grpc++/impl/codegen/time.h \ include/grpc/impl/codegen/byte_buffer_reader.h \ @@ -3935,8 +3932,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/thd.h \ include/grpc++/resource_quota.h \ include/grpc++/security/auth_context.h \ include/grpc++/security/auth_metadata_processor.h \ @@ -3984,7 +3979,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_stream.h \ include/grpc++/impl/codegen/time.h \ include/grpc/impl/codegen/byte_buffer_reader.h \ @@ -4330,7 +4324,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_stream.h \ include/grpc++/impl/codegen/time.h \ include/grpc/impl/codegen/byte_buffer_reader.h \ @@ -4461,8 +4454,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/thd.h \ include/grpc++/resource_quota.h \ include/grpc++/security/auth_context.h \ include/grpc++/security/auth_metadata_processor.h \ @@ -4510,7 +4501,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_stream.h \ include/grpc++/impl/codegen/time.h \ include/grpc/impl/codegen/byte_buffer_reader.h \ diff --git a/build.yaml b/build.yaml index 9714e3d5da5..42b7fb11dd4 100644 --- a/build.yaml +++ b/build.yaml @@ -710,8 +710,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/thd.h - include/grpc++/resource_quota.h - include/grpc++/security/auth_context.h - include/grpc++/security/auth_metadata_processor.h @@ -798,7 +796,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_stream.h - include/grpc++/impl/codegen/time.h uses: diff --git a/include/grpc++/impl/codegen/client_context.h b/include/grpc++/impl/codegen/client_context.h index 9b156bdc417..777b2f8847f 100644 --- a/include/grpc++/impl/codegen/client_context.h +++ b/include/grpc++/impl/codegen/client_context.h @@ -51,6 +51,7 @@ #include #include +#include #include #include @@ -59,7 +60,6 @@ #include #include #include -#include #include #include #include @@ -366,7 +366,7 @@ class ClientContext { bool idempotent_; bool cacheable_; std::shared_ptr channel_; - grpc::mutex mu_; + std::mutex mu_; grpc_call* call_; bool call_canceled_; gpr_timespec deadline_; diff --git a/include/grpc++/impl/codegen/sync.h b/include/grpc++/impl/codegen/sync.h deleted file mode 100644 index b94649b79fa..00000000000 --- a/include/grpc++/impl/codegen/sync.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef GRPCXX_IMPL_CODEGEN_SYNC_H -#define GRPCXX_IMPL_CODEGEN_SYNC_H - -#include -#include - -namespace grpc { - -using std::condition_variable; -using std::mutex; -using std::lock_guard; -using std::unique_lock; - -} // namespace grpc - -#endif // GRPCXX_IMPL_CODEGEN_SYNC_H diff --git a/include/grpc++/impl/sync.h b/include/grpc++/impl/sync.h deleted file mode 100644 index 3339cddba49..00000000000 --- a/include/grpc++/impl/sync.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef GRPCXX_IMPL_SYNC_H -#define GRPCXX_IMPL_SYNC_H - -#include - -#endif // GRPCXX_IMPL_SYNC_H diff --git a/include/grpc++/impl/thd.h b/include/grpc++/impl/thd.h deleted file mode 100644 index 87e1005d973..00000000000 --- a/include/grpc++/impl/thd.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef GRPCXX_IMPL_THD_H -#define GRPCXX_IMPL_THD_H - -#include - -namespace grpc { - -using std::thread; - -} // namespace grpc - -#endif // GRPCXX_IMPL_THD_H diff --git a/include/grpc++/server.h b/include/grpc++/server.h index 8035c63da4b..fba9952e6e7 100644 --- a/include/grpc++/server.h +++ b/include/grpc++/server.h @@ -34,8 +34,10 @@ #ifndef GRPCXX_SERVER_H #define GRPCXX_SERVER_H +#include #include #include +#include #include #include @@ -43,7 +45,6 @@ #include #include #include -#include #include #include #include @@ -197,12 +198,12 @@ class Server final : public ServerInterface, private GrpcLibraryCodegen { std::vector> sync_req_mgrs_; // Sever status - grpc::mutex mu_; + std::mutex mu_; bool started_; bool shutdown_; bool shutdown_notified_; // Was notify called on the shutdown_cv_ - grpc::condition_variable shutdown_cv_; + std::condition_variable shutdown_cv_; std::shared_ptr global_callbacks_; diff --git a/src/cpp/client/client_context.cc b/src/cpp/client/client_context.cc index ca4515d9a19..c073741dac0 100644 --- a/src/cpp/client/client_context.cc +++ b/src/cpp/client/client_context.cc @@ -93,7 +93,7 @@ void ClientContext::AddMetadata(const grpc::string& meta_key, void ClientContext::set_call(grpc_call* call, const std::shared_ptr& channel) { - grpc::unique_lock lock(mu_); + std::unique_lock lock(mu_); GPR_ASSERT(call_ == nullptr); call_ = call; channel_ = channel; @@ -119,7 +119,7 @@ void ClientContext::set_compression_algorithm( } void ClientContext::TryCancel() { - grpc::unique_lock lock(mu_); + std::unique_lock lock(mu_); if (call_) { grpc_call_cancel(call_, nullptr); } else { diff --git a/src/cpp/server/dynamic_thread_pool.cc b/src/cpp/server/dynamic_thread_pool.cc index 4b226c2992d..95a819d00ca 100644 --- a/src/cpp/server/dynamic_thread_pool.cc +++ b/src/cpp/server/dynamic_thread_pool.cc @@ -31,15 +31,15 @@ * */ -#include -#include +#include +#include #include "src/cpp/server/dynamic_thread_pool.h" namespace grpc { DynamicThreadPool::DynamicThread::DynamicThread(DynamicThreadPool* pool) : pool_(pool), - thd_(new grpc::thread(&DynamicThreadPool::DynamicThread::ThreadFunc, + thd_(new std::thread(&DynamicThreadPool::DynamicThread::ThreadFunc, this)) {} DynamicThreadPool::DynamicThread::~DynamicThread() { thd_->join(); @@ -49,7 +49,7 @@ DynamicThreadPool::DynamicThread::~DynamicThread() { void DynamicThreadPool::DynamicThread::ThreadFunc() { pool_->ThreadFunc(); // Now that we have killed ourselves, we should reduce the thread count - grpc::unique_lock lock(pool_->mu_); + std::unique_lock lock(pool_->mu_); pool_->nthreads_--; // Move ourselves to dead list pool_->dead_threads_.push_back(this); @@ -62,7 +62,7 @@ void DynamicThreadPool::DynamicThread::ThreadFunc() { void DynamicThreadPool::ThreadFunc() { for (;;) { // Wait until work is available or we are shutting down. - grpc::unique_lock lock(mu_); + std::unique_lock lock(mu_); if (!shutdown_ && callbacks_.empty()) { // If there are too many threads waiting, then quit this thread if (threads_waiting_ >= reserve_threads_) { @@ -91,7 +91,7 @@ DynamicThreadPool::DynamicThreadPool(int reserve_threads) nthreads_(0), threads_waiting_(0) { for (int i = 0; i < reserve_threads_; i++) { - grpc::lock_guard lock(mu_); + std::lock_guard lock(mu_); nthreads_++; new DynamicThread(this); } @@ -104,7 +104,7 @@ void DynamicThreadPool::ReapThreads(std::list* tlist) { } DynamicThreadPool::~DynamicThreadPool() { - grpc::unique_lock lock(mu_); + std::unique_lock lock(mu_); shutdown_ = true; cv_.notify_all(); while (nthreads_ != 0) { @@ -114,7 +114,7 @@ DynamicThreadPool::~DynamicThreadPool() { } void DynamicThreadPool::Add(const std::function& callback) { - grpc::lock_guard lock(mu_); + std::lock_guard lock(mu_); // Add works to the callbacks list callbacks_.push(callback); // Increase pool size or notify as needed diff --git a/src/cpp/server/dynamic_thread_pool.h b/src/cpp/server/dynamic_thread_pool.h index 61b1cc95857..4f8c4111cc0 100644 --- a/src/cpp/server/dynamic_thread_pool.h +++ b/src/cpp/server/dynamic_thread_pool.h @@ -34,12 +34,13 @@ #ifndef GRPC_INTERNAL_CPP_DYNAMIC_THREAD_POOL_H #define GRPC_INTERNAL_CPP_DYNAMIC_THREAD_POOL_H +#include #include #include +#include #include +#include -#include -#include #include #include "src/cpp/server/thread_pool_interface.h" @@ -61,12 +62,12 @@ class DynamicThreadPool final : public ThreadPoolInterface { private: DynamicThreadPool* pool_; - std::unique_ptr thd_; + std::unique_ptr thd_; void ThreadFunc(); }; - grpc::mutex mu_; - grpc::condition_variable cv_; - grpc::condition_variable shutdown_cv_; + std::mutex mu_; + std::condition_variable cv_; + std::condition_variable shutdown_cv_; bool shutdown_; std::queue> callbacks_; int reserve_threads_; diff --git a/src/cpp/server/server_cc.cc b/src/cpp/server/server_cc.cc index 7f32848e29e..b7cfd6dbf11 100644 --- a/src/cpp/server/server_cc.cc +++ b/src/cpp/server/server_cc.cc @@ -379,7 +379,7 @@ Server::Server( Server::~Server() { { - grpc::unique_lock lock(mu_); + std::unique_lock lock(mu_); if (started_ && !shutdown_) { lock.unlock(); Shutdown(); @@ -501,7 +501,7 @@ bool Server::Start(ServerCompletionQueue** cqs, size_t num_cqs) { } void Server::ShutdownInternal(gpr_timespec deadline) { - grpc::unique_lock lock(mu_); + std::unique_lock lock(mu_); if (started_ && !shutdown_) { shutdown_ = true; @@ -549,7 +549,7 @@ void Server::ShutdownInternal(gpr_timespec deadline) { } void Server::Wait() { - grpc::unique_lock lock(mu_); + std::unique_lock lock(mu_); while (started_ && !shutdown_notified_) { shutdown_cv_.wait(lock); } diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index 559b5bf82ad..a66ec4ac841 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -33,9 +33,10 @@ #include +#include + #include #include -#include #include #include #include @@ -76,20 +77,20 @@ class ServerContext::CompletionOp final : public CallOpSetInterface { private: bool CheckCancelledNoPluck() { - grpc::lock_guard g(mu_); + std::lock_guard g(mu_); return finalized_ ? (cancelled_ != 0) : false; } bool has_tag_; void* tag_; - grpc::mutex mu_; + std::mutex mu_; int refs_; bool finalized_; int cancelled_; }; void ServerContext::CompletionOp::Unref() { - grpc::unique_lock lock(mu_); + std::unique_lock lock(mu_); if (--refs_ == 0) { lock.unlock(); delete this; @@ -105,7 +106,7 @@ void ServerContext::CompletionOp::FillOps(grpc_op* ops, size_t* nops) { } bool ServerContext::CompletionOp::FinalizeResult(void** tag, bool* status) { - grpc::unique_lock lock(mu_); + std::unique_lock lock(mu_); finalized_ = true; bool ret = false; if (has_tag_) { diff --git a/src/cpp/thread_manager/thread_manager.cc b/src/cpp/thread_manager/thread_manager.cc index caae4c457d8..1450d009e4f 100644 --- a/src/cpp/thread_manager/thread_manager.cc +++ b/src/cpp/thread_manager/thread_manager.cc @@ -31,12 +31,13 @@ * */ -#include -#include -#include +#include "src/cpp/thread_manager/thread_manager.h" + #include +#include +#include -#include "src/cpp/thread_manager/thread_manager.h" +#include namespace grpc { @@ -59,7 +60,7 @@ ThreadManager::ThreadManager(int min_pollers, int max_pollers) ThreadManager::~ThreadManager() { { - std::unique_lock lock(mu_); + std::unique_lock lock(mu_); GPR_ASSERT(num_threads_ == 0); } @@ -67,29 +68,29 @@ ThreadManager::~ThreadManager() { } void ThreadManager::Wait() { - std::unique_lock lock(mu_); + std::unique_lock lock(mu_); while (num_threads_ != 0) { shutdown_cv_.wait(lock); } } void ThreadManager::Shutdown() { - std::unique_lock lock(mu_); + std::unique_lock lock(mu_); shutdown_ = true; } bool ThreadManager::IsShutdown() { - std::unique_lock lock(mu_); + std::unique_lock lock(mu_); return shutdown_; } void ThreadManager::MarkAsCompleted(WorkerThread* thd) { { - std::unique_lock list_lock(list_mu_); + std::unique_lock list_lock(list_mu_); completed_threads_.push_back(thd); } - grpc::unique_lock lock(mu_); + std::unique_lock lock(mu_); num_threads_--; if (num_threads_ == 0) { shutdown_cv_.notify_one(); @@ -97,7 +98,7 @@ void ThreadManager::MarkAsCompleted(WorkerThread* thd) { } void ThreadManager::CleanupCompletedThreads() { - std::unique_lock lock(list_mu_); + std::unique_lock lock(list_mu_); for (auto thd = completed_threads_.begin(); thd != completed_threads_.end(); thd = completed_threads_.erase(thd)) { delete *thd; @@ -114,7 +115,7 @@ void ThreadManager::Initialize() { // less than max threshold (i.e max_pollers_) and the total number of threads is // below the maximum threshold, we can let the current thread continue as poller bool ThreadManager::MaybeContinueAsPoller() { - std::unique_lock lock(mu_); + std::unique_lock lock(mu_); if (shutdown_ || num_pollers_ > max_pollers_) { return false; } @@ -127,7 +128,7 @@ bool ThreadManager::MaybeContinueAsPoller() { // threads currently blocked in PollForWork()) is below the threshold (i.e // min_pollers_) and the total number of threads is below the maximum threshold void ThreadManager::MaybeCreatePoller() { - grpc::unique_lock lock(mu_); + std::unique_lock lock(mu_); if (!shutdown_ && num_pollers_ < min_pollers_) { num_pollers_++; num_threads_++; @@ -156,7 +157,7 @@ void ThreadManager::MainWorkLoop() { WorkStatus work_status = PollForWork(&tag, &ok); { - grpc::unique_lock lock(mu_); + std::unique_lock lock(mu_); num_pollers_--; if (work_status == TIMEOUT && num_pollers_ > min_pollers_) { diff --git a/src/cpp/thread_manager/thread_manager.h b/src/cpp/thread_manager/thread_manager.h index 9cfdb8af25f..9c0569c62c1 100644 --- a/src/cpp/thread_manager/thread_manager.h +++ b/src/cpp/thread_manager/thread_manager.h @@ -34,11 +34,12 @@ #ifndef GRPC_INTERNAL_CPP_THREAD_MANAGER_H #define GRPC_INTERNAL_CPP_THREAD_MANAGER_H +#include #include #include +#include +#include -#include -#include #include namespace grpc { @@ -115,7 +116,7 @@ class ThreadManager { void Run(); ThreadManager* thd_mgr_; - grpc::thread thd_; + std::thread thd_; }; // The main funtion in ThreadManager @@ -134,10 +135,10 @@ class ThreadManager { // Protects shutdown_, num_pollers_ and num_threads_ // TODO: sreek - Change num_pollers and num_threads_ to atomics - grpc::mutex mu_; + std::mutex mu_; bool shutdown_; - grpc::condition_variable shutdown_cv_; + std::condition_variable shutdown_cv_; // Number of threads doing polling int num_pollers_; @@ -150,7 +151,7 @@ class ThreadManager { // currently polling i.e num_pollers_) int num_threads_; - grpc::mutex list_mu_; + std::mutex list_mu_; std::list completed_threads_; }; diff --git a/test/cpp/end2end/filter_end2end_test.cc b/test/cpp/end2end/filter_end2end_test.cc index 588cabcd42a..ab6ed46de56 100644 --- a/test/cpp/end2end/filter_end2end_test.cc +++ b/test/cpp/end2end/filter_end2end_test.cc @@ -78,35 +78,35 @@ namespace { int global_num_connections = 0; int global_num_calls = 0; -mutex global_mu; +std::mutex global_mu; void IncrementConnectionCounter() { - unique_lock lock(global_mu); + std::unique_lock lock(global_mu); ++global_num_connections; } void ResetConnectionCounter() { - unique_lock lock(global_mu); + std::unique_lock lock(global_mu); global_num_connections = 0; } int GetConnectionCounterValue() { - unique_lock lock(global_mu); + std::unique_lock lock(global_mu); return global_num_connections; } void IncrementCallCounter() { - unique_lock lock(global_mu); + std::unique_lock lock(global_mu); ++global_num_calls; } void ResetCallCounter() { - unique_lock lock(global_mu); + std::unique_lock lock(global_mu); global_num_calls = 0; } int GetCallCounterValue() { - unique_lock lock(global_mu); + std::unique_lock lock(global_mu); return global_num_calls; } diff --git a/test/cpp/end2end/server_builder_plugin_test.cc b/test/cpp/end2end/server_builder_plugin_test.cc index 94e4612c4f3..1b6f4ce37d8 100644 --- a/test/cpp/end2end/server_builder_plugin_test.cc +++ b/test/cpp/end2end/server_builder_plugin_test.cc @@ -31,13 +31,14 @@ * */ +#include + #include #include #include #include #include #include -#include #include #include #include @@ -191,7 +192,7 @@ class ServerBuilderPluginTest : public ::testing::TestWithParam { // we run some tests without a service, and for those we need to supply a // frequently polled completion queue cq_ = builder_->AddCompletionQueue(); - cq_thread_ = new grpc::thread(&ServerBuilderPluginTest::RunCQ, this); + cq_thread_ = new std::thread(&ServerBuilderPluginTest::RunCQ, this); server_ = builder_->BuildAndStart(); EXPECT_TRUE(CheckPresent()); } @@ -225,7 +226,7 @@ class ServerBuilderPluginTest : public ::testing::TestWithParam { std::unique_ptr stub_; std::unique_ptr cq_; std::unique_ptr server_; - grpc::thread* cq_thread_; + std::thread* cq_thread_; TestServiceImpl service_; int port_; diff --git a/test/cpp/end2end/thread_stress_test.cc b/test/cpp/end2end/thread_stress_test.cc index 107e38664e3..fe5a219eed7 100644 --- a/test/cpp/end2end/thread_stress_test.cc +++ b/test/cpp/end2end/thread_stress_test.cc @@ -91,7 +91,7 @@ class TestServiceImpl : public ::grpc::testing::EchoTestService::Service { MaybeEchoDeadline(context, request, response); if (request->has_param() && request->param().client_cancel_after_us()) { { - unique_lock lock(mu_); + std::unique_lock lock(mu_); signal_client_ = true; } while (!context->IsCancelled()) { @@ -156,13 +156,13 @@ class TestServiceImpl : public ::grpc::testing::EchoTestService::Service { } bool signal_client() { - unique_lock lock(mu_); + std::unique_lock lock(mu_); return signal_client_; } private: bool signal_client_; - mutex mu_; + std::mutex mu_; }; class TestServiceImplDupPkg @@ -249,7 +249,7 @@ class CommonStressTestAsyncServer } void TearDown() override { { - unique_lock l(mu_); + std::unique_lock l(mu_); TearDownStart(); shutting_down_ = true; cq_->Shutdown(); @@ -292,7 +292,7 @@ class CommonStressTestAsyncServer } } void RefreshContext(int i) { - unique_lock l(mu_); + std::unique_lock l(mu_); if (!shutting_down_) { contexts_[i].state = Context::READY; contexts_[i].srv_ctx.reset(new ServerContext); @@ -315,7 +315,7 @@ class CommonStressTestAsyncServer ::grpc::testing::EchoTestService::AsyncService service_; std::unique_ptr cq_; bool shutting_down_; - mutex mu_; + std::mutex mu_; std::vector server_threads_; }; @@ -379,7 +379,7 @@ class AsyncClientEnd2endTest : public ::testing::Test { } void Wait() { - unique_lock l(mu_); + std::unique_lock l(mu_); while (rpcs_outstanding_ != 0) { cv_.wait(l); } @@ -404,7 +404,7 @@ class AsyncClientEnd2endTest : public ::testing::Test { call->response_reader->Finish(&call->response, &call->status, (void*)call); - unique_lock l(mu_); + std::unique_lock l(mu_); rpcs_outstanding_++; } } @@ -422,7 +422,7 @@ class AsyncClientEnd2endTest : public ::testing::Test { bool notify; { - unique_lock l(mu_); + std::unique_lock l(mu_); rpcs_outstanding_--; notify = (rpcs_outstanding_ == 0); } @@ -434,8 +434,8 @@ class AsyncClientEnd2endTest : public ::testing::Test { Common common_; CompletionQueue cq_; - mutex mu_; - condition_variable cv_; + std::mutex mu_; + std::condition_variable cv_; int rpcs_outstanding_; }; diff --git a/test/cpp/interop/stress_test.cc b/test/cpp/interop/stress_test.cc index 46d09b7f285..fc35db5233a 100644 --- a/test/cpp/interop/stress_test.cc +++ b/test/cpp/interop/stress_test.cc @@ -40,7 +40,6 @@ #include #include #include -#include #include #include @@ -321,7 +320,7 @@ int main(int argc, char** argv) { gpr_log(GPR_INFO, "Starting test(s).."); - std::vector test_threads; + std::vector test_threads; // Create and start the test threads. // Note that: @@ -361,7 +360,7 @@ int main(int argc, char** argv) { "/stress_test/server_%d/channel_%d/stub_%d/qps", server_idx, channel_idx, stub_idx); - test_threads.emplace_back(grpc::thread( + test_threads.emplace_back(std::thread( &StressTestInteropClient::MainLoop, client, metrics_service.CreateQpsGauge(buffer, &is_already_created))); diff --git a/test/cpp/util/test_credentials_provider.cc b/test/cpp/util/test_credentials_provider.cc index ceee2b25cab..0456b966671 100644 --- a/test/cpp/util/test_credentials_provider.cc +++ b/test/cpp/util/test_credentials_provider.cc @@ -34,9 +34,9 @@ #include "test/cpp/util/test_credentials_provider.h" +#include #include -#include #include #include @@ -71,7 +71,7 @@ class DefaultCredentialsProvider : public CredentialsProvider { std::unique_ptr type_provider) override { // This clobbers any existing entry for type, except the defaults, which // can't be clobbered. - grpc::unique_lock lock(mu_); + std::unique_lock lock(mu_); auto it = std::find(added_secure_type_names_.begin(), added_secure_type_names_.end(), type); if (it == added_secure_type_names_.end()) { @@ -92,7 +92,7 @@ class DefaultCredentialsProvider : public CredentialsProvider { args->SetSslTargetNameOverride("foo.test.google.fr"); return SslCredentials(ssl_opts); } else { - grpc::unique_lock lock(mu_); + std::unique_lock lock(mu_); auto it(std::find(added_secure_type_names_.begin(), added_secure_type_names_.end(), type)); if (it == added_secure_type_names_.end()) { @@ -116,7 +116,7 @@ class DefaultCredentialsProvider : public CredentialsProvider { ssl_opts.pem_key_cert_pairs.push_back(pkcp); return SslServerCredentials(ssl_opts); } else { - grpc::unique_lock lock(mu_); + std::unique_lock lock(mu_); auto it(std::find(added_secure_type_names_.begin(), added_secure_type_names_.end(), type)); if (it == added_secure_type_names_.end()) { @@ -130,7 +130,7 @@ class DefaultCredentialsProvider : public CredentialsProvider { std::vector GetSecureCredentialsTypeList() override { std::vector types; types.push_back(grpc::testing::kTlsCredentialsType); - grpc::unique_lock lock(mu_); + std::unique_lock lock(mu_); for (auto it = added_secure_type_names_.begin(); it != added_secure_type_names_.end(); it++) { types.push_back(*it); @@ -139,7 +139,7 @@ class DefaultCredentialsProvider : public CredentialsProvider { } private: - grpc::mutex mu_; + std::mutex mu_; std::vector added_secure_type_names_; std::vector> added_secure_type_providers_; diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index d0f771489e5..ff3a0e381da 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -781,8 +781,6 @@ include/grpc++/impl/server_builder_option.h \ 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/thd.h \ include/grpc++/resource_quota.h \ include/grpc++/security/auth_context.h \ include/grpc++/security/auth_metadata_processor.h \ @@ -830,7 +828,6 @@ include/grpc++/impl/codegen/status_code_enum.h \ 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_stream.h \ include/grpc++/impl/codegen/time.h \ include/grpc/impl/codegen/byte_buffer_reader.h \ diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 8cff9e06da8..a55e9052529 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -781,8 +781,6 @@ include/grpc++/impl/server_builder_option.h \ 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/thd.h \ include/grpc++/resource_quota.h \ include/grpc++/security/auth_context.h \ include/grpc++/security/auth_metadata_processor.h \ @@ -830,7 +828,6 @@ include/grpc++/impl/codegen/status_code_enum.h \ 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_stream.h \ include/grpc++/impl/codegen/time.h \ include/grpc/impl/codegen/byte_buffer_reader.h \ diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index 3e77e4194ed..f4d87e16473 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -7438,8 +7438,6 @@ "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/thd.h", "include/grpc++/resource_quota.h", "include/grpc++/security/auth_context.h", "include/grpc++/security/auth_metadata_processor.h", @@ -7492,8 +7490,6 @@ "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/thd.h", "include/grpc++/resource_quota.h", "include/grpc++/security/auth_context.h", "include/grpc++/security/auth_metadata_processor.h", @@ -7582,7 +7578,6 @@ "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_stream.h", "include/grpc++/impl/codegen/time.h" ], @@ -7616,7 +7611,6 @@ "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_stream.h", "include/grpc++/impl/codegen/time.h" ], diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj b/vsprojects/vcxproj/grpc++/grpc++.vcxproj index 34cc10b9fc1..e8946043b64 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj @@ -279,8 +279,6 @@ - - @@ -328,7 +326,6 @@ - diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters index 93e0ae2ace4..e7d6d557f11 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters @@ -174,12 +174,6 @@ include\grpc++\impl - - include\grpc++\impl - - - include\grpc++\impl - include\grpc++ @@ -321,9 +315,6 @@ include\grpc++\impl\codegen - - include\grpc++\impl\codegen - include\grpc++\impl\codegen diff --git a/vsprojects/vcxproj/grpc++_test_util/grpc++_test_util.vcxproj b/vsprojects/vcxproj/grpc++_test_util/grpc++_test_util.vcxproj index 533771f6250..d2305b2e255 100644 --- a/vsprojects/vcxproj/grpc++_test_util/grpc++_test_util.vcxproj +++ b/vsprojects/vcxproj/grpc++_test_util/grpc++_test_util.vcxproj @@ -173,7 +173,6 @@ - diff --git a/vsprojects/vcxproj/grpc++_test_util/grpc++_test_util.vcxproj.filters b/vsprojects/vcxproj/grpc++_test_util/grpc++_test_util.vcxproj.filters index a328cba327c..d1aaba70926 100644 --- a/vsprojects/vcxproj/grpc++_test_util/grpc++_test_util.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++_test_util/grpc++_test_util.vcxproj.filters @@ -111,9 +111,6 @@ include\grpc++\impl\codegen - - include\grpc++\impl\codegen - include\grpc++\impl\codegen diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj index 1183056da88..17285752422 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj @@ -279,8 +279,6 @@ - - @@ -328,7 +326,6 @@ - diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters index a8871cbe5c5..7fc8ed33fcd 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters @@ -159,12 +159,6 @@ include\grpc++\impl - - include\grpc++\impl - - - include\grpc++\impl - include\grpc++ @@ -306,9 +300,6 @@ include\grpc++\impl\codegen - - include\grpc++\impl\codegen - include\grpc++\impl\codegen diff --git a/vsprojects/vcxproj/test/codegen_test_full/codegen_test_full.vcxproj b/vsprojects/vcxproj/test/codegen_test_full/codegen_test_full.vcxproj index 0e4bd0f07c6..a2b2a1dfa0f 100644 --- a/vsprojects/vcxproj/test/codegen_test_full/codegen_test_full.vcxproj +++ b/vsprojects/vcxproj/test/codegen_test_full/codegen_test_full.vcxproj @@ -186,7 +186,6 @@ - diff --git a/vsprojects/vcxproj/test/codegen_test_full/codegen_test_full.vcxproj.filters b/vsprojects/vcxproj/test/codegen_test_full/codegen_test_full.vcxproj.filters index ff50a90b3aa..94b6c2530ef 100644 --- a/vsprojects/vcxproj/test/codegen_test_full/codegen_test_full.vcxproj.filters +++ b/vsprojects/vcxproj/test/codegen_test_full/codegen_test_full.vcxproj.filters @@ -99,9 +99,6 @@ include\grpc++\impl\codegen - - include\grpc++\impl\codegen - include\grpc++\impl\codegen diff --git a/vsprojects/vcxproj/test/codegen_test_minimal/codegen_test_minimal.vcxproj b/vsprojects/vcxproj/test/codegen_test_minimal/codegen_test_minimal.vcxproj index 881fd4ece46..1a3c1579837 100644 --- a/vsprojects/vcxproj/test/codegen_test_minimal/codegen_test_minimal.vcxproj +++ b/vsprojects/vcxproj/test/codegen_test_minimal/codegen_test_minimal.vcxproj @@ -186,7 +186,6 @@ - diff --git a/vsprojects/vcxproj/test/codegen_test_minimal/codegen_test_minimal.vcxproj.filters b/vsprojects/vcxproj/test/codegen_test_minimal/codegen_test_minimal.vcxproj.filters index cc2668ed065..1f4b60ca4d9 100644 --- a/vsprojects/vcxproj/test/codegen_test_minimal/codegen_test_minimal.vcxproj.filters +++ b/vsprojects/vcxproj/test/codegen_test_minimal/codegen_test_minimal.vcxproj.filters @@ -102,9 +102,6 @@ include\grpc++\impl\codegen - - include\grpc++\impl\codegen - include\grpc++\impl\codegen diff --git a/vsprojects/vcxproj/test/grpc_tool_test/grpc_tool_test.vcxproj b/vsprojects/vcxproj/test/grpc_tool_test/grpc_tool_test.vcxproj index acb11e11119..1e3cc3ca043 100644 --- a/vsprojects/vcxproj/test/grpc_tool_test/grpc_tool_test.vcxproj +++ b/vsprojects/vcxproj/test/grpc_tool_test/grpc_tool_test.vcxproj @@ -187,7 +187,6 @@ - diff --git a/vsprojects/vcxproj/test/grpc_tool_test/grpc_tool_test.vcxproj.filters b/vsprojects/vcxproj/test/grpc_tool_test/grpc_tool_test.vcxproj.filters index 3d8459d8126..1c308c58817 100644 --- a/vsprojects/vcxproj/test/grpc_tool_test/grpc_tool_test.vcxproj.filters +++ b/vsprojects/vcxproj/test/grpc_tool_test/grpc_tool_test.vcxproj.filters @@ -93,9 +93,6 @@ include\grpc++\impl\codegen - - include\grpc++\impl\codegen - include\grpc++\impl\codegen From da050b643e302db24d840f02c475655c01182333 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 1 Nov 2016 17:17:28 -0700 Subject: [PATCH 15/20] Fixed weird whitespace change --- src/core/lib/iomgr/tcp_uv.c | 62 ++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/src/core/lib/iomgr/tcp_uv.c b/src/core/lib/iomgr/tcp_uv.c index b90e0c80082..8e74c9e8633 100644 --- a/src/core/lib/iomgr/tcp_uv.c +++ b/src/core/lib/iomgr/tcp_uv.c @@ -1,35 +1,35 @@ /* -* -* Copyright 2016, Google Inc. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are -* met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above -* copyright notice, this list of conditions and the following disclaimer -* in the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Google Inc. nor the names of its -* contributors may be used to endorse or promote products derived from -* this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ + * + * Copyright 2016, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ #include "src/core/lib/iomgr/port.h" From 0109d16ac0158b6ab60a8ea5c94707c639736414 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Tue, 1 Nov 2016 17:20:42 -0700 Subject: [PATCH 16/20] clang-format --- src/cpp/server/dynamic_thread_pool.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpp/server/dynamic_thread_pool.cc b/src/cpp/server/dynamic_thread_pool.cc index 95a819d00ca..1fdc2edb259 100644 --- a/src/cpp/server/dynamic_thread_pool.cc +++ b/src/cpp/server/dynamic_thread_pool.cc @@ -40,7 +40,7 @@ namespace grpc { DynamicThreadPool::DynamicThread::DynamicThread(DynamicThreadPool* pool) : pool_(pool), thd_(new std::thread(&DynamicThreadPool::DynamicThread::ThreadFunc, - this)) {} + this)) {} DynamicThreadPool::DynamicThread::~DynamicThread() { thd_->join(); thd_.reset(); From 029ed106c5780fe94f18b46e433abaa1f5e603b7 Mon Sep 17 00:00:00 2001 From: Matt Kwong Date: Tue, 1 Nov 2016 18:04:47 -0700 Subject: [PATCH 17/20] Enable port tests to be run using gcc4.8 --- .../dockerfile/test/cxx_ubuntu1604_x64/Dockerfile.template | 2 +- tools/dockerfile/test/cxx_ubuntu1604_x64/Dockerfile | 2 +- tools/run_tests/run_tests.py | 4 +++- tools/run_tests/tests.json | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/templates/tools/dockerfile/test/cxx_ubuntu1604_x64/Dockerfile.template b/templates/tools/dockerfile/test/cxx_ubuntu1604_x64/Dockerfile.template index 42ad6c130da..2d780d74f88 100644 --- a/templates/tools/dockerfile/test/cxx_ubuntu1604_x64/Dockerfile.template +++ b/templates/tools/dockerfile/test/cxx_ubuntu1604_x64/Dockerfile.template @@ -39,7 +39,7 @@ # The clang-3.6 symlink for the default clang version was added # to Ubuntu 16.04 recently, so make sure it's installed. # Also install clang3.7. - RUN apt-get update && apt-get -y install clang-3.6 clang-3.7 && apt-get clean + RUN apt-get update && apt-get -y install gcc-4.8 gcc-4.8-multilib g++-4.8 g++-4.8-multilib clang-3.6 clang-3.7 && apt-get clean # Define the default command. CMD ["bash"] diff --git a/tools/dockerfile/test/cxx_ubuntu1604_x64/Dockerfile b/tools/dockerfile/test/cxx_ubuntu1604_x64/Dockerfile index 2d282276d31..b4847124cfc 100644 --- a/tools/dockerfile/test/cxx_ubuntu1604_x64/Dockerfile +++ b/tools/dockerfile/test/cxx_ubuntu1604_x64/Dockerfile @@ -97,7 +97,7 @@ RUN mkdir /var/local/jenkins # The clang-3.6 symlink for the default clang version was added # to Ubuntu 16.04 recently, so make sure it's installed. # Also install clang3.7. -RUN apt-get update && apt-get -y install clang-3.6 clang-3.7 && apt-get clean +RUN apt-get update && apt-get -y install gcc-4.8 gcc-4.8-multilib g++-4.8 g++-4.8-multilib clang-3.6 clang-3.7 && apt-get clean # Define the default command. CMD ["bash"] diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index 911843e9f36..05f819bd9bb 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -332,6 +332,8 @@ class CLanguage(object): return ('wheezy', self._gcc_make_options(version_suffix='-4.4')) elif compiler == 'gcc4.6': return ('wheezy', self._gcc_make_options(version_suffix='-4.6')) + elif compiler == 'gcc4.8': + return ('ubuntu1604', self._gcc_make_options(version_suffix='-4.8')) elif compiler == 'gcc5.3': return ('ubuntu1604', []) elif compiler == 'clang3.4': @@ -1061,7 +1063,7 @@ argp.add_argument('--arch', help='Selects architecture to target. For some platforms "default" is the only supported choice.') argp.add_argument('--compiler', choices=['default', - 'gcc4.4', 'gcc4.6', 'gcc4.9', 'gcc5.3', + 'gcc4.4', 'gcc4.6', 'gcc4.8', 'gcc4.9', 'gcc5.3', 'clang3.4', 'clang3.5', 'clang3.6', 'clang3.7', 'vs2010', 'vs2013', 'vs2015', 'python2.7', 'python3.4', 'python3.5', 'python3.6', 'pypy', 'pypy3', diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json index 733bfe3b8fd..39daf859b46 100644 --- a/tools/run_tests/tests.json +++ b/tools/run_tests/tests.json @@ -3003,6 +3003,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c++", From 5bdcd237fc907eb4dc334e89d8ae2fa00c0f2720 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Wed, 2 Nov 2016 15:47:02 -0700 Subject: [PATCH 18/20] RR: Don't copy user_data is no vtable --- src/core/ext/lb_policy/round_robin/round_robin.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/ext/lb_policy/round_robin/round_robin.c b/src/core/ext/lb_policy/round_robin/round_robin.c index b0c461730b3..427999aa6b8 100644 --- a/src/core/ext/lb_policy/round_robin/round_robin.c +++ b/src/core/ext/lb_policy/round_robin/round_robin.c @@ -678,8 +678,10 @@ static grpc_lb_policy *round_robin_create(grpc_exec_ctx *exec_ctx, sd->index = subchannel_idx; sd->subchannel = subchannel; sd->user_data_vtable = addresses->user_data_vtable; - sd->user_data = - sd->user_data_vtable->copy(addresses->addresses[i].user_data); + if (sd->user_data_vtable != NULL) { + sd->user_data = + sd->user_data_vtable->copy(addresses->addresses[i].user_data); + } ++subchannel_idx; grpc_closure_init(&sd->connectivity_changed_closure, rr_connectivity_changed, sd); From a189b7b9f144ae811a5e725b102acb06cab31b89 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Wed, 2 Nov 2016 17:49:42 -0700 Subject: [PATCH 19/20] Make new file compliant with new standards --- test/cpp/end2end/round_robin_end2end_test.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/cpp/end2end/round_robin_end2end_test.cc b/test/cpp/end2end/round_robin_end2end_test.cc index 796b01cd4ac..76211cbdd3e 100644 --- a/test/cpp/end2end/round_robin_end2end_test.cc +++ b/test/cpp/end2end/round_robin_end2end_test.cc @@ -66,21 +66,21 @@ class MyTestServiceImpl : public TestServiceImpl { MyTestServiceImpl() : request_count_(0) {} Status Echo(ServerContext* context, const EchoRequest* request, - EchoResponse* response) GRPC_OVERRIDE { + EchoResponse* response) override { { - unique_lock lock(mu_); + std::unique_lock lock(mu_); ++request_count_; } return TestServiceImpl::Echo(context, request, response); } int request_count() { - unique_lock lock(mu_); + std::unique_lock lock(mu_); return request_count_; } private: - mutex mu_; + std::mutex mu_; int request_count_; }; @@ -94,7 +94,7 @@ class RoundRobinEnd2endTest : public ::testing::Test { } } - void TearDown() GRPC_OVERRIDE { + void TearDown() override { for (size_t i = 0; i < servers_.size(); ++i) { servers_[i]->Shutdown(); } @@ -139,7 +139,7 @@ class RoundRobinEnd2endTest : public ::testing::Test { std::condition_variable cond; thread_.reset(new std::thread( std::bind(&ServerData::Start, this, server_host, &mu, &cond))); - unique_lock lock(mu); + std::unique_lock lock(mu); cond.wait(lock); gpr_log(GPR_INFO, "server startup complete"); } @@ -153,7 +153,7 @@ class RoundRobinEnd2endTest : public ::testing::Test { InsecureServerCredentials()); builder.RegisterService(&service_); server_ = builder.BuildAndStart(); - lock_guard lock(*mu); + std::lock_guard lock(*mu); cond->notify_one(); } From 107ca164b061ce01163bbfa8c7433fba52f38526 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Wed, 2 Nov 2016 18:17:03 -0700 Subject: [PATCH 20/20] Use the right address family --- src/core/ext/lb_policy/grpclb/grpclb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/ext/lb_policy/grpclb/grpclb.c b/src/core/ext/lb_policy/grpclb/grpclb.c index 734108a9db0..30e412e3580 100644 --- a/src/core/ext/lb_policy/grpclb/grpclb.c +++ b/src/core/ext/lb_policy/grpclb/grpclb.c @@ -402,7 +402,7 @@ static void parse_server(const grpc_grpclb_server *server, } else if (ip->size == 16) { addr->len = sizeof(struct sockaddr_in6); struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)&addr->addr; - addr6->sin6_family = AF_INET; + addr6->sin6_family = AF_INET6; memcpy(&addr6->sin6_addr, ip->bytes, ip->size); addr6->sin6_port = netorder_port; }