From 4f8a416f703b2196958777f897e9d3b1caf5b9ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Vo=C3=9F?= Date: Wed, 27 Sep 2017 09:43:14 +0200 Subject: [PATCH 01/86] Increase reference count on state used in tcp connect. The state is used both in the callback for the actual connect as well as in the additional timeout that is setup for the operation. Both code paths decrease the reference count and if they happen to be queued at the same time, memory is corrupted. Subsequent behavior is undefined and segfaults can be observed as a result. Fixes #12608 --- src/core/lib/iomgr/tcp_client_uv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/lib/iomgr/tcp_client_uv.c b/src/core/lib/iomgr/tcp_client_uv.c index 786c456b735..f2b23aae2e6 100644 --- a/src/core/lib/iomgr/tcp_client_uv.c +++ b/src/core/lib/iomgr/tcp_client_uv.c @@ -145,7 +145,7 @@ static void tcp_client_connect_impl(grpc_exec_ctx *exec_ctx, connect->resource_quota = resource_quota; uv_tcp_init(uv_default_loop(), connect->tcp_handle); connect->connect_req.data = connect; - connect->refs = 1; + connect->refs = 2; // One for the connect operation, one for the timer. if (GRPC_TRACER_ON(grpc_tcp_trace)) { gpr_log(GPR_DEBUG, "CLIENT_CONNECT: %s: asynchronously connecting", From d05f2f77d297e8d24480f87bbab9ee73cf014f7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Vo=C3=9F?= Date: Sat, 30 Sep 2017 13:01:42 +0200 Subject: [PATCH 02/86] Fix up whitespace --- src/core/lib/iomgr/tcp_client_uv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/lib/iomgr/tcp_client_uv.c b/src/core/lib/iomgr/tcp_client_uv.c index f2b23aae2e6..0d9e7ed5f6e 100644 --- a/src/core/lib/iomgr/tcp_client_uv.c +++ b/src/core/lib/iomgr/tcp_client_uv.c @@ -145,7 +145,7 @@ static void tcp_client_connect_impl(grpc_exec_ctx *exec_ctx, connect->resource_quota = resource_quota; uv_tcp_init(uv_default_loop(), connect->tcp_handle); connect->connect_req.data = connect; - connect->refs = 2; // One for the connect operation, one for the timer. + connect->refs = 2; // One for the connect operation, one for the timer. if (GRPC_TRACER_ON(grpc_tcp_trace)) { gpr_log(GPR_DEBUG, "CLIENT_CONNECT: %s: asynchronously connecting", From 5e8c48669ffcd14469184bcc708a994b2eaa85a4 Mon Sep 17 00:00:00 2001 From: Chris Bacon Date: Tue, 3 Oct 2017 15:15:54 +0100 Subject: [PATCH 03/86] De-register cancellation token Fixes #12800 --- src/csharp/Grpc.Core/Internal/AsyncCall.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/csharp/Grpc.Core/Internal/AsyncCall.cs b/src/csharp/Grpc.Core/Internal/AsyncCall.cs index 17109de587b..09fb722c816 100644 --- a/src/csharp/Grpc.Core/Internal/AsyncCall.cs +++ b/src/csharp/Grpc.Core/Internal/AsyncCall.cs @@ -34,6 +34,9 @@ namespace Grpc.Core.Internal readonly CallInvocationDetails details; readonly INativeCall injectedNativeCall; // for testing + // Dispose of to de-register cancellation token registration + IDisposable cancellationTokenRegistration; + // Completion of a pending unary response if not null. TaskCompletionSource unaryResponseTcs; @@ -320,6 +323,7 @@ namespace Grpc.Core.Internal protected override void OnAfterReleaseResources() { details.Channel.RemoveCallReference(this); + cancellationTokenRegistration?.Dispose(); } protected override bool IsClient @@ -405,7 +409,7 @@ namespace Grpc.Core.Internal var token = details.Options.CancellationToken; if (token.CanBeCanceled) { - token.Register(() => this.Cancel()); + cancellationTokenRegistration = token.Register(() => this.Cancel()); } } From bb872c02d9c988f80ddb5add8e9291a9766b2c65 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 4 Oct 2017 16:59:49 +0200 Subject: [PATCH 04/86] allow cancelling MoveNext operations --- src/csharp/Grpc.Core/IAsyncStreamReader.cs | 5 +++++ .../Internal/ClientResponseStream.cs | 20 +++++++++---------- .../Grpc.Core/Internal/ServerRequestStream.cs | 11 +++++----- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/csharp/Grpc.Core/IAsyncStreamReader.cs b/src/csharp/Grpc.Core/IAsyncStreamReader.cs index 42bfbb87e01..4a169fcca5d 100644 --- a/src/csharp/Grpc.Core/IAsyncStreamReader.cs +++ b/src/csharp/Grpc.Core/IAsyncStreamReader.cs @@ -41,6 +41,11 @@ namespace Grpc.Core /// (MoveNext will return false) and the CancellationToken /// associated with the call will be cancelled to signal the failure. /// + /// + /// MoveNext() operations can be cancelled via a cancellation token. Cancelling + /// an individual read operation has the same effect as cancelling the entire call + /// (which will also result in the read operation returning prematurely). + /// /// /// The message type. public interface IAsyncStreamReader : IAsyncEnumerator diff --git a/src/csharp/Grpc.Core/Internal/ClientResponseStream.cs b/src/csharp/Grpc.Core/Internal/ClientResponseStream.cs index 851b6ca213c..ab649ee7662 100644 --- a/src/csharp/Grpc.Core/Internal/ClientResponseStream.cs +++ b/src/csharp/Grpc.Core/Internal/ClientResponseStream.cs @@ -49,19 +49,19 @@ namespace Grpc.Core.Internal public async Task MoveNext(CancellationToken token) { - if (token != CancellationToken.None) + var cancellationTokenRegistration = token.CanBeCanceled ? token.Register(() => call.Cancel()) : (IDisposable) null; + using (cancellationTokenRegistration) { - throw new InvalidOperationException("Cancellation of individual reads is not supported."); - } - var result = await call.ReadMessageAsync().ConfigureAwait(false); - this.current = result; + var result = await call.ReadMessageAsync().ConfigureAwait(false); + this.current = result; - if (result == null) - { - await call.StreamingResponseCallFinishedTask.ConfigureAwait(false); - return false; + if (result == null) + { + await call.StreamingResponseCallFinishedTask.ConfigureAwait(false); + return false; + } + return true; } - return true; } public void Dispose() diff --git a/src/csharp/Grpc.Core/Internal/ServerRequestStream.cs b/src/csharp/Grpc.Core/Internal/ServerRequestStream.cs index c65b960afb2..058dddb7ebb 100644 --- a/src/csharp/Grpc.Core/Internal/ServerRequestStream.cs +++ b/src/csharp/Grpc.Core/Internal/ServerRequestStream.cs @@ -49,13 +49,14 @@ namespace Grpc.Core.Internal public async Task MoveNext(CancellationToken token) { - if (token != CancellationToken.None) + + var cancellationTokenRegistration = token.CanBeCanceled ? token.Register(() => call.Cancel()) : (IDisposable) null; + using (cancellationTokenRegistration) { - throw new InvalidOperationException("Cancellation of individual reads is not supported."); + var result = await call.ReadMessageAsync().ConfigureAwait(false); + this.current = result; + return result != null; } - var result = await call.ReadMessageAsync().ConfigureAwait(false); - this.current = result; - return result != null; } public void Dispose() From f8c9bcdc0f083e29302ab10cf11ea1c645edf4ae Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 4 Oct 2017 17:39:59 +0200 Subject: [PATCH 05/86] introduce CallCancellationTest --- .../Grpc.Core.Tests/CallCancellationTest.cs | 182 ++++++++++++++++++ .../Grpc.Core.Tests/ClientServerTest.cs | 68 ------- src/csharp/tests.json | 1 + 3 files changed, 183 insertions(+), 68 deletions(-) create mode 100644 src/csharp/Grpc.Core.Tests/CallCancellationTest.cs diff --git a/src/csharp/Grpc.Core.Tests/CallCancellationTest.cs b/src/csharp/Grpc.Core.Tests/CallCancellationTest.cs new file mode 100644 index 00000000000..e4e859d5160 --- /dev/null +++ b/src/csharp/Grpc.Core.Tests/CallCancellationTest.cs @@ -0,0 +1,182 @@ +#region Copyright notice and license + +// Copyright 2015 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#endregion + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Grpc.Core; +using Grpc.Core.Internal; +using Grpc.Core.Profiling; +using Grpc.Core.Utils; +using NUnit.Framework; + +namespace Grpc.Core.Tests +{ + public class CallCancellationTest + { + const string Host = "127.0.0.1"; + + MockServiceHelper helper; + Server server; + Channel channel; + + [SetUp] + public void Init() + { + helper = new MockServiceHelper(Host); + server = helper.GetServer(); + server.Start(); + channel = helper.GetChannel(); + } + + [TearDown] + public void Cleanup() + { + channel.ShutdownAsync().Wait(); + server.ShutdownAsync().Wait(); + } + + [Test] + public async Task ClientStreamingCall_CancelAfterBegin() + { + var barrier = new TaskCompletionSource(); + + helper.ClientStreamingHandler = new ClientStreamingServerMethod(async (requestStream, context) => + { + barrier.SetResult(null); + await requestStream.ToListAsync(); + return ""; + }); + + var cts = new CancellationTokenSource(); + var call = Calls.AsyncClientStreamingCall(helper.CreateClientStreamingCall(new CallOptions(cancellationToken: cts.Token))); + + await barrier.Task; // make sure the handler has started. + cts.Cancel(); + + try + { + // cannot use Assert.ThrowsAsync because it uses Task.Wait and would deadlock. + await call.ResponseAsync; + Assert.Fail(); + } + catch (RpcException ex) + { + Assert.AreEqual(StatusCode.Cancelled, ex.Status.StatusCode); + } + } + + [Test] + public async Task ClientStreamingCall_ServerSideReadAfterCancelNotificationReturnsNull() + { + var handlerStartedBarrier = new TaskCompletionSource(); + var cancelNotificationReceivedBarrier = new TaskCompletionSource(); + var successTcs = new TaskCompletionSource(); + + helper.ClientStreamingHandler = new ClientStreamingServerMethod(async (requestStream, context) => + { + handlerStartedBarrier.SetResult(null); + + // wait for cancellation to be delivered. + context.CancellationToken.Register(() => cancelNotificationReceivedBarrier.SetResult(null)); + await cancelNotificationReceivedBarrier.Task; + + var moveNextResult = await requestStream.MoveNext(); + successTcs.SetResult(!moveNextResult ? "SUCCESS" : "FAIL"); + return ""; + }); + + var cts = new CancellationTokenSource(); + var call = Calls.AsyncClientStreamingCall(helper.CreateClientStreamingCall(new CallOptions(cancellationToken: cts.Token))); + + await handlerStartedBarrier.Task; + cts.Cancel(); + + try + { + await call.ResponseAsync; + Assert.Fail(); + } + catch (RpcException ex) + { + Assert.AreEqual(StatusCode.Cancelled, ex.Status.StatusCode); + } + Assert.AreEqual("SUCCESS", await successTcs.Task); + } + + [Test] + public async Task ClientStreamingCall_CancelServerSideRead() + { + helper.ClientStreamingHandler = new ClientStreamingServerMethod(async (requestStream, context) => + { + var cts = new CancellationTokenSource(); + var moveNextTask = requestStream.MoveNext(cts.Token); + await Task.Delay(100); + cts.Cancel(); + await moveNextTask; + return ""; + }); + + var call = Calls.AsyncClientStreamingCall(helper.CreateClientStreamingCall()); + try + { + // cannot use Assert.ThrowsAsync because it uses Task.Wait and would deadlock. + await call.ResponseAsync; + Assert.Fail(); + } + catch (RpcException ex) + { + Assert.AreEqual(StatusCode.Cancelled, ex.Status.StatusCode); + } + } + + [Test] + public async Task ServerStreamingCall_CancelClientSideRead() + { + helper.ServerStreamingHandler = new ServerStreamingServerMethod(async (request, responseStream, context) => + { + await responseStream.WriteAsync("abc"); + await Task.Delay(10000); + await responseStream.WriteAsync("def"); + }); + + var call = Calls.AsyncServerStreamingCall(helper.CreateServerStreamingCall(), ""); + await call.ResponseStream.MoveNext(); + Assert.AreEqual("abc", call.ResponseStream.Current); + + var cts = new CancellationTokenSource(); + var moveNextTask = call.ResponseStream.MoveNext(cts.Token); + await Task.Delay(100); + cts.Cancel(); + + try + { + // cannot use Assert.ThrowsAsync because it uses Task.Wait and would deadlock. + await moveNextTask; + Assert.Fail(); + } + catch (RpcException ex) + { + Assert.AreEqual(StatusCode.Cancelled, ex.Status.StatusCode); + } + } + } +} diff --git a/src/csharp/Grpc.Core.Tests/ClientServerTest.cs b/src/csharp/Grpc.Core.Tests/ClientServerTest.cs index 72d9035a6ff..90dd365b07e 100644 --- a/src/csharp/Grpc.Core.Tests/ClientServerTest.cs +++ b/src/csharp/Grpc.Core.Tests/ClientServerTest.cs @@ -272,74 +272,6 @@ namespace Grpc.Core.Tests Assert.AreEqual("xyz-value", call.GetTrailers()[0].Value); } - [Test] - public async Task ClientStreamingCall_CancelAfterBegin() - { - var barrier = new TaskCompletionSource(); - - helper.ClientStreamingHandler = new ClientStreamingServerMethod(async (requestStream, context) => - { - barrier.SetResult(null); - await requestStream.ToListAsync(); - return ""; - }); - - var cts = new CancellationTokenSource(); - var call = Calls.AsyncClientStreamingCall(helper.CreateClientStreamingCall(new CallOptions(cancellationToken: cts.Token))); - - await barrier.Task; // make sure the handler has started. - cts.Cancel(); - - try - { - // cannot use Assert.ThrowsAsync because it uses Task.Wait and would deadlock. - await call.ResponseAsync; - Assert.Fail(); - } - catch (RpcException ex) - { - Assert.AreEqual(StatusCode.Cancelled, ex.Status.StatusCode); - } - } - - [Test] - public async Task ClientStreamingCall_ServerSideReadAfterCancelNotificationReturnsNull() - { - var handlerStartedBarrier = new TaskCompletionSource(); - var cancelNotificationReceivedBarrier = new TaskCompletionSource(); - var successTcs = new TaskCompletionSource(); - - helper.ClientStreamingHandler = new ClientStreamingServerMethod(async (requestStream, context) => - { - handlerStartedBarrier.SetResult(null); - - // wait for cancellation to be delivered. - context.CancellationToken.Register(() => cancelNotificationReceivedBarrier.SetResult(null)); - await cancelNotificationReceivedBarrier.Task; - - var moveNextResult = await requestStream.MoveNext(); - successTcs.SetResult(!moveNextResult ? "SUCCESS" : "FAIL"); - return ""; - }); - - var cts = new CancellationTokenSource(); - var call = Calls.AsyncClientStreamingCall(helper.CreateClientStreamingCall(new CallOptions(cancellationToken: cts.Token))); - - await handlerStartedBarrier.Task; - cts.Cancel(); - - try - { - await call.ResponseAsync; - Assert.Fail(); - } - catch (RpcException ex) - { - Assert.AreEqual(StatusCode.Cancelled, ex.Status.StatusCode); - } - Assert.AreEqual("SUCCESS", await successTcs.Task); - } - [Test] public async Task AsyncUnaryCall_EchoMetadata() { diff --git a/src/csharp/tests.json b/src/csharp/tests.json index 78410510526..65a0ed293f6 100644 --- a/src/csharp/tests.json +++ b/src/csharp/tests.json @@ -10,6 +10,7 @@ "Grpc.Core.Tests.AppDomainUnloadTest", "Grpc.Core.Tests.AuthContextTest", "Grpc.Core.Tests.AuthPropertyTest", + "Grpc.Core.Tests.CallCancellationTest", "Grpc.Core.Tests.CallCredentialsTest", "Grpc.Core.Tests.CallOptionsTest", "Grpc.Core.Tests.ChannelCredentialsTest", From 90e9140211976db14e3752dff84442cbed2b3c94 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 4 Oct 2017 14:02:22 -0700 Subject: [PATCH 06/86] 1.7.x is now 1.7.0-pre1 --- BUILD | 4 ++-- CMakeLists.txt | 2 +- Makefile | 4 ++-- build.yaml | 2 +- gRPC-Core.podspec | 2 +- gRPC-ProtoRPC.podspec | 2 +- gRPC-RxLibrary.podspec | 2 +- gRPC.podspec | 2 +- package.json | 2 +- package.xml | 4 ++-- src/cpp/common/version_cc.cc | 2 +- src/csharp/Grpc.Core/Version.csproj.include | 2 +- src/csharp/Grpc.Core/VersionInfo.cs | 2 +- src/csharp/build_packages_dotnetcli.bat | 2 +- src/csharp/build_packages_dotnetcli.sh | 4 ++-- src/node/health_check/package.json | 4 ++-- src/node/tools/package.json | 2 +- src/objective-c/!ProtoCompiler-gRPCPlugin.podspec | 2 +- src/objective-c/GRPCClient/private/version.h | 2 +- src/php/ext/grpc/version.h | 2 +- src/python/grpcio/grpc/_grpcio_metadata.py | 2 +- src/python/grpcio/grpc_version.py | 2 +- src/python/grpcio_health_checking/grpc_version.py | 2 +- src/python/grpcio_reflection/grpc_version.py | 2 +- src/python/grpcio_testing/grpc_version.py | 2 +- src/python/grpcio_tests/grpc_version.py | 2 +- src/ruby/lib/grpc/version.rb | 2 +- src/ruby/tools/version.rb | 2 +- tools/distrib/python/grpcio_tools/grpc_version.py | 2 +- tools/doxygen/Doxyfile.c++ | 2 +- tools/doxygen/Doxyfile.c++.internal | 2 +- 31 files changed, 36 insertions(+), 36 deletions(-) diff --git a/BUILD b/BUILD index dfcded21976..5eaafae3fde 100644 --- a/BUILD +++ b/BUILD @@ -36,9 +36,9 @@ load( # This should be updated along with build.yaml g_stands_for = "gambit" -core_version = "4.0.0-dev" +core_version = "5.0.0-dev" -version = "1.7.0-dev" +version = "1.7.0-pre1" GPR_PUBLIC_HDRS = [ "include/grpc/support/alloc.h", diff --git a/CMakeLists.txt b/CMakeLists.txt index 2e448c92b66..f2514323c83 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ cmake_minimum_required(VERSION 2.8) set(PACKAGE_NAME "grpc") -set(PACKAGE_VERSION "1.7.0-dev") +set(PACKAGE_VERSION "1.7.0-pre1") set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/") diff --git a/Makefile b/Makefile index 517ddfd90e0..c7f9f7da814 100644 --- a/Makefile +++ b/Makefile @@ -411,8 +411,8 @@ Q = @ endif CORE_VERSION = 5.0.0-dev -CPP_VERSION = 1.7.0-dev -CSHARP_VERSION = 1.7.0-dev +CPP_VERSION = 1.7.0-pre1 +CSHARP_VERSION = 1.7.0-pre1 CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES)) CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) diff --git a/build.yaml b/build.yaml index 9b5aacc4c8f..4ef08c21300 100644 --- a/build.yaml +++ b/build.yaml @@ -14,7 +14,7 @@ settings: '#10': See the expand_version.py for all the quirks here core_version: 5.0.0-dev g_stands_for: gambit - version: 1.7.0-dev + version: 1.7.0-pre1 filegroups: - name: census public_headers: diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index d34c271dbaf..8497035c829 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -22,7 +22,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-Core' - version = '1.7.0-dev' + version = '1.7.0-pre1' s.version = version s.summary = 'Core cross-platform gRPC library, written in C' s.homepage = 'https://grpc.io' diff --git a/gRPC-ProtoRPC.podspec b/gRPC-ProtoRPC.podspec index cb40330dab5..4b7b36a6874 100644 --- a/gRPC-ProtoRPC.podspec +++ b/gRPC-ProtoRPC.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-ProtoRPC' - version = '1.7.0-dev' + version = '1.7.0-pre1' s.version = version s.summary = 'RPC library for Protocol Buffers, based on gRPC' s.homepage = 'https://grpc.io' diff --git a/gRPC-RxLibrary.podspec b/gRPC-RxLibrary.podspec index 52bd8ed0ae1..673239cb90a 100644 --- a/gRPC-RxLibrary.podspec +++ b/gRPC-RxLibrary.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-RxLibrary' - version = '1.7.0-dev' + version = '1.7.0-pre1' s.version = version s.summary = 'Reactive Extensions library for iOS/OSX.' s.homepage = 'https://grpc.io' diff --git a/gRPC.podspec b/gRPC.podspec index 79315e46f31..8ce4d5e854d 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -20,7 +20,7 @@ Pod::Spec.new do |s| s.name = 'gRPC' - version = '1.7.0-dev' + version = '1.7.0-pre1' s.version = version s.summary = 'gRPC client library for iOS/OSX' s.homepage = 'https://grpc.io' diff --git a/package.json b/package.json index 2e31275bf02..55a5a6bcdae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "grpc", - "version": "1.7.0-dev", + "version": "1.7.0-pre1", "author": "Google Inc.", "description": "gRPC Library for Node", "homepage": "https://grpc.io/", diff --git a/package.xml b/package.xml index 0eea122b24e..2c2e5c83e3f 100644 --- a/package.xml +++ b/package.xml @@ -13,8 +13,8 @@ 2017-08-24 - 1.7.0dev - 1.7.0dev + 1.7.0RC1 + 1.7.0RC1 beta diff --git a/src/cpp/common/version_cc.cc b/src/cpp/common/version_cc.cc index 2e9a51316d4..766c6148fee 100644 --- a/src/cpp/common/version_cc.cc +++ b/src/cpp/common/version_cc.cc @@ -22,5 +22,5 @@ #include namespace grpc { -grpc::string Version() { return "1.7.0-dev"; } +grpc::string Version() { return "1.7.0-pre1"; } } diff --git a/src/csharp/Grpc.Core/Version.csproj.include b/src/csharp/Grpc.Core/Version.csproj.include index 124ecab14cd..76fd55cf930 100755 --- a/src/csharp/Grpc.Core/Version.csproj.include +++ b/src/csharp/Grpc.Core/Version.csproj.include @@ -1,7 +1,7 @@ - 1.7.0-dev + 1.7.0-pre1 3.3.0 diff --git a/src/csharp/Grpc.Core/VersionInfo.cs b/src/csharp/Grpc.Core/VersionInfo.cs index 588cc845165..fbffbb079c6 100644 --- a/src/csharp/Grpc.Core/VersionInfo.cs +++ b/src/csharp/Grpc.Core/VersionInfo.cs @@ -38,6 +38,6 @@ namespace Grpc.Core /// /// Current version of gRPC C# /// - public const string CurrentVersion = "1.7.0-dev"; + public const string CurrentVersion = "1.7.0-pre1"; } } diff --git a/src/csharp/build_packages_dotnetcli.bat b/src/csharp/build_packages_dotnetcli.bat index c419d870492..8377f6ccc78 100755 --- a/src/csharp/build_packages_dotnetcli.bat +++ b/src/csharp/build_packages_dotnetcli.bat @@ -13,7 +13,7 @@ @rem limitations under the License. @rem Current package versions -set VERSION=1.7.0-dev +set VERSION=1.7.0-pre1 @rem Adjust the location of nuget.exe set NUGET=C:\nuget\nuget.exe diff --git a/src/csharp/build_packages_dotnetcli.sh b/src/csharp/build_packages_dotnetcli.sh index 124dfbb257e..30d2bc6bfcf 100755 --- a/src/csharp/build_packages_dotnetcli.sh +++ b/src/csharp/build_packages_dotnetcli.sh @@ -39,7 +39,7 @@ dotnet pack --configuration Release Grpc.Auth --output ../../../artifacts dotnet pack --configuration Release Grpc.HealthCheck --output ../../../artifacts dotnet pack --configuration Release Grpc.Reflection --output ../../../artifacts -nuget pack Grpc.nuspec -Version "1.7.0-dev" -OutputDirectory ../../artifacts -nuget pack Grpc.Tools.nuspec -Version "1.7.0-dev" -OutputDirectory ../../artifacts +nuget pack Grpc.nuspec -Version "1.7.0-pre1" -OutputDirectory ../../artifacts +nuget pack Grpc.Tools.nuspec -Version "1.7.0-pre1" -OutputDirectory ../../artifacts (cd ../../artifacts && zip csharp_nugets_dotnetcli.zip *.nupkg) diff --git a/src/node/health_check/package.json b/src/node/health_check/package.json index 3c7d3707ee0..0942d28018f 100644 --- a/src/node/health_check/package.json +++ b/src/node/health_check/package.json @@ -1,6 +1,6 @@ { "name": "grpc-health-check", - "version": "1.7.0-dev", + "version": "1.7.0-pre1", "author": "Google Inc.", "description": "Health check service for use with gRPC", "repository": { @@ -15,7 +15,7 @@ } ], "dependencies": { - "grpc": "^1.7.0-dev", + "grpc": "^1.7.0-pre1", "lodash": "^3.9.3", "google-protobuf": "^3.0.0" }, diff --git a/src/node/tools/package.json b/src/node/tools/package.json index d9b1fb86c91..6863b3a57d2 100644 --- a/src/node/tools/package.json +++ b/src/node/tools/package.json @@ -1,6 +1,6 @@ { "name": "grpc-tools", - "version": "1.7.0-dev", + "version": "1.7.0-pre1", "author": "Google Inc.", "description": "Tools for developing with gRPC on Node.js", "homepage": "https://grpc.io/", diff --git a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec index 7d073c9a848..19eb0ca1ab2 100644 --- a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec +++ b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec @@ -42,7 +42,7 @@ Pod::Spec.new do |s| # exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed # before them. s.name = '!ProtoCompiler-gRPCPlugin' - v = '1.7.0-dev' + v = '1.7.0-pre1' s.version = v s.summary = 'The gRPC ProtoC plugin generates Objective-C files from .proto services.' s.description = <<-DESC diff --git a/src/objective-c/GRPCClient/private/version.h b/src/objective-c/GRPCClient/private/version.h index 843954e84a0..82748febfd8 100644 --- a/src/objective-c/GRPCClient/private/version.h +++ b/src/objective-c/GRPCClient/private/version.h @@ -23,4 +23,4 @@ // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.7.0-dev" +#define GRPC_OBJC_VERSION_STRING @"1.7.0-pre1" diff --git a/src/php/ext/grpc/version.h b/src/php/ext/grpc/version.h index 07d8eee7fe2..4be72ba2bce 100644 --- a/src/php/ext/grpc/version.h +++ b/src/php/ext/grpc/version.h @@ -20,6 +20,6 @@ #ifndef VERSION_H #define VERSION_H -#define PHP_GRPC_VERSION "1.7.0dev" +#define PHP_GRPC_VERSION "1.7.0RC1" #endif /* VERSION_H */ diff --git a/src/python/grpcio/grpc/_grpcio_metadata.py b/src/python/grpcio/grpc/_grpcio_metadata.py index a4eb358c4ee..6cceafffe72 100644 --- a/src/python/grpcio/grpc/_grpcio_metadata.py +++ b/src/python/grpcio/grpc/_grpcio_metadata.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc/_grpcio_metadata.py.template`!!! -__version__ = """1.7.0.dev0""" +__version__ = """1.7.0rc1""" diff --git a/src/python/grpcio/grpc_version.py b/src/python/grpcio/grpc_version.py index 3194a893d7e..1a5121247ea 100644 --- a/src/python/grpcio/grpc_version.py +++ b/src/python/grpcio/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_version.py.template`!!! -VERSION='1.7.0.dev0' +VERSION='1.7.0rc1' diff --git a/src/python/grpcio_health_checking/grpc_version.py b/src/python/grpcio_health_checking/grpc_version.py index ef68bad17a0..5c8f192fb84 100644 --- a/src/python/grpcio_health_checking/grpc_version.py +++ b/src/python/grpcio_health_checking/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_health_checking/grpc_version.py.template`!!! -VERSION='1.7.0.dev0' +VERSION='1.7.0rc1' diff --git a/src/python/grpcio_reflection/grpc_version.py b/src/python/grpcio_reflection/grpc_version.py index 55ab959cc57..827006c1621 100644 --- a/src/python/grpcio_reflection/grpc_version.py +++ b/src/python/grpcio_reflection/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_reflection/grpc_version.py.template`!!! -VERSION='1.7.0.dev0' +VERSION='1.7.0rc1' diff --git a/src/python/grpcio_testing/grpc_version.py b/src/python/grpcio_testing/grpc_version.py index 592d08efc36..e765bf3f935 100644 --- a/src/python/grpcio_testing/grpc_version.py +++ b/src/python/grpcio_testing/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_testing/grpc_version.py.template`!!! -VERSION='1.7.0.dev0' +VERSION='1.7.0rc1' diff --git a/src/python/grpcio_tests/grpc_version.py b/src/python/grpcio_tests/grpc_version.py index 9e54dc9f75b..36048082537 100644 --- a/src/python/grpcio_tests/grpc_version.py +++ b/src/python/grpcio_tests/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_tests/grpc_version.py.template`!!! -VERSION='1.7.0.dev0' +VERSION='1.7.0rc1' diff --git a/src/ruby/lib/grpc/version.rb b/src/ruby/lib/grpc/version.rb index 228c01a92c4..1dc79b706ba 100644 --- a/src/ruby/lib/grpc/version.rb +++ b/src/ruby/lib/grpc/version.rb @@ -14,5 +14,5 @@ # GRPC contains the General RPC module. module GRPC - VERSION = '1.7.0.dev' + VERSION = '1.7.0.pre1' end diff --git a/src/ruby/tools/version.rb b/src/ruby/tools/version.rb index ea0c4ae56cc..a27404f9460 100644 --- a/src/ruby/tools/version.rb +++ b/src/ruby/tools/version.rb @@ -14,6 +14,6 @@ module GRPC module Tools - VERSION = '1.7.0.dev' + VERSION = '1.7.0.pre1' end end diff --git a/tools/distrib/python/grpcio_tools/grpc_version.py b/tools/distrib/python/grpcio_tools/grpc_version.py index a4178a58c1f..81a92d6bd6a 100644 --- a/tools/distrib/python/grpcio_tools/grpc_version.py +++ b/tools/distrib/python/grpcio_tools/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/grpc_version.py.template`!!! -VERSION='1.7.0.dev0' +VERSION='1.7.0rc1' diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index d81b7b4d115..715237aa4b2 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.7.0-dev +PROJECT_NUMBER = 1.7.0-pre1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index eacb40c2123..46ce98f7b32 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.7.0-dev +PROJECT_NUMBER = 1.7.0-pre1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a From fb4cb27da275bc196ca6b449e7e55f6c40b40009 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 29 Sep 2017 17:08:59 -0700 Subject: [PATCH 07/86] Add PB_NO_PACKED_STRUCTS to gRPC-Core --- gRPC-Core.podspec | 1 + templates/gRPC-Core.podspec.template | 1 + 2 files changed, 2 insertions(+) diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index d34c271dbaf..e375ced2f67 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -84,6 +84,7 @@ Pod::Spec.new do |s| # build. 'USE_HEADERMAP' => 'NO', 'ALWAYS_SEARCH_USER_PATHS' => 'NO', + 'GCC_PREPROCESSOR_DEFINITIONS' => '"$(inherited)" "COCOAPODS=1" "PB_NO_PACKED_STRUCTS=1"', } s.default_subspecs = 'Interface', 'Implementation' diff --git a/templates/gRPC-Core.podspec.template b/templates/gRPC-Core.podspec.template index 22814849172..5dc020d7d93 100644 --- a/templates/gRPC-Core.podspec.template +++ b/templates/gRPC-Core.podspec.template @@ -119,6 +119,7 @@ # build. 'USE_HEADERMAP' => 'NO', 'ALWAYS_SEARCH_USER_PATHS' => 'NO', + 'GCC_PREPROCESSOR_DEFINITIONS' => '"$(inherited)" "COCOAPODS=1" "PB_NO_PACKED_STRUCTS=1"', } s.default_subspecs = 'Interface', 'Implementation' From 4f05af59ea53794170a3748a103bb14b780f1755 Mon Sep 17 00:00:00 2001 From: Alexander Polcyn Date: Mon, 11 Sep 2017 13:40:12 -0700 Subject: [PATCH 08/86] fix memory leak of ruby call objects --- src/ruby/ext/grpc/rb_call.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ruby/ext/grpc/rb_call.c b/src/ruby/ext/grpc/rb_call.c index 5550bb7d5f1..29c4a94816b 100644 --- a/src/ruby/ext/grpc/rb_call.c +++ b/src/ruby/ext/grpc/rb_call.c @@ -101,6 +101,7 @@ static void grpc_rb_call_destroy(void *p) { return; } destroy_call((grpc_rb_call *)p); + xfree(p); } static size_t md_ary_datasize(const void *p) { From ee35223174a0c48707d4148a5e87e0ec4942d41c Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 5 Oct 2017 16:11:34 +0200 Subject: [PATCH 09/86] improve docs --- src/csharp/Grpc.Core/IAsyncStreamReader.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/csharp/Grpc.Core/IAsyncStreamReader.cs b/src/csharp/Grpc.Core/IAsyncStreamReader.cs index 4a169fcca5d..3751d549e39 100644 --- a/src/csharp/Grpc.Core/IAsyncStreamReader.cs +++ b/src/csharp/Grpc.Core/IAsyncStreamReader.cs @@ -44,7 +44,9 @@ namespace Grpc.Core /// /// MoveNext() operations can be cancelled via a cancellation token. Cancelling /// an individual read operation has the same effect as cancelling the entire call - /// (which will also result in the read operation returning prematurely). + /// (which will also result in the read operation returning prematurely), but the per-read cancellation + /// tokens passed to MoveNext() only result in cancelling the call if the read operation haven't finished + /// yet. /// /// /// The message type. From 32d196f1b1859d6a0eaa906f65a82c42ad1b2c87 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 5 Oct 2017 16:34:00 +0200 Subject: [PATCH 10/86] remove delays in tests --- src/csharp/Grpc.Core.Tests/CallCancellationTest.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/csharp/Grpc.Core.Tests/CallCancellationTest.cs b/src/csharp/Grpc.Core.Tests/CallCancellationTest.cs index e4e859d5160..e040f52380a 100644 --- a/src/csharp/Grpc.Core.Tests/CallCancellationTest.cs +++ b/src/csharp/Grpc.Core.Tests/CallCancellationTest.cs @@ -129,7 +129,6 @@ namespace Grpc.Core.Tests { var cts = new CancellationTokenSource(); var moveNextTask = requestStream.MoveNext(cts.Token); - await Task.Delay(100); cts.Cancel(); await moveNextTask; return ""; @@ -154,8 +153,10 @@ namespace Grpc.Core.Tests helper.ServerStreamingHandler = new ServerStreamingServerMethod(async (request, responseStream, context) => { await responseStream.WriteAsync("abc"); - await Task.Delay(10000); - await responseStream.WriteAsync("def"); + while (!context.CancellationToken.IsCancellationRequested) + { + await Task.Delay(10); + } }); var call = Calls.AsyncServerStreamingCall(helper.CreateServerStreamingCall(), ""); @@ -164,7 +165,6 @@ namespace Grpc.Core.Tests var cts = new CancellationTokenSource(); var moveNextTask = call.ResponseStream.MoveNext(cts.Token); - await Task.Delay(100); cts.Cancel(); try From 05e0d2da35d822e0d3cad368ceb3848c6e035e4a Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 18 Sep 2017 17:30:20 -0700 Subject: [PATCH 11/86] Generate forward declaration in pbrpc.h --- src/compiler/objective_c_generator.cc | 21 +++++++++++++++++++++ src/compiler/objective_c_generator.h | 4 ++++ src/compiler/objective_c_plugin.cc | 18 ++++++++++-------- 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/src/compiler/objective_c_generator.cc b/src/compiler/objective_c_generator.cc index c05d15375b3..33b5fedd5c8 100644 --- a/src/compiler/objective_c_generator.cc +++ b/src/compiler/objective_c_generator.cc @@ -17,6 +17,7 @@ */ #include +#include #include #include "src/compiler/config.h" @@ -29,7 +30,9 @@ using ::google::protobuf::compiler::objectivec::ClassName; using ::grpc::protobuf::io::Printer; using ::grpc::protobuf::MethodDescriptor; using ::grpc::protobuf::ServiceDescriptor; +using ::grpc::protobuf::FileDescriptor; using ::std::map; +using ::std::set; namespace grpc_objective_c_generator { namespace { @@ -190,6 +193,24 @@ void PrintMethodImplementations(Printer *printer, } // namespace +::grpc::string GetAllMessageClasses(const FileDescriptor *file) { + ::grpc::string output; + set< ::grpc::string> classes; + for (int i = 0; i < file->service_count(); i++) { + const auto service = file->service(i); + for (int i = 0; i < service->method_count(); i++) { + const auto method = service->method(i); + classes.insert(ClassName(method->input_type())); + classes.insert(ClassName(method->output_type())); + } + } + for (auto one_class : classes) { + output += " @class " + one_class + ";\n"; + } + + return output; +} + ::grpc::string GetHeader(const ServiceDescriptor *service) { ::grpc::string output; { diff --git a/src/compiler/objective_c_generator.h b/src/compiler/objective_c_generator.h index edbee7ff524..e912a52415f 100644 --- a/src/compiler/objective_c_generator.h +++ b/src/compiler/objective_c_generator.h @@ -24,8 +24,12 @@ namespace grpc_objective_c_generator { using ::grpc::protobuf::ServiceDescriptor; +using ::grpc::protobuf::FileDescriptor; using ::grpc::string; +// Returns forward declaration of classes in the generated header file. +string GetAllMessageClasses(const FileDescriptor *file); + // Returns the content to be included in the "global_scope" insertion point of // the generated header file. string GetHeader(const ServiceDescriptor *service); diff --git a/src/compiler/objective_c_plugin.cc b/src/compiler/objective_c_plugin.cc index 96a3375e962..de878cf143b 100644 --- a/src/compiler/objective_c_plugin.cc +++ b/src/compiler/objective_c_plugin.cc @@ -58,9 +58,10 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { "#import \n" "#import \n"; - // TODO(jcanizales): Instead forward-declare the input and output types - // and import the files in the .pbrpc.m ::grpc::string proto_imports; + proto_imports += "#if GPB_GRPC_FORWARD_DECLARE_MESSAGE_PROTO\n" + + grpc_objective_c_generator::GetAllMessageClasses(file) + + "#else\n"; for (int i = 0; i < file->dependency_count(); i++) { ::grpc::string header = grpc_objective_c_generator::MessageHeaderName(file->dependency(i)); @@ -70,19 +71,20 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { grpc_generator::StripPrefix(&base_name, "google/protobuf/"); // create the import code snippet proto_imports += - "#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS\n" - " #import <" + + " #if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS\n" + " #import <" + ::grpc::string(ProtobufLibraryFrameworkName) + "/" + base_name + ">\n" - "#else\n" - " #import \"" + + " #else\n" + " #import \"" + header + "\"\n" - "#endif\n"; + " #endif\n"; } else { - proto_imports += ::grpc::string("#import \"") + header + "\"\n"; + proto_imports += ::grpc::string(" #import \"") + header + "\"\n"; } } + proto_imports += "#endif\n"; ::grpc::string declarations; for (int i = 0; i < file->service_count(); i++) { From 9635d4670c342663542081c4bb7f5e67536cd805 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Tue, 19 Sep 2017 09:46:12 -0700 Subject: [PATCH 12/86] Generate dependency header import in pbrpc.m --- src/compiler/objective_c_plugin.cc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/compiler/objective_c_plugin.cc b/src/compiler/objective_c_plugin.cc index de878cf143b..e751d0562e2 100644 --- a/src/compiler/objective_c_plugin.cc +++ b/src/compiler/objective_c_plugin.cc @@ -108,6 +108,28 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { ".pbrpc.h\"\n\n" "#import \n" "#import \n"; + for (int i = 0; i < file->dependency_count(); i++) { + ::grpc::string header = + grpc_objective_c_generator::MessageHeaderName(file->dependency(i)); + const grpc::protobuf::FileDescriptor *dependency = file->dependency(i); + if (IsProtobufLibraryBundledProtoFile(dependency)) { + ::grpc::string base_name = header; + grpc_generator::StripPrefix(&base_name, "google/protobuf/"); + // create the import code snippet + imports += + "#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS\n" + " #import <" + + ::grpc::string(ProtobufLibraryFrameworkName) + "/" + base_name + + ">\n" + "#else\n" + " #import \"" + + header + + "\"\n" + "#endif\n"; + } else { + imports += ::grpc::string("#import \"") + header + "\"\n"; + } + } ::grpc::string definitions; for (int i = 0; i < file->service_count(); i++) { From 2cbec4ce195c8b6365ea41bdf26fa5c5cd5cf2e5 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Thu, 5 Oct 2017 11:30:39 -0700 Subject: [PATCH 13/86] Add test for forward declaration --- src/objective-c/tests/RemoteTestClient/RemoteTest.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/objective-c/tests/RemoteTestClient/RemoteTest.podspec b/src/objective-c/tests/RemoteTestClient/RemoteTest.podspec index 1796c6d7462..ad834815951 100644 --- a/src/objective-c/tests/RemoteTestClient/RemoteTest.podspec +++ b/src/objective-c/tests/RemoteTestClient/RemoteTest.podspec @@ -47,7 +47,7 @@ Pod::Spec.new do |s| s.pod_target_xcconfig = { # This is needed by all pods that depend on Protobuf: - 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1', + 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1 GPB_GRPC_FORWARD_DECLARE_MESSAGE_PROTO=1', # This is needed by all pods that depend on gRPC-RxLibrary: 'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES', } From 405762733aea4f22dd36a9677a751d2808154b0b Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 6 Oct 2017 13:46:27 -0700 Subject: [PATCH 14/86] Make platform-specific headers textual --- gRPC-Core.podspec | 11 +++++ include/grpc/module.modulemap | 32 ++++++++++----- src/objective-c/BoringSSL.podspec | 6 ++- templates/gRPC-Core.podspec.template | 10 +---- .../include/grpc/module.modulemap.template | 41 +++++++++++++++---- 5 files changed, 70 insertions(+), 30 deletions(-) diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 46f8a3b999c..3faba23ca39 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -106,6 +106,8 @@ Pod::Spec.new do |s| ss.source_files = 'include/grpc/support/alloc.h', 'include/grpc/support/atm.h', 'include/grpc/support/atm_gcc_atomic.h', + 'include/grpc/support/atm_gcc_sync.h', + 'include/grpc/support/atm_windows.h', 'include/grpc/support/avl.h', 'include/grpc/support/cmdline.h', 'include/grpc/support/cpu.h', @@ -120,13 +122,18 @@ Pod::Spec.new do |s| 'include/grpc/support/sync_custom.h', 'include/grpc/support/sync_generic.h', 'include/grpc/support/sync_posix.h', + 'include/grpc/support/sync_windows.h', 'include/grpc/support/thd.h', 'include/grpc/support/time.h', 'include/grpc/support/tls.h', + 'include/grpc/support/tls_gcc.h', + 'include/grpc/support/tls_msvc.h', 'include/grpc/support/tls_pthread.h', 'include/grpc/support/useful.h', 'include/grpc/impl/codegen/atm.h', 'include/grpc/impl/codegen/atm_gcc_atomic.h', + 'include/grpc/impl/codegen/atm_gcc_sync.h', + 'include/grpc/impl/codegen/atm_windows.h', 'include/grpc/impl/codegen/gpr_slice.h', 'include/grpc/impl/codegen/gpr_types.h', 'include/grpc/impl/codegen/port_platform.h', @@ -134,6 +141,7 @@ Pod::Spec.new do |s| 'include/grpc/impl/codegen/sync_custom.h', 'include/grpc/impl/codegen/sync_generic.h', 'include/grpc/impl/codegen/sync_posix.h', + 'include/grpc/impl/codegen/sync_windows.h', 'include/grpc/impl/codegen/byte_buffer.h', 'include/grpc/impl/codegen/byte_buffer_reader.h', 'include/grpc/impl/codegen/compression_types.h', @@ -145,6 +153,8 @@ Pod::Spec.new do |s| 'include/grpc/impl/codegen/status.h', 'include/grpc/impl/codegen/atm.h', 'include/grpc/impl/codegen/atm_gcc_atomic.h', + 'include/grpc/impl/codegen/atm_gcc_sync.h', + 'include/grpc/impl/codegen/atm_windows.h', 'include/grpc/impl/codegen/gpr_slice.h', 'include/grpc/impl/codegen/gpr_types.h', 'include/grpc/impl/codegen/port_platform.h', @@ -152,6 +162,7 @@ Pod::Spec.new do |s| 'include/grpc/impl/codegen/sync_custom.h', 'include/grpc/impl/codegen/sync_generic.h', 'include/grpc/impl/codegen/sync_posix.h', + 'include/grpc/impl/codegen/sync_windows.h', 'include/grpc/grpc_security.h', 'include/grpc/byte_buffer.h', 'include/grpc/byte_buffer_reader.h', diff --git a/include/grpc/module.modulemap b/include/grpc/module.modulemap index 226cc6cf871..342adc0dc93 100644 --- a/include/grpc/module.modulemap +++ b/include/grpc/module.modulemap @@ -4,7 +4,6 @@ framework module grpc { header "support/alloc.h" header "support/atm.h" - header "support/atm_gcc_atomic.h" header "support/avl.h" header "support/cmdline.h" header "support/cpu.h" @@ -16,23 +15,17 @@ framework module grpc { header "support/string_util.h" header "support/subprocess.h" header "support/sync.h" - header "support/sync_custom.h" header "support/sync_generic.h" - header "support/sync_posix.h" header "support/thd.h" header "support/time.h" header "support/tls.h" - header "support/tls_pthread.h" header "support/useful.h" header "impl/codegen/atm.h" - header "impl/codegen/atm_gcc_atomic.h" header "impl/codegen/gpr_slice.h" header "impl/codegen/gpr_types.h" header "impl/codegen/port_platform.h" header "impl/codegen/sync.h" - header "impl/codegen/sync_custom.h" header "impl/codegen/sync_generic.h" - header "impl/codegen/sync_posix.h" header "impl/codegen/byte_buffer.h" header "impl/codegen/byte_buffer_reader.h" header "impl/codegen/compression_types.h" @@ -43,14 +36,11 @@ framework module grpc { header "impl/codegen/slice.h" header "impl/codegen/status.h" header "impl/codegen/atm.h" - header "impl/codegen/atm_gcc_atomic.h" header "impl/codegen/gpr_slice.h" header "impl/codegen/gpr_types.h" header "impl/codegen/port_platform.h" header "impl/codegen/sync.h" - header "impl/codegen/sync_custom.h" header "impl/codegen/sync_generic.h" - header "impl/codegen/sync_posix.h" header "grpc_security.h" header "byte_buffer.h" header "byte_buffer_reader.h" @@ -65,6 +55,28 @@ framework module grpc { header "support/workaround_list.h" header "census.h" + textual header "support/atm_gcc_atomic.h" + textual header "support/atm_gcc_sync.h" + textual header "support/atm_windows.h" + textual header "support/sync_custom.h" + textual header "support/sync_posix.h" + textual header "support/sync_windows.h" + textual header "support/tls_gcc.h" + textual header "support/tls_msvc.h" + textual header "support/tls_pthread.h" + textual header "impl/codegen/atm_gcc_atomic.h" + textual header "impl/codegen/atm_gcc_sync.h" + textual header "impl/codegen/atm_windows.h" + textual header "impl/codegen/sync_custom.h" + textual header "impl/codegen/sync_posix.h" + textual header "impl/codegen/sync_windows.h" + textual header "impl/codegen/atm_gcc_atomic.h" + textual header "impl/codegen/atm_gcc_sync.h" + textual header "impl/codegen/atm_windows.h" + textual header "impl/codegen/sync_custom.h" + textual header "impl/codegen/sync_posix.h" + textual header "impl/codegen/sync_windows.h" + export * module * { export * } } diff --git a/src/objective-c/BoringSSL.podspec b/src/objective-c/BoringSSL.podspec index 37798ec3c6b..c61afc1a8f7 100644 --- a/src/objective-c/BoringSSL.podspec +++ b/src/objective-c/BoringSSL.podspec @@ -31,7 +31,7 @@ Pod::Spec.new do |s| s.name = 'BoringSSL' - version = '9.0' + version = '9.1' s.version = version s.summary = 'BoringSSL is a fork of OpenSSL that is designed to meet Google’s needs.' # Adapted from the homepage: @@ -67,9 +67,10 @@ Pod::Spec.new do |s| # "The name and email addresses of the library maintainers, not the Podspec maintainer." s.authors = 'Adam Langley', 'David Benjamin', 'Matt Braithwaite' + major_version = version[0] + '.0' s.source = { :git => 'https://boringssl.googlesource.com/boringssl', - :tag => "version_for_cocoapods_#{version}", + :tag => "version_for_cocoapods_#{major_version}", } name = 'openssl' @@ -186,6 +187,7 @@ Pod::Spec.new do |s| cat > include/openssl/BoringSSL.modulemap < framework module grpc { umbrella header "grpc.h" ${header_lines(grpc_public_headers_no_dir(libs))} + ${textual_header_lines(grpc_public_textual_headers_no_dir(libs))} + export * module * { export * } } From 7a1fe0d2fb8265a3803ffdb9478197fd60076fdb Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 6 Oct 2017 15:33:10 -0700 Subject: [PATCH 15/86] Fix GID related subspec lint problem --- gRPC.podspec | 3 +++ templates/gRPC.podspec.template | 3 +++ 2 files changed, 6 insertions(+) diff --git a/gRPC.podspec b/gRPC.podspec index 8ce4d5e854d..6c200905416 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -63,10 +63,13 @@ Pod::Spec.new do |s| end s.subspec 'GID' do |ss| + ss.ios.deployment_target = '7.0' + ss.header_mappings_dir = "#{src_dir}" ss.source_files = "#{src_dir}/GRPCCall+GID.{h,m}" + ss.dependency "#{s.name}/Main", version ss.dependency 'Google/SignIn' end end diff --git a/templates/gRPC.podspec.template b/templates/gRPC.podspec.template index 5c92f9f9c42..4b360cfb4c4 100644 --- a/templates/gRPC.podspec.template +++ b/templates/gRPC.podspec.template @@ -65,10 +65,13 @@ end s.subspec 'GID' do |ss| + ss.ios.deployment_target = '7.0' + ss.header_mappings_dir = "#{src_dir}" ss.source_files = "#{src_dir}/GRPCCall+GID.{h,m}" + ss.dependency "#{s.name}/Main", version ss.dependency 'Google/SignIn' end end From 43cd1e731667dcdca610aa5f3435184f74519386 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 6 Oct 2017 16:27:47 -0700 Subject: [PATCH 16/86] Add comment --- templates/include/grpc/module.modulemap.template | 3 +++ 1 file changed, 3 insertions(+) diff --git a/templates/include/grpc/module.modulemap.template b/templates/include/grpc/module.modulemap.template index 9dde240e437..e18bc3de50d 100644 --- a/templates/include/grpc/module.modulemap.template +++ b/templates/include/grpc/module.modulemap.template @@ -27,6 +27,9 @@ out = [hdr.split('/', 2)[2] for hdr in out] return out + # Generate the list of platform-specific headers as textual headers so that + # they are not built when the module is built but only when they are named by + # an #include directive. def grpc_public_textual_headers_no_dir(libs): out = [] for lib in libs: From 9714e0376a2890b850496c981694af5f91a49353 Mon Sep 17 00:00:00 2001 From: Ken Payson Date: Tue, 10 Oct 2017 11:18:49 -0700 Subject: [PATCH 17/86] Add thread pool reset on fork with FORKING_SUPPORT_ENABLED --- BUILD | 6 ++ CMakeLists.txt | 29 +++++++ Makefile | 29 +++++++ binding.gyp | 3 + build.yaml | 7 ++ config.m4 | 3 + config.w32 | 3 + gRPC-Core.podspec | 10 +++ grpc.gemspec | 8 ++ grpc.gyp | 9 ++ include/grpc/fork.h | 24 ++++++ include/grpc/impl/codegen/fork.h | 49 +++++++++++ include/grpc/module.modulemap | 3 + package.xml | 8 ++ setup.py | 2 +- src/core/lib/iomgr/fork_posix.c | 83 +++++++++++++++++++ src/core/lib/iomgr/fork_windows.c | 42 ++++++++++ src/core/lib/support/fork.c | 62 ++++++++++++++ src/core/lib/support/fork.h | 35 ++++++++ src/core/lib/support/thd_internal.h | 30 +++++++ src/core/lib/support/thd_posix.c | 56 +++++++++++++ src/core/lib/support/thd_windows.c | 2 + src/core/lib/surface/init.c | 6 ++ src/python/grpcio/grpc_core_dependencies.py | 3 + .../core/surface/public_headers_must_be_c89.c | 2 + tools/doxygen/Doxyfile.c++ | 2 + tools/doxygen/Doxyfile.c++.internal | 4 + tools/doxygen/Doxyfile.core | 3 + tools/doxygen/Doxyfile.core.internal | 8 ++ .../generated/sources_and_headers.json | 11 +++ 30 files changed, 541 insertions(+), 1 deletion(-) create mode 100644 include/grpc/fork.h create mode 100644 include/grpc/impl/codegen/fork.h create mode 100644 src/core/lib/iomgr/fork_posix.c create mode 100644 src/core/lib/iomgr/fork_windows.c create mode 100644 src/core/lib/support/fork.c create mode 100644 src/core/lib/support/fork.h create mode 100644 src/core/lib/support/thd_internal.h diff --git a/BUILD b/BUILD index 5eaafae3fde..222cdac6df1 100644 --- a/BUILD +++ b/BUILD @@ -476,6 +476,7 @@ grpc_cc_library( "src/core/lib/support/env_linux.c", "src/core/lib/support/env_posix.c", "src/core/lib/support/env_windows.c", + "src/core/lib/support/fork.c", "src/core/lib/support/histogram.c", "src/core/lib/support/host_port.c", "src/core/lib/support/log.c", @@ -517,6 +518,7 @@ grpc_cc_library( "src/core/lib/support/backoff.h", "src/core/lib/support/block_annotate.h", "src/core/lib/support/env.h", + "src/core/lib/support/fork.h", "src/core/lib/support/memory.h", "src/core/lib/support/mpscq.h", "src/core/lib/support/murmur_hash.h", @@ -524,6 +526,7 @@ grpc_cc_library( "src/core/lib/support/stack_lockfree.h", "src/core/lib/support/string.h", "src/core/lib/support/string_windows.h", + "src/core/lib/support/thd_internal.h", "src/core/lib/support/time_precise.h", "src/core/lib/support/tmpfile.h", ], @@ -542,6 +545,7 @@ grpc_cc_library( "include/grpc/impl/codegen/atm_gcc_atomic.h", "include/grpc/impl/codegen/atm_gcc_sync.h", "include/grpc/impl/codegen/atm_windows.h", + "include/grpc/impl/codegen/fork.h", "include/grpc/impl/codegen/gpr_slice.h", "include/grpc/impl/codegen/gpr_types.h", "include/grpc/impl/codegen/port_platform.h", @@ -597,6 +601,8 @@ grpc_cc_library( "src/core/lib/iomgr/ev_windows.c", "src/core/lib/iomgr/exec_ctx.c", "src/core/lib/iomgr/executor.c", + "src/core/lib/iomgr/fork_posix.c", + "src/core/lib/iomgr/fork_windows.c", "src/core/lib/iomgr/gethostname_fallback.c", "src/core/lib/iomgr/gethostname_host_name_max.c", "src/core/lib/iomgr/gethostname_sysconf.c", diff --git a/CMakeLists.txt b/CMakeLists.txt index f2514323c83..4586bcaf289 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -795,6 +795,7 @@ add_library(gpr src/core/lib/support/env_linux.c src/core/lib/support/env_posix.c src/core/lib/support/env_windows.c + src/core/lib/support/fork.c src/core/lib/support/histogram.c src/core/lib/support/host_port.c src/core/lib/support/log.c @@ -889,6 +890,7 @@ foreach(_hdr include/grpc/impl/codegen/atm_gcc_atomic.h include/grpc/impl/codegen/atm_gcc_sync.h include/grpc/impl/codegen/atm_windows.h + include/grpc/impl/codegen/fork.h include/grpc/impl/codegen/gpr_slice.h include/grpc/impl/codegen/gpr_types.h include/grpc/impl/codegen/port_platform.h @@ -988,6 +990,8 @@ add_library(grpc src/core/lib/iomgr/ev_windows.c src/core/lib/iomgr/exec_ctx.c src/core/lib/iomgr/executor.c + src/core/lib/iomgr/fork_posix.c + src/core/lib/iomgr/fork_windows.c src/core/lib/iomgr/gethostname_fallback.c src/core/lib/iomgr/gethostname_host_name_max.c src/core/lib/iomgr/gethostname_sysconf.c @@ -1265,6 +1269,7 @@ foreach(_hdr include/grpc/impl/codegen/atm_gcc_atomic.h include/grpc/impl/codegen/atm_gcc_sync.h include/grpc/impl/codegen/atm_windows.h + include/grpc/impl/codegen/fork.h include/grpc/impl/codegen/gpr_slice.h include/grpc/impl/codegen/gpr_types.h include/grpc/impl/codegen/port_platform.h @@ -1277,6 +1282,7 @@ foreach(_hdr include/grpc/byte_buffer.h include/grpc/byte_buffer_reader.h include/grpc/compression.h + include/grpc/fork.h include/grpc/grpc.h include/grpc/grpc_posix.h include/grpc/grpc_security_constants.h @@ -1339,6 +1345,8 @@ add_library(grpc_cronet src/core/lib/iomgr/ev_windows.c src/core/lib/iomgr/exec_ctx.c src/core/lib/iomgr/executor.c + src/core/lib/iomgr/fork_posix.c + src/core/lib/iomgr/fork_windows.c src/core/lib/iomgr/gethostname_fallback.c src/core/lib/iomgr/gethostname_host_name_max.c src/core/lib/iomgr/gethostname_sysconf.c @@ -1574,6 +1582,7 @@ foreach(_hdr include/grpc/impl/codegen/atm_gcc_atomic.h include/grpc/impl/codegen/atm_gcc_sync.h include/grpc/impl/codegen/atm_windows.h + include/grpc/impl/codegen/fork.h include/grpc/impl/codegen/gpr_slice.h include/grpc/impl/codegen/gpr_types.h include/grpc/impl/codegen/port_platform.h @@ -1658,6 +1667,8 @@ add_library(grpc_test_util src/core/lib/iomgr/ev_windows.c src/core/lib/iomgr/exec_ctx.c src/core/lib/iomgr/executor.c + src/core/lib/iomgr/fork_posix.c + src/core/lib/iomgr/fork_windows.c src/core/lib/iomgr/gethostname_fallback.c src/core/lib/iomgr/gethostname_host_name_max.c src/core/lib/iomgr/gethostname_sysconf.c @@ -1853,6 +1864,7 @@ foreach(_hdr include/grpc/impl/codegen/atm_gcc_atomic.h include/grpc/impl/codegen/atm_gcc_sync.h include/grpc/impl/codegen/atm_windows.h + include/grpc/impl/codegen/fork.h include/grpc/impl/codegen/gpr_slice.h include/grpc/impl/codegen/gpr_types.h include/grpc/impl/codegen/port_platform.h @@ -1921,6 +1933,8 @@ add_library(grpc_test_util_unsecure src/core/lib/iomgr/ev_windows.c src/core/lib/iomgr/exec_ctx.c src/core/lib/iomgr/executor.c + src/core/lib/iomgr/fork_posix.c + src/core/lib/iomgr/fork_windows.c src/core/lib/iomgr/gethostname_fallback.c src/core/lib/iomgr/gethostname_host_name_max.c src/core/lib/iomgr/gethostname_sysconf.c @@ -2116,6 +2130,7 @@ foreach(_hdr include/grpc/impl/codegen/atm_gcc_atomic.h include/grpc/impl/codegen/atm_gcc_sync.h include/grpc/impl/codegen/atm_windows.h + include/grpc/impl/codegen/fork.h include/grpc/impl/codegen/gpr_slice.h include/grpc/impl/codegen/gpr_types.h include/grpc/impl/codegen/port_platform.h @@ -2170,6 +2185,8 @@ add_library(grpc_unsecure src/core/lib/iomgr/ev_windows.c src/core/lib/iomgr/exec_ctx.c src/core/lib/iomgr/executor.c + src/core/lib/iomgr/fork_posix.c + src/core/lib/iomgr/fork_windows.c src/core/lib/iomgr/gethostname_fallback.c src/core/lib/iomgr/gethostname_host_name_max.c src/core/lib/iomgr/gethostname_sysconf.c @@ -2414,6 +2431,7 @@ foreach(_hdr include/grpc/impl/codegen/atm_gcc_atomic.h include/grpc/impl/codegen/atm_gcc_sync.h include/grpc/impl/codegen/atm_windows.h + include/grpc/impl/codegen/fork.h include/grpc/impl/codegen/gpr_slice.h include/grpc/impl/codegen/gpr_types.h include/grpc/impl/codegen/port_platform.h @@ -2425,6 +2443,7 @@ foreach(_hdr include/grpc/byte_buffer.h include/grpc/byte_buffer_reader.h include/grpc/compression.h + include/grpc/fork.h include/grpc/grpc.h include/grpc/grpc_posix.h include/grpc/grpc_security_constants.h @@ -2692,6 +2711,7 @@ foreach(_hdr include/grpc/impl/codegen/atm_gcc_atomic.h include/grpc/impl/codegen/atm_gcc_sync.h include/grpc/impl/codegen/atm_windows.h + include/grpc/impl/codegen/fork.h include/grpc/impl/codegen/gpr_slice.h include/grpc/impl/codegen/gpr_types.h include/grpc/impl/codegen/port_platform.h @@ -2703,6 +2723,7 @@ foreach(_hdr include/grpc/byte_buffer.h include/grpc/byte_buffer_reader.h include/grpc/compression.h + include/grpc/fork.h include/grpc/grpc.h include/grpc/grpc_posix.h include/grpc/grpc_security_constants.h @@ -2927,6 +2948,8 @@ add_library(grpc++_cronet src/core/lib/iomgr/ev_windows.c src/core/lib/iomgr/exec_ctx.c src/core/lib/iomgr/executor.c + src/core/lib/iomgr/fork_posix.c + src/core/lib/iomgr/fork_windows.c src/core/lib/iomgr/gethostname_fallback.c src/core/lib/iomgr/gethostname_host_name_max.c src/core/lib/iomgr/gethostname_sysconf.c @@ -3188,6 +3211,7 @@ foreach(_hdr include/grpc/impl/codegen/atm_gcc_atomic.h include/grpc/impl/codegen/atm_gcc_sync.h include/grpc/impl/codegen/atm_windows.h + include/grpc/impl/codegen/fork.h include/grpc/impl/codegen/gpr_slice.h include/grpc/impl/codegen/gpr_types.h include/grpc/impl/codegen/port_platform.h @@ -3199,6 +3223,7 @@ foreach(_hdr include/grpc/byte_buffer.h include/grpc/byte_buffer_reader.h include/grpc/compression.h + include/grpc/fork.h include/grpc/grpc.h include/grpc/grpc_posix.h include/grpc/grpc_security_constants.h @@ -3620,6 +3645,7 @@ foreach(_hdr include/grpc/impl/codegen/atm_gcc_atomic.h include/grpc/impl/codegen/atm_gcc_sync.h include/grpc/impl/codegen/atm_windows.h + include/grpc/impl/codegen/fork.h include/grpc/impl/codegen/gpr_slice.h include/grpc/impl/codegen/gpr_types.h include/grpc/impl/codegen/port_platform.h @@ -3760,6 +3786,7 @@ foreach(_hdr include/grpc/impl/codegen/atm_gcc_atomic.h include/grpc/impl/codegen/atm_gcc_sync.h include/grpc/impl/codegen/atm_windows.h + include/grpc/impl/codegen/fork.h include/grpc/impl/codegen/gpr_slice.h include/grpc/impl/codegen/gpr_types.h include/grpc/impl/codegen/port_platform.h @@ -3931,6 +3958,7 @@ foreach(_hdr include/grpc/impl/codegen/atm_gcc_atomic.h include/grpc/impl/codegen/atm_gcc_sync.h include/grpc/impl/codegen/atm_windows.h + include/grpc/impl/codegen/fork.h include/grpc/impl/codegen/gpr_slice.h include/grpc/impl/codegen/gpr_types.h include/grpc/impl/codegen/port_platform.h @@ -3942,6 +3970,7 @@ foreach(_hdr include/grpc/byte_buffer.h include/grpc/byte_buffer_reader.h include/grpc/compression.h + include/grpc/fork.h include/grpc/grpc.h include/grpc/grpc_posix.h include/grpc/grpc_security_constants.h diff --git a/Makefile b/Makefile index c7f9f7da814..406670f3d22 100644 --- a/Makefile +++ b/Makefile @@ -2809,6 +2809,7 @@ LIBGPR_SRC = \ src/core/lib/support/env_linux.c \ src/core/lib/support/env_posix.c \ src/core/lib/support/env_windows.c \ + src/core/lib/support/fork.c \ src/core/lib/support/histogram.c \ src/core/lib/support/host_port.c \ src/core/lib/support/log.c \ @@ -2873,6 +2874,7 @@ PUBLIC_HEADERS_C += \ include/grpc/impl/codegen/atm_gcc_atomic.h \ include/grpc/impl/codegen/atm_gcc_sync.h \ include/grpc/impl/codegen/atm_windows.h \ + include/grpc/impl/codegen/fork.h \ include/grpc/impl/codegen/gpr_slice.h \ include/grpc/impl/codegen/gpr_types.h \ include/grpc/impl/codegen/port_platform.h \ @@ -2979,6 +2981,8 @@ LIBGRPC_SRC = \ src/core/lib/iomgr/ev_windows.c \ src/core/lib/iomgr/exec_ctx.c \ src/core/lib/iomgr/executor.c \ + src/core/lib/iomgr/fork_posix.c \ + src/core/lib/iomgr/fork_windows.c \ src/core/lib/iomgr/gethostname_fallback.c \ src/core/lib/iomgr/gethostname_host_name_max.c \ src/core/lib/iomgr/gethostname_sysconf.c \ @@ -3221,6 +3225,7 @@ PUBLIC_HEADERS_C += \ include/grpc/impl/codegen/atm_gcc_atomic.h \ include/grpc/impl/codegen/atm_gcc_sync.h \ include/grpc/impl/codegen/atm_windows.h \ + include/grpc/impl/codegen/fork.h \ include/grpc/impl/codegen/gpr_slice.h \ include/grpc/impl/codegen/gpr_types.h \ include/grpc/impl/codegen/port_platform.h \ @@ -3233,6 +3238,7 @@ PUBLIC_HEADERS_C += \ include/grpc/byte_buffer.h \ include/grpc/byte_buffer_reader.h \ include/grpc/compression.h \ + include/grpc/fork.h \ include/grpc/grpc.h \ include/grpc/grpc_posix.h \ include/grpc/grpc_security_constants.h \ @@ -3330,6 +3336,8 @@ LIBGRPC_CRONET_SRC = \ src/core/lib/iomgr/ev_windows.c \ src/core/lib/iomgr/exec_ctx.c \ src/core/lib/iomgr/executor.c \ + src/core/lib/iomgr/fork_posix.c \ + src/core/lib/iomgr/fork_windows.c \ src/core/lib/iomgr/gethostname_fallback.c \ src/core/lib/iomgr/gethostname_host_name_max.c \ src/core/lib/iomgr/gethostname_sysconf.c \ @@ -3530,6 +3538,7 @@ PUBLIC_HEADERS_C += \ include/grpc/impl/codegen/atm_gcc_atomic.h \ include/grpc/impl/codegen/atm_gcc_sync.h \ include/grpc/impl/codegen/atm_windows.h \ + include/grpc/impl/codegen/fork.h \ include/grpc/impl/codegen/gpr_slice.h \ include/grpc/impl/codegen/gpr_types.h \ include/grpc/impl/codegen/port_platform.h \ @@ -3648,6 +3657,8 @@ LIBGRPC_TEST_UTIL_SRC = \ src/core/lib/iomgr/ev_windows.c \ src/core/lib/iomgr/exec_ctx.c \ src/core/lib/iomgr/executor.c \ + src/core/lib/iomgr/fork_posix.c \ + src/core/lib/iomgr/fork_windows.c \ src/core/lib/iomgr/gethostname_fallback.c \ src/core/lib/iomgr/gethostname_host_name_max.c \ src/core/lib/iomgr/gethostname_sysconf.c \ @@ -3810,6 +3821,7 @@ PUBLIC_HEADERS_C += \ include/grpc/impl/codegen/atm_gcc_atomic.h \ include/grpc/impl/codegen/atm_gcc_sync.h \ include/grpc/impl/codegen/atm_windows.h \ + include/grpc/impl/codegen/fork.h \ include/grpc/impl/codegen/gpr_slice.h \ include/grpc/impl/codegen/gpr_types.h \ include/grpc/impl/codegen/port_platform.h \ @@ -3902,6 +3914,8 @@ LIBGRPC_TEST_UTIL_UNSECURE_SRC = \ src/core/lib/iomgr/ev_windows.c \ src/core/lib/iomgr/exec_ctx.c \ src/core/lib/iomgr/executor.c \ + src/core/lib/iomgr/fork_posix.c \ + src/core/lib/iomgr/fork_windows.c \ src/core/lib/iomgr/gethostname_fallback.c \ src/core/lib/iomgr/gethostname_host_name_max.c \ src/core/lib/iomgr/gethostname_sysconf.c \ @@ -4064,6 +4078,7 @@ PUBLIC_HEADERS_C += \ include/grpc/impl/codegen/atm_gcc_atomic.h \ include/grpc/impl/codegen/atm_gcc_sync.h \ include/grpc/impl/codegen/atm_windows.h \ + include/grpc/impl/codegen/fork.h \ include/grpc/impl/codegen/gpr_slice.h \ include/grpc/impl/codegen/gpr_types.h \ include/grpc/impl/codegen/port_platform.h \ @@ -4129,6 +4144,8 @@ LIBGRPC_UNSECURE_SRC = \ src/core/lib/iomgr/ev_windows.c \ src/core/lib/iomgr/exec_ctx.c \ src/core/lib/iomgr/executor.c \ + src/core/lib/iomgr/fork_posix.c \ + src/core/lib/iomgr/fork_windows.c \ src/core/lib/iomgr/gethostname_fallback.c \ src/core/lib/iomgr/gethostname_host_name_max.c \ src/core/lib/iomgr/gethostname_sysconf.c \ @@ -4339,6 +4356,7 @@ PUBLIC_HEADERS_C += \ include/grpc/impl/codegen/atm_gcc_atomic.h \ include/grpc/impl/codegen/atm_gcc_sync.h \ include/grpc/impl/codegen/atm_windows.h \ + include/grpc/impl/codegen/fork.h \ include/grpc/impl/codegen/gpr_slice.h \ include/grpc/impl/codegen/gpr_types.h \ include/grpc/impl/codegen/port_platform.h \ @@ -4350,6 +4368,7 @@ PUBLIC_HEADERS_C += \ include/grpc/byte_buffer.h \ include/grpc/byte_buffer_reader.h \ include/grpc/compression.h \ + include/grpc/fork.h \ include/grpc/grpc.h \ include/grpc/grpc_posix.h \ include/grpc/grpc_security_constants.h \ @@ -4596,6 +4615,7 @@ PUBLIC_HEADERS_CXX += \ include/grpc/impl/codegen/atm_gcc_atomic.h \ include/grpc/impl/codegen/atm_gcc_sync.h \ include/grpc/impl/codegen/atm_windows.h \ + include/grpc/impl/codegen/fork.h \ include/grpc/impl/codegen/gpr_slice.h \ include/grpc/impl/codegen/gpr_types.h \ include/grpc/impl/codegen/port_platform.h \ @@ -4607,6 +4627,7 @@ PUBLIC_HEADERS_CXX += \ include/grpc/byte_buffer.h \ include/grpc/byte_buffer_reader.h \ include/grpc/compression.h \ + include/grpc/fork.h \ include/grpc/grpc.h \ include/grpc/grpc_posix.h \ include/grpc/grpc_security_constants.h \ @@ -4869,6 +4890,8 @@ LIBGRPC++_CRONET_SRC = \ src/core/lib/iomgr/ev_windows.c \ src/core/lib/iomgr/exec_ctx.c \ src/core/lib/iomgr/executor.c \ + src/core/lib/iomgr/fork_posix.c \ + src/core/lib/iomgr/fork_windows.c \ src/core/lib/iomgr/gethostname_fallback.c \ src/core/lib/iomgr/gethostname_host_name_max.c \ src/core/lib/iomgr/gethostname_sysconf.c \ @@ -5093,6 +5116,7 @@ PUBLIC_HEADERS_CXX += \ include/grpc/impl/codegen/atm_gcc_atomic.h \ include/grpc/impl/codegen/atm_gcc_sync.h \ include/grpc/impl/codegen/atm_windows.h \ + include/grpc/impl/codegen/fork.h \ include/grpc/impl/codegen/gpr_slice.h \ include/grpc/impl/codegen/gpr_types.h \ include/grpc/impl/codegen/port_platform.h \ @@ -5104,6 +5128,7 @@ PUBLIC_HEADERS_CXX += \ include/grpc/byte_buffer.h \ include/grpc/byte_buffer_reader.h \ include/grpc/compression.h \ + include/grpc/fork.h \ include/grpc/grpc.h \ include/grpc/grpc_posix.h \ include/grpc/grpc_security_constants.h \ @@ -5518,6 +5543,7 @@ PUBLIC_HEADERS_CXX += \ include/grpc/impl/codegen/atm_gcc_atomic.h \ include/grpc/impl/codegen/atm_gcc_sync.h \ include/grpc/impl/codegen/atm_windows.h \ + include/grpc/impl/codegen/fork.h \ include/grpc/impl/codegen/gpr_slice.h \ include/grpc/impl/codegen/gpr_types.h \ include/grpc/impl/codegen/port_platform.h \ @@ -5635,6 +5661,7 @@ PUBLIC_HEADERS_CXX += \ include/grpc/impl/codegen/atm_gcc_atomic.h \ include/grpc/impl/codegen/atm_gcc_sync.h \ include/grpc/impl/codegen/atm_windows.h \ + include/grpc/impl/codegen/fork.h \ include/grpc/impl/codegen/gpr_slice.h \ include/grpc/impl/codegen/gpr_types.h \ include/grpc/impl/codegen/port_platform.h \ @@ -5811,6 +5838,7 @@ PUBLIC_HEADERS_CXX += \ include/grpc/impl/codegen/atm_gcc_atomic.h \ include/grpc/impl/codegen/atm_gcc_sync.h \ include/grpc/impl/codegen/atm_windows.h \ + include/grpc/impl/codegen/fork.h \ include/grpc/impl/codegen/gpr_slice.h \ include/grpc/impl/codegen/gpr_types.h \ include/grpc/impl/codegen/port_platform.h \ @@ -5822,6 +5850,7 @@ PUBLIC_HEADERS_CXX += \ include/grpc/byte_buffer.h \ include/grpc/byte_buffer_reader.h \ include/grpc/compression.h \ + include/grpc/fork.h \ include/grpc/grpc.h \ include/grpc/grpc_posix.h \ include/grpc/grpc_security_constants.h \ diff --git a/binding.gyp b/binding.gyp index b4f90382103..cb0a2fbab19 100644 --- a/binding.gyp +++ b/binding.gyp @@ -608,6 +608,7 @@ 'src/core/lib/support/env_linux.c', 'src/core/lib/support/env_posix.c', 'src/core/lib/support/env_windows.c', + 'src/core/lib/support/fork.c', 'src/core/lib/support/histogram.c', 'src/core/lib/support/host_port.c', 'src/core/lib/support/log.c', @@ -690,6 +691,8 @@ 'src/core/lib/iomgr/ev_windows.c', 'src/core/lib/iomgr/exec_ctx.c', 'src/core/lib/iomgr/executor.c', + 'src/core/lib/iomgr/fork_posix.c', + 'src/core/lib/iomgr/fork_windows.c', 'src/core/lib/iomgr/gethostname_fallback.c', 'src/core/lib/iomgr/gethostname_host_name_max.c', 'src/core/lib/iomgr/gethostname_sysconf.c', diff --git a/build.yaml b/build.yaml index 4ef08c21300..97cc0fb61f2 100644 --- a/build.yaml +++ b/build.yaml @@ -75,6 +75,7 @@ filegroups: - src/core/lib/support/env_linux.c - src/core/lib/support/env_posix.c - src/core/lib/support/env_windows.c + - src/core/lib/support/fork.c - src/core/lib/support/histogram.c - src/core/lib/support/host_port.c - src/core/lib/support/log.c @@ -146,6 +147,7 @@ filegroups: - src/core/lib/support/backoff.h - src/core/lib/support/block_annotate.h - src/core/lib/support/env.h + - src/core/lib/support/fork.h - src/core/lib/support/memory.h - src/core/lib/support/mpscq.h - src/core/lib/support/murmur_hash.h @@ -153,6 +155,7 @@ filegroups: - src/core/lib/support/stack_lockfree.h - src/core/lib/support/string.h - src/core/lib/support/string_windows.h + - src/core/lib/support/thd_internal.h - src/core/lib/support/time_precise.h - src/core/lib/support/tmpfile.h uses: @@ -163,6 +166,7 @@ filegroups: - include/grpc/impl/codegen/atm_gcc_atomic.h - include/grpc/impl/codegen/atm_gcc_sync.h - include/grpc/impl/codegen/atm_windows.h + - include/grpc/impl/codegen/fork.h - include/grpc/impl/codegen/gpr_slice.h - include/grpc/impl/codegen/gpr_types.h - include/grpc/impl/codegen/port_platform.h @@ -218,6 +222,8 @@ filegroups: - src/core/lib/iomgr/ev_windows.c - src/core/lib/iomgr/exec_ctx.c - src/core/lib/iomgr/executor.c + - src/core/lib/iomgr/fork_posix.c + - src/core/lib/iomgr/fork_windows.c - src/core/lib/iomgr/gethostname_fallback.c - src/core/lib/iomgr/gethostname_host_name_max.c - src/core/lib/iomgr/gethostname_sysconf.c @@ -328,6 +334,7 @@ filegroups: - include/grpc/byte_buffer.h - include/grpc/byte_buffer_reader.h - include/grpc/compression.h + - include/grpc/fork.h - include/grpc/grpc.h - include/grpc/grpc_posix.h - include/grpc/grpc_security_constants.h diff --git a/config.m4 b/config.m4 index 72f8a1e710b..8c780b101d1 100644 --- a/config.m4 +++ b/config.m4 @@ -54,6 +54,7 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/support/env_linux.c \ src/core/lib/support/env_posix.c \ src/core/lib/support/env_windows.c \ + src/core/lib/support/fork.c \ src/core/lib/support/histogram.c \ src/core/lib/support/host_port.c \ src/core/lib/support/log.c \ @@ -119,6 +120,8 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/iomgr/ev_windows.c \ src/core/lib/iomgr/exec_ctx.c \ src/core/lib/iomgr/executor.c \ + src/core/lib/iomgr/fork_posix.c \ + src/core/lib/iomgr/fork_windows.c \ src/core/lib/iomgr/gethostname_fallback.c \ src/core/lib/iomgr/gethostname_host_name_max.c \ src/core/lib/iomgr/gethostname_sysconf.c \ diff --git a/config.w32 b/config.w32 index 5347baedc22..f7cb23dd30a 100644 --- a/config.w32 +++ b/config.w32 @@ -31,6 +31,7 @@ if (PHP_GRPC != "no") { "src\\core\\lib\\support\\env_linux.c " + "src\\core\\lib\\support\\env_posix.c " + "src\\core\\lib\\support\\env_windows.c " + + "src\\core\\lib\\support\\fork.c " + "src\\core\\lib\\support\\histogram.c " + "src\\core\\lib\\support\\host_port.c " + "src\\core\\lib\\support\\log.c " + @@ -96,6 +97,8 @@ if (PHP_GRPC != "no") { "src\\core\\lib\\iomgr\\ev_windows.c " + "src\\core\\lib\\iomgr\\exec_ctx.c " + "src\\core\\lib\\iomgr\\executor.c " + + "src\\core\\lib\\iomgr\\fork_posix.c " + + "src\\core\\lib\\iomgr\\fork_windows.c " + "src\\core\\lib\\iomgr\\gethostname_fallback.c " + "src\\core\\lib\\iomgr\\gethostname_host_name_max.c " + "src\\core\\lib\\iomgr\\gethostname_sysconf.c " + diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 3faba23ca39..48f8f43e8d5 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -134,6 +134,7 @@ Pod::Spec.new do |s| 'include/grpc/impl/codegen/atm_gcc_atomic.h', 'include/grpc/impl/codegen/atm_gcc_sync.h', 'include/grpc/impl/codegen/atm_windows.h', + 'include/grpc/impl/codegen/fork.h', 'include/grpc/impl/codegen/gpr_slice.h', 'include/grpc/impl/codegen/gpr_types.h', 'include/grpc/impl/codegen/port_platform.h', @@ -155,6 +156,7 @@ Pod::Spec.new do |s| 'include/grpc/impl/codegen/atm_gcc_atomic.h', 'include/grpc/impl/codegen/atm_gcc_sync.h', 'include/grpc/impl/codegen/atm_windows.h', + 'include/grpc/impl/codegen/fork.h', 'include/grpc/impl/codegen/gpr_slice.h', 'include/grpc/impl/codegen/gpr_types.h', 'include/grpc/impl/codegen/port_platform.h', @@ -167,6 +169,7 @@ Pod::Spec.new do |s| 'include/grpc/byte_buffer.h', 'include/grpc/byte_buffer_reader.h', 'include/grpc/compression.h', + 'include/grpc/fork.h', 'include/grpc/grpc.h', 'include/grpc/grpc_posix.h', 'include/grpc/grpc_security_constants.h', @@ -193,6 +196,7 @@ Pod::Spec.new do |s| 'src/core/lib/support/backoff.h', 'src/core/lib/support/block_annotate.h', 'src/core/lib/support/env.h', + 'src/core/lib/support/fork.h', 'src/core/lib/support/memory.h', 'src/core/lib/support/mpscq.h', 'src/core/lib/support/murmur_hash.h', @@ -200,6 +204,7 @@ Pod::Spec.new do |s| 'src/core/lib/support/stack_lockfree.h', 'src/core/lib/support/string.h', 'src/core/lib/support/string_windows.h', + 'src/core/lib/support/thd_internal.h', 'src/core/lib/support/time_precise.h', 'src/core/lib/support/tmpfile.h', 'src/core/lib/profiling/basic_timers.c', @@ -217,6 +222,7 @@ Pod::Spec.new do |s| 'src/core/lib/support/env_linux.c', 'src/core/lib/support/env_posix.c', 'src/core/lib/support/env_windows.c', + 'src/core/lib/support/fork.c', 'src/core/lib/support/histogram.c', 'src/core/lib/support/host_port.c', 'src/core/lib/support/log.c', @@ -505,6 +511,8 @@ Pod::Spec.new do |s| 'src/core/lib/iomgr/ev_windows.c', 'src/core/lib/iomgr/exec_ctx.c', 'src/core/lib/iomgr/executor.c', + 'src/core/lib/iomgr/fork_posix.c', + 'src/core/lib/iomgr/fork_windows.c', 'src/core/lib/iomgr/gethostname_fallback.c', 'src/core/lib/iomgr/gethostname_host_name_max.c', 'src/core/lib/iomgr/gethostname_sysconf.c', @@ -738,6 +746,7 @@ Pod::Spec.new do |s| 'src/core/lib/support/backoff.h', 'src/core/lib/support/block_annotate.h', 'src/core/lib/support/env.h', + 'src/core/lib/support/fork.h', 'src/core/lib/support/memory.h', 'src/core/lib/support/mpscq.h', 'src/core/lib/support/murmur_hash.h', @@ -745,6 +754,7 @@ Pod::Spec.new do |s| 'src/core/lib/support/stack_lockfree.h', 'src/core/lib/support/string.h', 'src/core/lib/support/string_windows.h', + 'src/core/lib/support/thd_internal.h', 'src/core/lib/support/time_precise.h', 'src/core/lib/support/tmpfile.h', 'src/core/ext/transport/chttp2/transport/bin_decoder.h', diff --git a/grpc.gemspec b/grpc.gemspec index acf71cab782..83f81a30f15 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -75,6 +75,7 @@ Gem::Specification.new do |s| s.files += %w( include/grpc/impl/codegen/atm_gcc_atomic.h ) s.files += %w( include/grpc/impl/codegen/atm_gcc_sync.h ) s.files += %w( include/grpc/impl/codegen/atm_windows.h ) + s.files += %w( include/grpc/impl/codegen/fork.h ) s.files += %w( include/grpc/impl/codegen/gpr_slice.h ) s.files += %w( include/grpc/impl/codegen/gpr_types.h ) s.files += %w( include/grpc/impl/codegen/port_platform.h ) @@ -91,6 +92,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/support/backoff.h ) s.files += %w( src/core/lib/support/block_annotate.h ) s.files += %w( src/core/lib/support/env.h ) + s.files += %w( src/core/lib/support/fork.h ) s.files += %w( src/core/lib/support/memory.h ) s.files += %w( src/core/lib/support/mpscq.h ) s.files += %w( src/core/lib/support/murmur_hash.h ) @@ -98,6 +100,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/support/stack_lockfree.h ) s.files += %w( src/core/lib/support/string.h ) s.files += %w( src/core/lib/support/string_windows.h ) + s.files += %w( src/core/lib/support/thd_internal.h ) s.files += %w( src/core/lib/support/time_precise.h ) s.files += %w( src/core/lib/support/tmpfile.h ) s.files += %w( src/core/lib/profiling/basic_timers.c ) @@ -115,6 +118,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/support/env_linux.c ) s.files += %w( src/core/lib/support/env_posix.c ) s.files += %w( src/core/lib/support/env_windows.c ) + s.files += %w( src/core/lib/support/fork.c ) s.files += %w( src/core/lib/support/histogram.c ) s.files += %w( src/core/lib/support/host_port.c ) s.files += %w( src/core/lib/support/log.c ) @@ -159,6 +163,7 @@ Gem::Specification.new do |s| s.files += %w( include/grpc/impl/codegen/atm_gcc_atomic.h ) s.files += %w( include/grpc/impl/codegen/atm_gcc_sync.h ) s.files += %w( include/grpc/impl/codegen/atm_windows.h ) + s.files += %w( include/grpc/impl/codegen/fork.h ) s.files += %w( include/grpc/impl/codegen/gpr_slice.h ) s.files += %w( include/grpc/impl/codegen/gpr_types.h ) s.files += %w( include/grpc/impl/codegen/port_platform.h ) @@ -171,6 +176,7 @@ Gem::Specification.new do |s| s.files += %w( include/grpc/byte_buffer.h ) s.files += %w( include/grpc/byte_buffer_reader.h ) s.files += %w( include/grpc/compression.h ) + s.files += %w( include/grpc/fork.h ) s.files += %w( include/grpc/grpc.h ) s.files += %w( include/grpc/grpc_posix.h ) s.files += %w( include/grpc/grpc_security_constants.h ) @@ -441,6 +447,8 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/iomgr/ev_windows.c ) s.files += %w( src/core/lib/iomgr/exec_ctx.c ) s.files += %w( src/core/lib/iomgr/executor.c ) + s.files += %w( src/core/lib/iomgr/fork_posix.c ) + s.files += %w( src/core/lib/iomgr/fork_windows.c ) s.files += %w( src/core/lib/iomgr/gethostname_fallback.c ) s.files += %w( src/core/lib/iomgr/gethostname_host_name_max.c ) s.files += %w( src/core/lib/iomgr/gethostname_sysconf.c ) diff --git a/grpc.gyp b/grpc.gyp index 6331b76f473..dd7851f8f4d 100644 --- a/grpc.gyp +++ b/grpc.gyp @@ -172,6 +172,7 @@ 'src/core/lib/support/env_linux.c', 'src/core/lib/support/env_posix.c', 'src/core/lib/support/env_windows.c', + 'src/core/lib/support/fork.c', 'src/core/lib/support/histogram.c', 'src/core/lib/support/host_port.c', 'src/core/lib/support/log.c', @@ -256,6 +257,8 @@ 'src/core/lib/iomgr/ev_windows.c', 'src/core/lib/iomgr/exec_ctx.c', 'src/core/lib/iomgr/executor.c', + 'src/core/lib/iomgr/fork_posix.c', + 'src/core/lib/iomgr/fork_windows.c', 'src/core/lib/iomgr/gethostname_fallback.c', 'src/core/lib/iomgr/gethostname_host_name_max.c', 'src/core/lib/iomgr/gethostname_sysconf.c', @@ -557,6 +560,8 @@ 'src/core/lib/iomgr/ev_windows.c', 'src/core/lib/iomgr/exec_ctx.c', 'src/core/lib/iomgr/executor.c', + 'src/core/lib/iomgr/fork_posix.c', + 'src/core/lib/iomgr/fork_windows.c', 'src/core/lib/iomgr/gethostname_fallback.c', 'src/core/lib/iomgr/gethostname_host_name_max.c', 'src/core/lib/iomgr/gethostname_sysconf.c', @@ -763,6 +768,8 @@ 'src/core/lib/iomgr/ev_windows.c', 'src/core/lib/iomgr/exec_ctx.c', 'src/core/lib/iomgr/executor.c', + 'src/core/lib/iomgr/fork_posix.c', + 'src/core/lib/iomgr/fork_windows.c', 'src/core/lib/iomgr/gethostname_fallback.c', 'src/core/lib/iomgr/gethostname_host_name_max.c', 'src/core/lib/iomgr/gethostname_sysconf.c', @@ -954,6 +961,8 @@ 'src/core/lib/iomgr/ev_windows.c', 'src/core/lib/iomgr/exec_ctx.c', 'src/core/lib/iomgr/executor.c', + 'src/core/lib/iomgr/fork_posix.c', + 'src/core/lib/iomgr/fork_windows.c', 'src/core/lib/iomgr/gethostname_fallback.c', 'src/core/lib/iomgr/gethostname_host_name_max.c', 'src/core/lib/iomgr/gethostname_sysconf.c', diff --git a/include/grpc/fork.h b/include/grpc/fork.h new file mode 100644 index 00000000000..ca45e1139c0 --- /dev/null +++ b/include/grpc/fork.h @@ -0,0 +1,24 @@ +/* + * + * Copyright 2017 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPC_FORK_H +#define GRPC_FORK_H + +#include + +#endif /* GRPC_FORK_H */ diff --git a/include/grpc/impl/codegen/fork.h b/include/grpc/impl/codegen/fork.h new file mode 100644 index 00000000000..03c0c4eede5 --- /dev/null +++ b/include/grpc/impl/codegen/fork.h @@ -0,0 +1,49 @@ +/* + * + * Copyright 2017 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPC_IMPL_CODEGEN_FORK_H +#define GRPC_IMPL_CODEGEN_FORK_H + +/** + * gRPC applications should call this before calling fork(). There should be no + * active gRPC function calls between calling grpc_prefork() and + * grpc_postfork_parent()/grpc_postfork_child(). + * + * Returns 1 on success, 0 otherwise. + * + * Typical use: + * assert(grpc_prefork() == 1); + * int pid = fork(); + * if (pid) { + * grpc_postfork_parent(); + * // Parent process.. + * } else { + * grpc_postfork_child(); + * // Child process... + * } + */ + +int grpc_prefork(); + +void grpc_postfork_parent(); + +void grpc_postfork_child(); + +void grpc_fork_handlers_auto_register(); + +#endif /* GRPC_IMPL_CODEGEN_FORK_H */ diff --git a/include/grpc/module.modulemap b/include/grpc/module.modulemap index 342adc0dc93..0faa448b70f 100644 --- a/include/grpc/module.modulemap +++ b/include/grpc/module.modulemap @@ -21,6 +21,7 @@ framework module grpc { header "support/tls.h" header "support/useful.h" header "impl/codegen/atm.h" + header "impl/codegen/fork.h" header "impl/codegen/gpr_slice.h" header "impl/codegen/gpr_types.h" header "impl/codegen/port_platform.h" @@ -36,6 +37,7 @@ framework module grpc { header "impl/codegen/slice.h" header "impl/codegen/status.h" header "impl/codegen/atm.h" + header "impl/codegen/fork.h" header "impl/codegen/gpr_slice.h" header "impl/codegen/gpr_types.h" header "impl/codegen/port_platform.h" @@ -45,6 +47,7 @@ framework module grpc { header "byte_buffer.h" header "byte_buffer_reader.h" header "compression.h" + header "fork.h" header "grpc.h" header "grpc_posix.h" header "grpc_security_constants.h" diff --git a/package.xml b/package.xml index 2c2e5c83e3f..472dabbb8de 100644 --- a/package.xml +++ b/package.xml @@ -87,6 +87,7 @@ + @@ -103,6 +104,7 @@ + @@ -110,6 +112,7 @@ + @@ -127,6 +130,7 @@ + @@ -171,6 +175,7 @@ + @@ -183,6 +188,7 @@ + @@ -453,6 +459,8 @@ + + diff --git a/setup.py b/setup.py index 90c9316b0da..fcb5a1cf720 100644 --- a/setup.py +++ b/setup.py @@ -169,7 +169,7 @@ if "win32" in sys.platform: # on msvc, but only for 32 bits DEFINE_MACROS += (('NTDDI_VERSION', 0x06000000),) else: - DEFINE_MACROS += (('HAVE_CONFIG_H', 1),) + DEFINE_MACROS += (('HAVE_CONFIG_H', 1), ('GRPC_ENABLE_FORK_SUPPORT', 1),) LDFLAGS = tuple(EXTRA_LINK_ARGS) CFLAGS = tuple(EXTRA_COMPILE_ARGS) diff --git a/src/core/lib/iomgr/fork_posix.c b/src/core/lib/iomgr/fork_posix.c new file mode 100644 index 00000000000..5f2880db379 --- /dev/null +++ b/src/core/lib/iomgr/fork_posix.c @@ -0,0 +1,83 @@ +/* + * + * Copyright 2017 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "src/core/lib/iomgr/port.h" + +#ifdef GRPC_POSIX_FORK + +#include + +#include +#include +#include +#include + +#include "src/core/lib/iomgr/ev_posix.h" +#include "src/core/lib/iomgr/executor.h" +#include "src/core/lib/iomgr/timer_manager.h" +#include "src/core/lib/iomgr/wakeup_fd_posix.h" +#include "src/core/lib/support/env.h" +#include "src/core/lib/support/fork.h" +#include "src/core/lib/support/thd_internal.h" + +/* + * NOTE: FORKING IS NOT GENERALLY SUPPORTED, THIS IS ONLY INTENDED TO WORK + * AROUND VERY SPECIFIC USE CASES. + */ + +int grpc_prefork() { + if (!grpc_fork_support_enabled()) { + gpr_log(GPR_ERROR, + "Fork support not enabled; try running with the " + "environment variable GRPC_ENABLE_FORK_SUPPORT=1"); + return 0; + } + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_timer_manager_set_threading(false); + grpc_executor_set_threading(&exec_ctx, false); + grpc_exec_ctx_finish(&exec_ctx); + if (!gpr_await_threads( + gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), + gpr_time_from_seconds(3, GPR_TIMESPAN)))) { + gpr_log(GPR_ERROR, "gRPC thread still active! Cannot fork!"); + return 0; + } + return 1; +} + +void grpc_postfork_parent() { + grpc_timer_manager_set_threading(true); + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_executor_set_threading(&exec_ctx, true); + grpc_exec_ctx_finish(&exec_ctx); +} + +void grpc_postfork_child() { + grpc_timer_manager_set_threading(true); + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_executor_set_threading(&exec_ctx, true); + grpc_exec_ctx_finish(&exec_ctx); +} + +void grpc_fork_handlers_auto_register() { + if (grpc_fork_support_enabled()) { + pthread_atfork(grpc_prefork, grpc_postfork_parent, grpc_postfork_child); + } +} + +#endif // GRPC_POSIX_FORK diff --git a/src/core/lib/iomgr/fork_windows.c b/src/core/lib/iomgr/fork_windows.c new file mode 100644 index 00000000000..965ddfbd0ba --- /dev/null +++ b/src/core/lib/iomgr/fork_windows.c @@ -0,0 +1,42 @@ +/* + * + * Copyright 2017 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "src/core/lib/iomgr/port.h" + +#ifndef GRPC_POSIX_FORK + +#include +#include + +/* + * NOTE: FORKING IS NOT GENERALLY SUPPORTED, THIS IS ONLY INTENDED TO WORK + * AROUND VERY SPECIFIC USE CASES. + */ + +int grpc_prefork() { + gpr_log(GPR_ERROR, "Forking not supported on Windows"); + return 0; +} + +void grpc_postfork_parent() {} + +void grpc_postfork_child() {} + +void grpc_fork_handlers_auto_register() {} + +#endif // GRPC_POSIX_FORK diff --git a/src/core/lib/support/fork.c b/src/core/lib/support/fork.c new file mode 100644 index 00000000000..2f29af899dd --- /dev/null +++ b/src/core/lib/support/fork.c @@ -0,0 +1,62 @@ +/* + * + * Copyright 2017 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "src/core/lib/support/fork.h" + +#include + +#include +#include + +#include "src/core/lib/support/env.h" + +/* + * NOTE: FORKING IS NOT GENERALLY SUPPORTED, THIS IS ONLY INTENDED TO WORK + * AROUND VERY SPECIFIC USE CASES. + */ + +static int override_fork_support_enabled = -1; +static int fork_support_enabled; + +void grpc_fork_support_init() { +#ifdef GRPC_ENABLE_FORK_SUPPORT + fork_support_enabled = 1; +#else + fork_support_enabled = 0; + char *env = gpr_getenv("GRPC_ENABLE_FORK_SUPPORT"); + if (env != NULL) { + static const char *truthy[] = {"yes", "Yes", "YES", "true", + "True", "TRUE", "1"}; + for (size_t i = 0; i < GPR_ARRAY_SIZE(truthy); i++) { + if (0 == strcmp(env, truthy[i])) { + fork_support_enabled = 1; + } + } + gpr_free(env); + } +#endif + if (override_fork_support_enabled != -1) { + fork_support_enabled = override_fork_support_enabled; + } +} + +int grpc_fork_support_enabled() { return fork_support_enabled; } + +void grpc_enable_fork_support(int enable) { + override_fork_support_enabled = enable; +} diff --git a/src/core/lib/support/fork.h b/src/core/lib/support/fork.h new file mode 100644 index 00000000000..215d4214a61 --- /dev/null +++ b/src/core/lib/support/fork.h @@ -0,0 +1,35 @@ +/* + * + * Copyright 2017 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPC_CORE_LIB_SUPPORT_FORK_H +#define GRPC_CORE_LIB_SUPPORT_FORK_H + +/* + * NOTE: FORKING IS NOT GENERALLY SUPPORTED, THIS IS ONLY INTENDED TO WORK + * AROUND VERY SPECIFIC USE CASES. + */ + +void grpc_fork_support_init(void); + +int grpc_fork_support_enabled(void); + +// Test only: Must be called before grpc_init(), and overrides +// environment variables/compile flags +void grpc_enable_fork_support(int enable); + +#endif /* GRPC_CORE_LIB_SUPPORT_FORK_H */ diff --git a/src/core/lib/support/thd_internal.h b/src/core/lib/support/thd_internal.h new file mode 100644 index 00000000000..38bffc847d6 --- /dev/null +++ b/src/core/lib/support/thd_internal.h @@ -0,0 +1,30 @@ +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPC_CORE_LIB_SUPPORT_THD_INTERNAL_H +#define GRPC_CORE_LIB_SUPPORT_THD_INTERNAL_H + +#include + +/* Internal interfaces between modules within the gpr support library. */ +void gpr_thd_init(); + +/* Wait for all outstanding threads to finish, up to deadline */ +int gpr_await_threads(gpr_timespec deadline); + +#endif /* GRPC_CORE_LIB_SUPPORT_THD_INTERNAL_H */ diff --git a/src/core/lib/support/thd_posix.c b/src/core/lib/support/thd_posix.c index 98afd10df7c..219297c046b 100644 --- a/src/core/lib/support/thd_posix.c +++ b/src/core/lib/support/thd_posix.c @@ -24,22 +24,34 @@ #include #include +#include #include #include #include #include #include +#include "src/core/lib/support/fork.h" + +static gpr_mu g_mu; +static gpr_cv g_cv; +static int g_thread_count; +static int g_awaiting_threads; + struct thd_arg { void (*body)(void *arg); /* body of a thread */ void *arg; /* argument to a thread */ }; +static void inc_thd_count(); +static void dec_thd_count(); + /* Body of every thread started via gpr_thd_new. */ static void *thread_body(void *v) { struct thd_arg a = *(struct thd_arg *)v; free(v); (*a.body)(a.arg); + dec_thd_count(); return NULL; } @@ -54,6 +66,7 @@ int gpr_thd_new(gpr_thd_id *t, void (*thd_body)(void *arg), void *arg, GPR_ASSERT(a != NULL); a->body = thd_body; a->arg = arg; + inc_thd_count(); GPR_ASSERT(pthread_attr_init(&attr) == 0); if (gpr_thd_options_is_detached(options)) { @@ -68,6 +81,7 @@ int gpr_thd_new(gpr_thd_id *t, void (*thd_body)(void *arg), void *arg, if (!thread_started) { /* don't use gpr_free, as this was allocated using malloc (see above) */ free(a); + dec_thd_count(); } *t = (gpr_thd_id)p; return thread_started; @@ -77,4 +91,46 @@ gpr_thd_id gpr_thd_currentid(void) { return (gpr_thd_id)pthread_self(); } void gpr_thd_join(gpr_thd_id t) { pthread_join((pthread_t)t, NULL); } +/***************************************** + * Only used when fork support is enabled + */ + +static void inc_thd_count() { + if (grpc_fork_support_enabled()) { + gpr_mu_lock(&g_mu); + g_thread_count++; + gpr_mu_unlock(&g_mu); + } +} + +static void dec_thd_count() { + if (grpc_fork_support_enabled()) { + gpr_mu_lock(&g_mu); + g_thread_count--; + if (g_awaiting_threads && g_thread_count == 0) { + gpr_cv_signal(&g_cv); + } + gpr_mu_unlock(&g_mu); + } +} + +void gpr_thd_init() { + gpr_mu_init(&g_mu); + gpr_cv_init(&g_cv); + g_thread_count = 0; + g_awaiting_threads = 0; +} + +int gpr_await_threads(gpr_timespec deadline) { + gpr_mu_lock(&g_mu); + g_awaiting_threads = 1; + int res = 0; + if (g_thread_count > 0) { + res = gpr_cv_wait(&g_cv, &g_mu, deadline); + } + g_awaiting_threads = 0; + gpr_mu_unlock(&g_mu); + return res == 0; +} + #endif /* GPR_POSIX_SYNC */ diff --git a/src/core/lib/support/thd_windows.c b/src/core/lib/support/thd_windows.c index 54533e9412b..4c6013bf335 100644 --- a/src/core/lib/support/thd_windows.c +++ b/src/core/lib/support/thd_windows.c @@ -50,6 +50,8 @@ static void destroy_thread(struct thd_info *t) { gpr_free(t); } +void gpr_thd_init(void) {} + /* Body of every thread started via gpr_thd_new. */ static DWORD WINAPI thread_body(void *v) { g_thd_info = (struct thd_info *)v; diff --git a/src/core/lib/surface/init.c b/src/core/lib/surface/init.c index b089da2c54f..b04fa3d1539 100644 --- a/src/core/lib/surface/init.c +++ b/src/core/lib/surface/init.c @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -39,6 +40,8 @@ #include "src/core/lib/iomgr/timer_manager.h" #include "src/core/lib/profiling/timers.h" #include "src/core/lib/slice/slice_internal.h" +#include "src/core/lib/support/fork.h" +#include "src/core/lib/support/thd_internal.h" #include "src/core/lib/surface/alarm_internal.h" #include "src/core/lib/surface/api_trace.h" #include "src/core/lib/surface/call.h" @@ -62,9 +65,11 @@ static int g_initializations; static void do_basic_init(void) { gpr_log_verbosity_init(); + grpc_fork_support_init(); gpr_mu_init(&g_init_mu); grpc_register_built_in_plugins(); g_initializations = 0; + grpc_fork_handlers_auto_register(); } static bool append_filter(grpc_exec_ctx *exec_ctx, @@ -121,6 +126,7 @@ void grpc_init(void) { gpr_mu_lock(&g_init_mu); if (++g_initializations == 1) { gpr_time_init(); + gpr_thd_init(); grpc_stats_init(); grpc_slice_intern_init(); grpc_mdctx_global_init(); diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 7b684f2a585..792ac1751be 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -30,6 +30,7 @@ CORE_SOURCE_FILES = [ 'src/core/lib/support/env_linux.c', 'src/core/lib/support/env_posix.c', 'src/core/lib/support/env_windows.c', + 'src/core/lib/support/fork.c', 'src/core/lib/support/histogram.c', 'src/core/lib/support/host_port.c', 'src/core/lib/support/log.c', @@ -95,6 +96,8 @@ CORE_SOURCE_FILES = [ 'src/core/lib/iomgr/ev_windows.c', 'src/core/lib/iomgr/exec_ctx.c', 'src/core/lib/iomgr/executor.c', + 'src/core/lib/iomgr/fork_posix.c', + 'src/core/lib/iomgr/fork_windows.c', 'src/core/lib/iomgr/gethostname_fallback.c', 'src/core/lib/iomgr/gethostname_host_name_max.c', 'src/core/lib/iomgr/gethostname_sysconf.c', diff --git a/test/core/surface/public_headers_must_be_c89.c b/test/core/surface/public_headers_must_be_c89.c index d36d116afb8..8a7828d4c21 100644 --- a/test/core/surface/public_headers_must_be_c89.c +++ b/test/core/surface/public_headers_must_be_c89.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -29,6 +30,7 @@ #include #include #include +#include #include #include #include diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index 715237aa4b2..7e34fd6517e 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -875,6 +875,7 @@ include/grpc++/support/time.h \ include/grpc/byte_buffer.h \ include/grpc/byte_buffer_reader.h \ include/grpc/compression.h \ +include/grpc/fork.h \ include/grpc/grpc.h \ include/grpc/grpc_posix.h \ include/grpc/grpc_security_constants.h \ @@ -887,6 +888,7 @@ include/grpc/impl/codegen/byte_buffer_reader.h \ include/grpc/impl/codegen/compression_types.h \ include/grpc/impl/codegen/connectivity_state.h \ include/grpc/impl/codegen/exec_ctx_fwd.h \ +include/grpc/impl/codegen/fork.h \ include/grpc/impl/codegen/gpr_slice.h \ include/grpc/impl/codegen/gpr_types.h \ include/grpc/impl/codegen/grpc_types.h \ diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 46ce98f7b32..6a6efa2bbc3 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -876,6 +876,7 @@ include/grpc++/support/time.h \ include/grpc/byte_buffer.h \ include/grpc/byte_buffer_reader.h \ include/grpc/compression.h \ +include/grpc/fork.h \ include/grpc/grpc.h \ include/grpc/grpc_posix.h \ include/grpc/grpc_security_constants.h \ @@ -888,6 +889,7 @@ include/grpc/impl/codegen/byte_buffer_reader.h \ include/grpc/impl/codegen/compression_types.h \ include/grpc/impl/codegen/connectivity_state.h \ include/grpc/impl/codegen/exec_ctx_fwd.h \ +include/grpc/impl/codegen/fork.h \ include/grpc/impl/codegen/gpr_slice.h \ include/grpc/impl/codegen/gpr_types.h \ include/grpc/impl/codegen/grpc_types.h \ @@ -1031,6 +1033,7 @@ src/core/lib/support/atomic_with_std.h \ src/core/lib/support/backoff.h \ src/core/lib/support/block_annotate.h \ src/core/lib/support/env.h \ +src/core/lib/support/fork.h \ src/core/lib/support/memory.h \ src/core/lib/support/mpscq.h \ src/core/lib/support/murmur_hash.h \ @@ -1038,6 +1041,7 @@ src/core/lib/support/spinlock.h \ src/core/lib/support/stack_lockfree.h \ src/core/lib/support/string.h \ src/core/lib/support/string_windows.h \ +src/core/lib/support/thd_internal.h \ src/core/lib/support/time_precise.h \ src/core/lib/support/tmpfile.h \ src/core/lib/surface/alarm_internal.h \ diff --git a/tools/doxygen/Doxyfile.core b/tools/doxygen/Doxyfile.core index b8514fe3114..b9a3c3b4153 100644 --- a/tools/doxygen/Doxyfile.core +++ b/tools/doxygen/Doxyfile.core @@ -799,6 +799,7 @@ include/grpc/byte_buffer.h \ include/grpc/byte_buffer_reader.h \ include/grpc/census.h \ include/grpc/compression.h \ +include/grpc/fork.h \ include/grpc/grpc.h \ include/grpc/grpc_posix.h \ include/grpc/grpc_security.h \ @@ -816,6 +817,8 @@ include/grpc/impl/codegen/byte_buffer_reader.h \ include/grpc/impl/codegen/compression_types.h \ include/grpc/impl/codegen/connectivity_state.h \ include/grpc/impl/codegen/exec_ctx_fwd.h \ +include/grpc/impl/codegen/fork.h \ +include/grpc/impl/codegen/fork.h \ include/grpc/impl/codegen/gpr_slice.h \ include/grpc/impl/codegen/gpr_slice.h \ include/grpc/impl/codegen/gpr_types.h \ diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 33cafacdde1..8112c035674 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -799,6 +799,7 @@ include/grpc/byte_buffer.h \ include/grpc/byte_buffer_reader.h \ include/grpc/census.h \ include/grpc/compression.h \ +include/grpc/fork.h \ include/grpc/grpc.h \ include/grpc/grpc_posix.h \ include/grpc/grpc_security.h \ @@ -816,6 +817,8 @@ include/grpc/impl/codegen/byte_buffer_reader.h \ include/grpc/impl/codegen/compression_types.h \ include/grpc/impl/codegen/connectivity_state.h \ include/grpc/impl/codegen/exec_ctx_fwd.h \ +include/grpc/impl/codegen/fork.h \ +include/grpc/impl/codegen/fork.h \ include/grpc/impl/codegen/gpr_slice.h \ include/grpc/impl/codegen/gpr_slice.h \ include/grpc/impl/codegen/gpr_types.h \ @@ -1126,6 +1129,8 @@ src/core/lib/iomgr/exec_ctx.c \ src/core/lib/iomgr/exec_ctx.h \ src/core/lib/iomgr/executor.c \ src/core/lib/iomgr/executor.h \ +src/core/lib/iomgr/fork_posix.c \ +src/core/lib/iomgr/fork_windows.c \ src/core/lib/iomgr/gethostname.h \ src/core/lib/iomgr/gethostname_fallback.c \ src/core/lib/iomgr/gethostname_host_name_max.c \ @@ -1313,6 +1318,8 @@ src/core/lib/support/env.h \ src/core/lib/support/env_linux.c \ src/core/lib/support/env_posix.c \ src/core/lib/support/env_windows.c \ +src/core/lib/support/fork.c \ +src/core/lib/support/fork.h \ src/core/lib/support/histogram.c \ src/core/lib/support/host_port.c \ src/core/lib/support/log.c \ @@ -1340,6 +1347,7 @@ src/core/lib/support/sync.c \ src/core/lib/support/sync_posix.c \ src/core/lib/support/sync_windows.c \ src/core/lib/support/thd.c \ +src/core/lib/support/thd_internal.h \ src/core/lib/support/thd_posix.c \ src/core/lib/support/thd_windows.c \ src/core/lib/support/time.c \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index c46eb726c8a..eaf4eda609c 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -7782,6 +7782,7 @@ "src/core/lib/support/env_linux.c", "src/core/lib/support/env_posix.c", "src/core/lib/support/env_windows.c", + "src/core/lib/support/fork.c", "src/core/lib/support/histogram.c", "src/core/lib/support/host_port.c", "src/core/lib/support/log.c", @@ -7857,6 +7858,7 @@ "src/core/lib/support/backoff.h", "src/core/lib/support/block_annotate.h", "src/core/lib/support/env.h", + "src/core/lib/support/fork.h", "src/core/lib/support/memory.h", "src/core/lib/support/mpscq.h", "src/core/lib/support/murmur_hash.h", @@ -7864,6 +7866,7 @@ "src/core/lib/support/stack_lockfree.h", "src/core/lib/support/string.h", "src/core/lib/support/string_windows.h", + "src/core/lib/support/thd_internal.h", "src/core/lib/support/time_precise.h", "src/core/lib/support/tmpfile.h" ], @@ -7906,6 +7909,7 @@ "src/core/lib/support/backoff.h", "src/core/lib/support/block_annotate.h", "src/core/lib/support/env.h", + "src/core/lib/support/fork.h", "src/core/lib/support/memory.h", "src/core/lib/support/mpscq.h", "src/core/lib/support/murmur_hash.h", @@ -7913,6 +7917,7 @@ "src/core/lib/support/stack_lockfree.h", "src/core/lib/support/string.h", "src/core/lib/support/string_windows.h", + "src/core/lib/support/thd_internal.h", "src/core/lib/support/time_precise.h", "src/core/lib/support/tmpfile.h" ], @@ -7926,6 +7931,7 @@ "include/grpc/impl/codegen/atm_gcc_atomic.h", "include/grpc/impl/codegen/atm_gcc_sync.h", "include/grpc/impl/codegen/atm_windows.h", + "include/grpc/impl/codegen/fork.h", "include/grpc/impl/codegen/gpr_slice.h", "include/grpc/impl/codegen/gpr_types.h", "include/grpc/impl/codegen/port_platform.h", @@ -7943,6 +7949,7 @@ "include/grpc/impl/codegen/atm_gcc_atomic.h", "include/grpc/impl/codegen/atm_gcc_sync.h", "include/grpc/impl/codegen/atm_windows.h", + "include/grpc/impl/codegen/fork.h", "include/grpc/impl/codegen/gpr_slice.h", "include/grpc/impl/codegen/gpr_types.h", "include/grpc/impl/codegen/port_platform.h", @@ -8030,6 +8037,8 @@ "src/core/lib/iomgr/ev_windows.c", "src/core/lib/iomgr/exec_ctx.c", "src/core/lib/iomgr/executor.c", + "src/core/lib/iomgr/fork_posix.c", + "src/core/lib/iomgr/fork_windows.c", "src/core/lib/iomgr/gethostname_fallback.c", "src/core/lib/iomgr/gethostname_host_name_max.c", "src/core/lib/iomgr/gethostname_sysconf.c", @@ -8142,6 +8151,7 @@ "include/grpc/byte_buffer.h", "include/grpc/byte_buffer_reader.h", "include/grpc/compression.h", + "include/grpc/fork.h", "include/grpc/grpc.h", "include/grpc/grpc_posix.h", "include/grpc/grpc_security_constants.h", @@ -8275,6 +8285,7 @@ "include/grpc/byte_buffer.h", "include/grpc/byte_buffer_reader.h", "include/grpc/compression.h", + "include/grpc/fork.h", "include/grpc/grpc.h", "include/grpc/grpc_posix.h", "include/grpc/grpc_security_constants.h", From c5731324a4901233c45e1d41ff0be218cbe4e8f5 Mon Sep 17 00:00:00 2001 From: Ken Payson Date: Mon, 16 Oct 2017 13:17:02 -0700 Subject: [PATCH 18/86] Bug fixes for fork support --- include/grpc/impl/codegen/fork.h | 5 ++-- src/core/lib/iomgr/fork_posix.c | 45 +++++++++++++++++-------------- src/core/lib/iomgr/fork_windows.c | 5 +--- src/core/lib/iomgr/port.h | 4 +++ 4 files changed, 32 insertions(+), 27 deletions(-) diff --git a/include/grpc/impl/codegen/fork.h b/include/grpc/impl/codegen/fork.h index 03c0c4eede5..baec7a2f101 100644 --- a/include/grpc/impl/codegen/fork.h +++ b/include/grpc/impl/codegen/fork.h @@ -24,10 +24,9 @@ * active gRPC function calls between calling grpc_prefork() and * grpc_postfork_parent()/grpc_postfork_child(). * - * Returns 1 on success, 0 otherwise. * * Typical use: - * assert(grpc_prefork() == 1); + * grpc_prefork(); * int pid = fork(); * if (pid) { * grpc_postfork_parent(); @@ -38,7 +37,7 @@ * } */ -int grpc_prefork(); +void grpc_prefork(); void grpc_postfork_parent(); diff --git a/src/core/lib/iomgr/fork_posix.c b/src/core/lib/iomgr/fork_posix.c index 5f2880db379..a55b3a349a2 100644 --- a/src/core/lib/iomgr/fork_posix.c +++ b/src/core/lib/iomgr/fork_posix.c @@ -34,44 +34,49 @@ #include "src/core/lib/support/env.h" #include "src/core/lib/support/fork.h" #include "src/core/lib/support/thd_internal.h" +#include "src/core/lib/surface/init.h" /* * NOTE: FORKING IS NOT GENERALLY SUPPORTED, THIS IS ONLY INTENDED TO WORK * AROUND VERY SPECIFIC USE CASES. */ -int grpc_prefork() { +void grpc_prefork() { if (!grpc_fork_support_enabled()) { gpr_log(GPR_ERROR, "Fork support not enabled; try running with the " "environment variable GRPC_ENABLE_FORK_SUPPORT=1"); - return 0; + return; } - grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_timer_manager_set_threading(false); - grpc_executor_set_threading(&exec_ctx, false); - grpc_exec_ctx_finish(&exec_ctx); - if (!gpr_await_threads( - gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), - gpr_time_from_seconds(3, GPR_TIMESPAN)))) { - gpr_log(GPR_ERROR, "gRPC thread still active! Cannot fork!"); - return 0; + if (grpc_is_initialized()) { + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_timer_manager_set_threading(false); + grpc_executor_set_threading(&exec_ctx, false); + grpc_exec_ctx_finish(&exec_ctx); + if (!gpr_await_threads( + gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), + gpr_time_from_seconds(3, GPR_TIMESPAN)))) { + gpr_log(GPR_ERROR, "gRPC thread still active! Cannot fork!"); + } } - return 1; } void grpc_postfork_parent() { - grpc_timer_manager_set_threading(true); - grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_executor_set_threading(&exec_ctx, true); - grpc_exec_ctx_finish(&exec_ctx); + if (grpc_is_initialized()) { + grpc_timer_manager_set_threading(true); + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_executor_set_threading(&exec_ctx, true); + grpc_exec_ctx_finish(&exec_ctx); + } } void grpc_postfork_child() { - grpc_timer_manager_set_threading(true); - grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_executor_set_threading(&exec_ctx, true); - grpc_exec_ctx_finish(&exec_ctx); + if (grpc_is_initialized()) { + grpc_timer_manager_set_threading(true); + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_executor_set_threading(&exec_ctx, true); + grpc_exec_ctx_finish(&exec_ctx); + } } void grpc_fork_handlers_auto_register() { diff --git a/src/core/lib/iomgr/fork_windows.c b/src/core/lib/iomgr/fork_windows.c index 965ddfbd0ba..f9986f33c75 100644 --- a/src/core/lib/iomgr/fork_windows.c +++ b/src/core/lib/iomgr/fork_windows.c @@ -28,10 +28,7 @@ * AROUND VERY SPECIFIC USE CASES. */ -int grpc_prefork() { - gpr_log(GPR_ERROR, "Forking not supported on Windows"); - return 0; -} +void grpc_prefork() { gpr_log(GPR_ERROR, "Forking not supported on Windows"); } void grpc_postfork_parent() {} diff --git a/src/core/lib/iomgr/port.h b/src/core/lib/iomgr/port.h index 42033d0ba4b..1970d106d57 100644 --- a/src/core/lib/iomgr/port.h +++ b/src/core/lib/iomgr/port.h @@ -30,6 +30,7 @@ #define GRPC_HAVE_IP_PKTINFO 1 #define GRPC_HAVE_MSG_NOSIGNAL 1 #define GRPC_HAVE_UNIX_SOCKET 1 +#define GRPC_POSIX_FORK 1 #define GRPC_POSIX_NO_SPECIAL_WAKEUP_FD 1 #define GRPC_POSIX_SOCKET 1 #define GRPC_POSIX_SOCKETADDR 1 @@ -59,6 +60,7 @@ #define GRPC_HAVE_MSG_NOSIGNAL 1 #define GRPC_HAVE_UNIX_SOCKET 1 #define GRPC_LINUX_MULTIPOLL_WITH_EPOLL 1 +#define GRPC_POSIX_FORK 1 #define GRPC_POSIX_HOST_NAME_MAX 1 #define GRPC_POSIX_SOCKET 1 #define GRPC_POSIX_SOCKETADDR 1 @@ -90,6 +92,7 @@ #define GRPC_HAVE_SO_NOSIGPIPE 1 #define GRPC_HAVE_UNIX_SOCKET 1 #define GRPC_MSG_IOVLEN_TYPE int +#define GRPC_POSIX_FORK 1 #define GRPC_POSIX_NO_SPECIAL_WAKEUP_FD 1 #define GRPC_POSIX_SOCKET 1 #define GRPC_POSIX_SOCKETADDR 1 @@ -103,6 +106,7 @@ #define GRPC_HAVE_IPV6_RECVPKTINFO 1 #define GRPC_HAVE_SO_NOSIGPIPE 1 #define GRPC_HAVE_UNIX_SOCKET 1 +#define GRPC_POSIX_FORK 1 #define GRPC_POSIX_NO_SPECIAL_WAKEUP_FD 1 #define GRPC_POSIX_SOCKET 1 #define GRPC_POSIX_SOCKETADDR 1 From 5b76eb9824147c889294c8cf2f37d95e85c6b9a9 Mon Sep 17 00:00:00 2001 From: Alexander Polcyn Date: Wed, 18 Oct 2017 17:10:33 -0700 Subject: [PATCH 19/86] Use prebuilt ruby artifact docker image from dockerhub --- tools/run_tests/artifacts/build_artifact_ruby.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/run_tests/artifacts/build_artifact_ruby.sh b/tools/run_tests/artifacts/build_artifact_ruby.sh index 993aaaedbd9..9165a224840 100755 --- a/tools/run_tests/artifacts/build_artifact_ruby.sh +++ b/tools/run_tests/artifacts/build_artifact_ruby.sh @@ -42,6 +42,7 @@ tools/run_tests/helper_scripts/bundle_install_wrapper.sh set -ex +export DOCKERHUB_ORGANIZATION=grpctesting rake gem:native if [ "$SYSTEM" == "Darwin" ] ; then From 41bdeff8783f236c910ff75157da66afd007059a Mon Sep 17 00:00:00 2001 From: Alexander Polcyn Date: Tue, 17 Oct 2017 17:39:57 -0700 Subject: [PATCH 20/86] Fix call object memory leak in ruby, when call object is closed --- src/ruby/ext/grpc/rb_call.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ruby/ext/grpc/rb_call.c b/src/ruby/ext/grpc/rb_call.c index 29c4a94816b..e920fc86c52 100644 --- a/src/ruby/ext/grpc/rb_call.c +++ b/src/ruby/ext/grpc/rb_call.c @@ -221,6 +221,7 @@ static VALUE grpc_rb_call_close(VALUE self) { TypedData_Get_Struct(self, grpc_rb_call, &grpc_call_data_type, call); if (call != NULL) { destroy_call(call); + xfree(RTYPEDDATA_DATA(self)); RTYPEDDATA_DATA(self) = NULL; } return Qnil; From 99a375114a692e79b4807701d352b6026f05aba7 Mon Sep 17 00:00:00 2001 From: Alexander Polcyn Date: Fri, 20 Oct 2017 14:39:46 -0700 Subject: [PATCH 21/86] Update max-allowed-version of googleauth ruby dependency --- grpc.gemspec | 2 +- templates/grpc.gemspec.template | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/grpc.gemspec b/grpc.gemspec index 83f81a30f15..b7eb6d586ff 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -28,7 +28,7 @@ Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.add_dependency 'google-protobuf', '~> 3.1' - s.add_dependency 'googleauth', '~> 0.5.1' + s.add_dependency 'googleauth', '>= 0.5.1', '< 0.7' s.add_dependency 'googleapis-common-protos-types', '~> 1.0.0' s.add_development_dependency 'bundler', '~> 1.9' diff --git a/templates/grpc.gemspec.template b/templates/grpc.gemspec.template index 215d5f9df9a..fb54de1c8e2 100644 --- a/templates/grpc.gemspec.template +++ b/templates/grpc.gemspec.template @@ -30,7 +30,7 @@ s.platform = Gem::Platform::RUBY s.add_dependency 'google-protobuf', '~> 3.1' - s.add_dependency 'googleauth', '~> 0.5.1' + s.add_dependency 'googleauth', '>= 0.5.1', '< 0.7' s.add_dependency 'googleapis-common-protos-types', '~> 1.0.0' s.add_development_dependency 'bundler', '~> 1.9' From 863a0500dffdefc258a68e5abacc1d01fbbb020b Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Sat, 21 Oct 2017 01:46:32 +0200 Subject: [PATCH 22/86] Flagging 1.7.0 --- BUILD | 4 ++-- CMakeLists.txt | 2 +- Makefile | 6 +++--- build.yaml | 4 ++-- gRPC-Core.podspec | 2 +- gRPC-ProtoRPC.podspec | 2 +- gRPC-RxLibrary.podspec | 2 +- gRPC.podspec | 2 +- package.json | 2 +- package.xml | 4 ++-- src/core/lib/surface/version.c | 2 +- src/cpp/common/version_cc.cc | 2 +- src/csharp/Grpc.Core/Version.csproj.include | 2 +- src/csharp/Grpc.Core/VersionInfo.cs | 2 +- src/csharp/build_packages_dotnetcli.bat | 2 +- src/csharp/build_packages_dotnetcli.sh | 4 ++-- src/node/health_check/package.json | 4 ++-- src/node/tools/package.json | 2 +- src/objective-c/!ProtoCompiler-gRPCPlugin.podspec | 2 +- src/objective-c/GRPCClient/private/version.h | 2 +- src/php/ext/grpc/version.h | 2 +- src/python/grpcio/grpc/_grpcio_metadata.py | 2 +- src/python/grpcio/grpc_version.py | 2 +- src/python/grpcio_health_checking/grpc_version.py | 2 +- src/python/grpcio_reflection/grpc_version.py | 2 +- src/python/grpcio_testing/grpc_version.py | 2 +- src/python/grpcio_tests/grpc_version.py | 2 +- src/ruby/lib/grpc/version.rb | 2 +- src/ruby/tools/version.rb | 2 +- tools/distrib/python/grpcio_tools/grpc_version.py | 2 +- tools/doxygen/Doxyfile.c++ | 2 +- tools/doxygen/Doxyfile.c++.internal | 2 +- tools/doxygen/Doxyfile.core | 2 +- tools/doxygen/Doxyfile.core.internal | 2 +- 34 files changed, 41 insertions(+), 41 deletions(-) diff --git a/BUILD b/BUILD index 222cdac6df1..397203d58a8 100644 --- a/BUILD +++ b/BUILD @@ -36,9 +36,9 @@ load( # This should be updated along with build.yaml g_stands_for = "gambit" -core_version = "5.0.0-dev" +core_version = "5.0.0" -version = "1.7.0-pre1" +version = "1.7.0" GPR_PUBLIC_HDRS = [ "include/grpc/support/alloc.h", diff --git a/CMakeLists.txt b/CMakeLists.txt index 4586bcaf289..816749473b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ cmake_minimum_required(VERSION 2.8) set(PACKAGE_NAME "grpc") -set(PACKAGE_VERSION "1.7.0-pre1") +set(PACKAGE_VERSION "1.7.0") set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/") diff --git a/Makefile b/Makefile index 406670f3d22..0aafe50e5c5 100644 --- a/Makefile +++ b/Makefile @@ -410,9 +410,9 @@ E = @echo Q = @ endif -CORE_VERSION = 5.0.0-dev -CPP_VERSION = 1.7.0-pre1 -CSHARP_VERSION = 1.7.0-pre1 +CORE_VERSION = 5.0.0 +CPP_VERSION = 1.7.0 +CSHARP_VERSION = 1.7.0 CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES)) CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) diff --git a/build.yaml b/build.yaml index 97cc0fb61f2..fbe6aef4dd9 100644 --- a/build.yaml +++ b/build.yaml @@ -12,9 +12,9 @@ settings: '#08': Use "-preN" suffixes to identify pre-release versions '#09': Per-language overrides are possible with (eg) ruby_version tag here '#10': See the expand_version.py for all the quirks here - core_version: 5.0.0-dev + core_version: 5.0.0 g_stands_for: gambit - version: 1.7.0-pre1 + version: 1.7.0 filegroups: - name: census public_headers: diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 48f8f43e8d5..aa198fe72c9 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -22,7 +22,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-Core' - version = '1.7.0-pre1' + version = '1.7.0' s.version = version s.summary = 'Core cross-platform gRPC library, written in C' s.homepage = 'https://grpc.io' diff --git a/gRPC-ProtoRPC.podspec b/gRPC-ProtoRPC.podspec index 4b7b36a6874..b88b2319b7d 100644 --- a/gRPC-ProtoRPC.podspec +++ b/gRPC-ProtoRPC.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-ProtoRPC' - version = '1.7.0-pre1' + version = '1.7.0' s.version = version s.summary = 'RPC library for Protocol Buffers, based on gRPC' s.homepage = 'https://grpc.io' diff --git a/gRPC-RxLibrary.podspec b/gRPC-RxLibrary.podspec index 673239cb90a..215fc735be5 100644 --- a/gRPC-RxLibrary.podspec +++ b/gRPC-RxLibrary.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-RxLibrary' - version = '1.7.0-pre1' + version = '1.7.0' s.version = version s.summary = 'Reactive Extensions library for iOS/OSX.' s.homepage = 'https://grpc.io' diff --git a/gRPC.podspec b/gRPC.podspec index 6c200905416..3cda60cd1b8 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -20,7 +20,7 @@ Pod::Spec.new do |s| s.name = 'gRPC' - version = '1.7.0-pre1' + version = '1.7.0' s.version = version s.summary = 'gRPC client library for iOS/OSX' s.homepage = 'https://grpc.io' diff --git a/package.json b/package.json index 55a5a6bcdae..b5dd83f3d7e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "grpc", - "version": "1.7.0-pre1", + "version": "1.7.0", "author": "Google Inc.", "description": "gRPC Library for Node", "homepage": "https://grpc.io/", diff --git a/package.xml b/package.xml index 472dabbb8de..17503926381 100644 --- a/package.xml +++ b/package.xml @@ -13,8 +13,8 @@ 2017-08-24 - 1.7.0RC1 - 1.7.0RC1 + 1.7.0 + 1.7.0 beta diff --git a/src/core/lib/surface/version.c b/src/core/lib/surface/version.c index fd6ea4daa9f..2f0610a202e 100644 --- a/src/core/lib/surface/version.c +++ b/src/core/lib/surface/version.c @@ -21,6 +21,6 @@ #include -const char *grpc_version_string(void) { return "5.0.0-dev"; } +const char *grpc_version_string(void) { return "5.0.0"; } const char *grpc_g_stands_for(void) { return "gambit"; } diff --git a/src/cpp/common/version_cc.cc b/src/cpp/common/version_cc.cc index 766c6148fee..01b033d04e0 100644 --- a/src/cpp/common/version_cc.cc +++ b/src/cpp/common/version_cc.cc @@ -22,5 +22,5 @@ #include namespace grpc { -grpc::string Version() { return "1.7.0-pre1"; } +grpc::string Version() { return "1.7.0"; } } diff --git a/src/csharp/Grpc.Core/Version.csproj.include b/src/csharp/Grpc.Core/Version.csproj.include index 76fd55cf930..b34e64adca7 100755 --- a/src/csharp/Grpc.Core/Version.csproj.include +++ b/src/csharp/Grpc.Core/Version.csproj.include @@ -1,7 +1,7 @@ - 1.7.0-pre1 + 1.7.0 3.3.0 diff --git a/src/csharp/Grpc.Core/VersionInfo.cs b/src/csharp/Grpc.Core/VersionInfo.cs index fbffbb079c6..c0de225ca7d 100644 --- a/src/csharp/Grpc.Core/VersionInfo.cs +++ b/src/csharp/Grpc.Core/VersionInfo.cs @@ -38,6 +38,6 @@ namespace Grpc.Core /// /// Current version of gRPC C# /// - public const string CurrentVersion = "1.7.0-pre1"; + public const string CurrentVersion = "1.7.0"; } } diff --git a/src/csharp/build_packages_dotnetcli.bat b/src/csharp/build_packages_dotnetcli.bat index 8377f6ccc78..f25c0038e38 100755 --- a/src/csharp/build_packages_dotnetcli.bat +++ b/src/csharp/build_packages_dotnetcli.bat @@ -13,7 +13,7 @@ @rem limitations under the License. @rem Current package versions -set VERSION=1.7.0-pre1 +set VERSION=1.7.0 @rem Adjust the location of nuget.exe set NUGET=C:\nuget\nuget.exe diff --git a/src/csharp/build_packages_dotnetcli.sh b/src/csharp/build_packages_dotnetcli.sh index 30d2bc6bfcf..a4ec409952b 100755 --- a/src/csharp/build_packages_dotnetcli.sh +++ b/src/csharp/build_packages_dotnetcli.sh @@ -39,7 +39,7 @@ dotnet pack --configuration Release Grpc.Auth --output ../../../artifacts dotnet pack --configuration Release Grpc.HealthCheck --output ../../../artifacts dotnet pack --configuration Release Grpc.Reflection --output ../../../artifacts -nuget pack Grpc.nuspec -Version "1.7.0-pre1" -OutputDirectory ../../artifacts -nuget pack Grpc.Tools.nuspec -Version "1.7.0-pre1" -OutputDirectory ../../artifacts +nuget pack Grpc.nuspec -Version "1.7.0" -OutputDirectory ../../artifacts +nuget pack Grpc.Tools.nuspec -Version "1.7.0" -OutputDirectory ../../artifacts (cd ../../artifacts && zip csharp_nugets_dotnetcli.zip *.nupkg) diff --git a/src/node/health_check/package.json b/src/node/health_check/package.json index 0942d28018f..e04f75eb5d5 100644 --- a/src/node/health_check/package.json +++ b/src/node/health_check/package.json @@ -1,6 +1,6 @@ { "name": "grpc-health-check", - "version": "1.7.0-pre1", + "version": "1.7.0", "author": "Google Inc.", "description": "Health check service for use with gRPC", "repository": { @@ -15,7 +15,7 @@ } ], "dependencies": { - "grpc": "^1.7.0-pre1", + "grpc": "^1.7.0", "lodash": "^3.9.3", "google-protobuf": "^3.0.0" }, diff --git a/src/node/tools/package.json b/src/node/tools/package.json index 6863b3a57d2..c51553beb85 100644 --- a/src/node/tools/package.json +++ b/src/node/tools/package.json @@ -1,6 +1,6 @@ { "name": "grpc-tools", - "version": "1.7.0-pre1", + "version": "1.7.0", "author": "Google Inc.", "description": "Tools for developing with gRPC on Node.js", "homepage": "https://grpc.io/", diff --git a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec index 19eb0ca1ab2..c1a4b9b0e68 100644 --- a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec +++ b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec @@ -42,7 +42,7 @@ Pod::Spec.new do |s| # exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed # before them. s.name = '!ProtoCompiler-gRPCPlugin' - v = '1.7.0-pre1' + v = '1.7.0' s.version = v s.summary = 'The gRPC ProtoC plugin generates Objective-C files from .proto services.' s.description = <<-DESC diff --git a/src/objective-c/GRPCClient/private/version.h b/src/objective-c/GRPCClient/private/version.h index 82748febfd8..978e9a50642 100644 --- a/src/objective-c/GRPCClient/private/version.h +++ b/src/objective-c/GRPCClient/private/version.h @@ -23,4 +23,4 @@ // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.7.0-pre1" +#define GRPC_OBJC_VERSION_STRING @"1.7.0" diff --git a/src/php/ext/grpc/version.h b/src/php/ext/grpc/version.h index 4be72ba2bce..ff246302c4b 100644 --- a/src/php/ext/grpc/version.h +++ b/src/php/ext/grpc/version.h @@ -20,6 +20,6 @@ #ifndef VERSION_H #define VERSION_H -#define PHP_GRPC_VERSION "1.7.0RC1" +#define PHP_GRPC_VERSION "1.7.0" #endif /* VERSION_H */ diff --git a/src/python/grpcio/grpc/_grpcio_metadata.py b/src/python/grpcio/grpc/_grpcio_metadata.py index 6cceafffe72..7b3d2632dc4 100644 --- a/src/python/grpcio/grpc/_grpcio_metadata.py +++ b/src/python/grpcio/grpc/_grpcio_metadata.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc/_grpcio_metadata.py.template`!!! -__version__ = """1.7.0rc1""" +__version__ = """1.7.0""" diff --git a/src/python/grpcio/grpc_version.py b/src/python/grpcio/grpc_version.py index 1a5121247ea..eb8003ce57b 100644 --- a/src/python/grpcio/grpc_version.py +++ b/src/python/grpcio/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_version.py.template`!!! -VERSION='1.7.0rc1' +VERSION='1.7.0' diff --git a/src/python/grpcio_health_checking/grpc_version.py b/src/python/grpcio_health_checking/grpc_version.py index 5c8f192fb84..56382d734fb 100644 --- a/src/python/grpcio_health_checking/grpc_version.py +++ b/src/python/grpcio_health_checking/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_health_checking/grpc_version.py.template`!!! -VERSION='1.7.0rc1' +VERSION='1.7.0' diff --git a/src/python/grpcio_reflection/grpc_version.py b/src/python/grpcio_reflection/grpc_version.py index 827006c1621..e2c1d4d60da 100644 --- a/src/python/grpcio_reflection/grpc_version.py +++ b/src/python/grpcio_reflection/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_reflection/grpc_version.py.template`!!! -VERSION='1.7.0rc1' +VERSION='1.7.0' diff --git a/src/python/grpcio_testing/grpc_version.py b/src/python/grpcio_testing/grpc_version.py index e765bf3f935..33d6869ef85 100644 --- a/src/python/grpcio_testing/grpc_version.py +++ b/src/python/grpcio_testing/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_testing/grpc_version.py.template`!!! -VERSION='1.7.0rc1' +VERSION='1.7.0' diff --git a/src/python/grpcio_tests/grpc_version.py b/src/python/grpcio_tests/grpc_version.py index 36048082537..9334327fef9 100644 --- a/src/python/grpcio_tests/grpc_version.py +++ b/src/python/grpcio_tests/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_tests/grpc_version.py.template`!!! -VERSION='1.7.0rc1' +VERSION='1.7.0' diff --git a/src/ruby/lib/grpc/version.rb b/src/ruby/lib/grpc/version.rb index 1dc79b706ba..570915f8ed6 100644 --- a/src/ruby/lib/grpc/version.rb +++ b/src/ruby/lib/grpc/version.rb @@ -14,5 +14,5 @@ # GRPC contains the General RPC module. module GRPC - VERSION = '1.7.0.pre1' + VERSION = '1.7.0' end diff --git a/src/ruby/tools/version.rb b/src/ruby/tools/version.rb index a27404f9460..e37662847f7 100644 --- a/src/ruby/tools/version.rb +++ b/src/ruby/tools/version.rb @@ -14,6 +14,6 @@ module GRPC module Tools - VERSION = '1.7.0.pre1' + VERSION = '1.7.0' end end diff --git a/tools/distrib/python/grpcio_tools/grpc_version.py b/tools/distrib/python/grpcio_tools/grpc_version.py index 81a92d6bd6a..bcc2502dd9f 100644 --- a/tools/distrib/python/grpcio_tools/grpc_version.py +++ b/tools/distrib/python/grpcio_tools/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/grpc_version.py.template`!!! -VERSION='1.7.0rc1' +VERSION='1.7.0' diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index 7e34fd6517e..021a664a449 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.7.0-pre1 +PROJECT_NUMBER = 1.7.0 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 6a6efa2bbc3..bb07aa44a52 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.7.0-pre1 +PROJECT_NUMBER = 1.7.0 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.core b/tools/doxygen/Doxyfile.core index b9a3c3b4153..52dd9a151ec 100644 --- a/tools/doxygen/Doxyfile.core +++ b/tools/doxygen/Doxyfile.core @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC Core" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 5.0.0-dev +PROJECT_NUMBER = 5.0.0 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 8112c035674..ce6c1503f8e 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC Core" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 5.0.0-dev +PROJECT_NUMBER = 5.0.0 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a From 94d669e0223fc324feba212ec4e6a1709b769fc4 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Sun, 22 Oct 2017 14:56:10 -0700 Subject: [PATCH 23/86] Supress strict prototype warning in gRPC pods --- gRPC-Core.podspec | 1 + gRPC-ProtoRPC.podspec | 1 + gRPC-RxLibrary.podspec | 4 ++++ gRPC.podspec | 1 + templates/gRPC-Core.podspec.template | 1 + templates/gRPC-ProtoRPC.podspec.template | 1 + templates/gRPC-RxLibrary.podspec.template | 4 ++++ templates/gRPC.podspec.template | 1 + 8 files changed, 14 insertions(+) diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 48f8f43e8d5..4d86a625b63 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -85,6 +85,7 @@ Pod::Spec.new do |s| 'USE_HEADERMAP' => 'NO', 'ALWAYS_SEARCH_USER_PATHS' => 'NO', 'GCC_PREPROCESSOR_DEFINITIONS' => '"$(inherited)" "COCOAPODS=1" "PB_NO_PACKED_STRUCTS=1"', + 'CLANG_WARN_STRICT_PROTOTYPES' => 'NO', } s.default_subspecs = 'Interface', 'Implementation' diff --git a/gRPC-ProtoRPC.podspec b/gRPC-ProtoRPC.podspec index 4b7b36a6874..ca265035b1e 100644 --- a/gRPC-ProtoRPC.podspec +++ b/gRPC-ProtoRPC.podspec @@ -52,5 +52,6 @@ Pod::Spec.new do |s| 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1', # This is needed by all pods that depend on gRPC-RxLibrary: 'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES', + 'CLANG_WARN_STRICT_PROTOTYPES' => 'NO', } end diff --git a/gRPC-RxLibrary.podspec b/gRPC-RxLibrary.podspec index 673239cb90a..f9420686e77 100644 --- a/gRPC-RxLibrary.podspec +++ b/gRPC-RxLibrary.podspec @@ -44,4 +44,8 @@ Pod::Spec.new do |s| s.source_files = "#{src_dir}/*.{h,m}", "#{src_dir}/**/*.{h,m}" s.private_header_files = "#{src_dir}/private/*.h" s.header_mappings_dir = "#{src_dir}" + + s.pod_target_xcconfig = { + 'CLANG_WARN_STRICT_PROTOTYPES' => 'NO', + } end diff --git a/gRPC.podspec b/gRPC.podspec index 6c200905416..bb526e84424 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -50,6 +50,7 @@ Pod::Spec.new do |s| s.pod_target_xcconfig = { # This is needed by all pods that depend on gRPC-RxLibrary: 'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES', + 'CLANG_WARN_STRICT_PROTOTYPES' => 'NO', } s.subspec 'Main' do |ss| diff --git a/templates/gRPC-Core.podspec.template b/templates/gRPC-Core.podspec.template index e34bc8331e9..2a583e0388a 100644 --- a/templates/gRPC-Core.podspec.template +++ b/templates/gRPC-Core.podspec.template @@ -112,6 +112,7 @@ 'USE_HEADERMAP' => 'NO', 'ALWAYS_SEARCH_USER_PATHS' => 'NO', 'GCC_PREPROCESSOR_DEFINITIONS' => '"$(inherited)" "COCOAPODS=1" "PB_NO_PACKED_STRUCTS=1"', + 'CLANG_WARN_STRICT_PROTOTYPES' => 'NO', } s.default_subspecs = 'Interface', 'Implementation' diff --git a/templates/gRPC-ProtoRPC.podspec.template b/templates/gRPC-ProtoRPC.podspec.template index 4d99f6e19fc..d2dcc429ef1 100644 --- a/templates/gRPC-ProtoRPC.podspec.template +++ b/templates/gRPC-ProtoRPC.podspec.template @@ -54,5 +54,6 @@ 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1', # This is needed by all pods that depend on gRPC-RxLibrary: 'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES', + 'CLANG_WARN_STRICT_PROTOTYPES' => 'NO', } end diff --git a/templates/gRPC-RxLibrary.podspec.template b/templates/gRPC-RxLibrary.podspec.template index de4ee1e4385..14147d7dc1b 100644 --- a/templates/gRPC-RxLibrary.podspec.template +++ b/templates/gRPC-RxLibrary.podspec.template @@ -46,4 +46,8 @@ s.source_files = "#{src_dir}/*.{h,m}", "#{src_dir}/**/*.{h,m}" s.private_header_files = "#{src_dir}/private/*.h" s.header_mappings_dir = "#{src_dir}" + + s.pod_target_xcconfig = { + 'CLANG_WARN_STRICT_PROTOTYPES' => 'NO', + } end diff --git a/templates/gRPC.podspec.template b/templates/gRPC.podspec.template index 4b360cfb4c4..6616e74bd71 100644 --- a/templates/gRPC.podspec.template +++ b/templates/gRPC.podspec.template @@ -52,6 +52,7 @@ s.pod_target_xcconfig = { # This is needed by all pods that depend on gRPC-RxLibrary: 'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES', + 'CLANG_WARN_STRICT_PROTOTYPES' => 'NO', } s.subspec 'Main' do |ss| From eec87415fea76bbb092111185299ebf6be679229 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 24 Oct 2017 11:15:17 +0200 Subject: [PATCH 24/86] unref resource quota on windows --- src/core/lib/iomgr/tcp_windows.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/lib/iomgr/tcp_windows.c b/src/core/lib/iomgr/tcp_windows.c index 2cbb97403b0..9b634a2a1fe 100644 --- a/src/core/lib/iomgr/tcp_windows.c +++ b/src/core/lib/iomgr/tcp_windows.c @@ -441,6 +441,7 @@ grpc_endpoint *grpc_tcp_create(grpc_exec_ctx *exec_ctx, grpc_winsocket *socket, tcp->resource_user = grpc_resource_user_create(resource_quota, peer_string); /* Tell network status tracking code about the new endpoint */ grpc_network_status_register_endpoint(&tcp->base); + grpc_resource_quota_unref_internal(exec_ctx, resource_quota); return &tcp->base; } From e18928a02978228110c3937e112c001a721eabba Mon Sep 17 00:00:00 2001 From: Matt Kwong Date: Mon, 9 Oct 2017 11:26:53 -0700 Subject: [PATCH 25/86] Use Ruby 2.3 for Brew --- .../internal_ci/helper_scripts/prepare_build_macos_rc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/internal_ci/helper_scripts/prepare_build_macos_rc b/tools/internal_ci/helper_scripts/prepare_build_macos_rc index 5a5898f94c4..a50e189e368 100644 --- a/tools/internal_ci/helper_scripts/prepare_build_macos_rc +++ b/tools/internal_ci/helper_scripts/prepare_build_macos_rc @@ -32,11 +32,12 @@ pip install google-api-python-client --user python export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/GrpcTesting-d0eeee2db331.json # If this is a PR using RUN_TESTS_FLAGS var, then add flags to filter tests -if [ -n "$KOKORO_GITHUB_PULL_REQUEST_NUMBER" ] && [ -n "$RUN_TESTS_FLAGS" ]; then - brew install jq - ghprbTargetBranch=$(curl -s https://api.github.com/repos/grpc/grpc/pulls/$KOKORO_GITHUB_PULL_REQUEST_NUMBER | jq -r .base.ref) - export RUN_TESTS_FLAGS="$RUN_TESTS_FLAGS --filter_pr_tests --base_branch origin/$ghprbTargetBranch" -fi +# TODO(matt-kwong): enable after fixing brew issue +# if [ -n "$KOKORO_GITHUB_PULL_REQUEST_NUMBER" ] && [ -n "$RUN_TESTS_FLAGS" ]; then +# brew install jq +# ghprbTargetBranch=$(curl -s https://api.github.com/repos/grpc/grpc/pulls/$KOKORO_GITHUB_PULL_REQUEST_NUMBER | jq -r .base.ref) +# export RUN_TESTS_FLAGS="$RUN_TESTS_FLAGS --filter_pr_tests --base_branch origin/$ghprbTargetBranch" +# fi set +ex # rvm script is very verbose and exits with errorcode source $HOME/.rvm/scripts/rvm From c91983d456966dab5b4232f14a4a3f1084f4b3f1 Mon Sep 17 00:00:00 2001 From: Matt Kwong Date: Thu, 19 Oct 2017 15:12:31 -0700 Subject: [PATCH 26/86] Fix brew install issue; enable MacOS test filtering --- .../helper_scripts/prepare_build_macos_rc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/internal_ci/helper_scripts/prepare_build_macos_rc b/tools/internal_ci/helper_scripts/prepare_build_macos_rc index a50e189e368..5196c7b536d 100644 --- a/tools/internal_ci/helper_scripts/prepare_build_macos_rc +++ b/tools/internal_ci/helper_scripts/prepare_build_macos_rc @@ -32,12 +32,12 @@ pip install google-api-python-client --user python export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/GrpcTesting-d0eeee2db331.json # If this is a PR using RUN_TESTS_FLAGS var, then add flags to filter tests -# TODO(matt-kwong): enable after fixing brew issue -# if [ -n "$KOKORO_GITHUB_PULL_REQUEST_NUMBER" ] && [ -n "$RUN_TESTS_FLAGS" ]; then -# brew install jq -# ghprbTargetBranch=$(curl -s https://api.github.com/repos/grpc/grpc/pulls/$KOKORO_GITHUB_PULL_REQUEST_NUMBER | jq -r .base.ref) -# export RUN_TESTS_FLAGS="$RUN_TESTS_FLAGS --filter_pr_tests --base_branch origin/$ghprbTargetBranch" -# fi +if [ -n "$KOKORO_GITHUB_PULL_REQUEST_NUMBER" ] && [ -n "$RUN_TESTS_FLAGS" ]; then + brew update + brew install jq + ghprbTargetBranch=$(curl -s https://api.github.com/repos/grpc/grpc/pulls/$KOKORO_GITHUB_PULL_REQUEST_NUMBER | jq -r .base.ref) + export RUN_TESTS_FLAGS="$RUN_TESTS_FLAGS --filter_pr_tests --base_branch origin/$ghprbTargetBranch" +fi set +ex # rvm script is very verbose and exits with errorcode source $HOME/.rvm/scripts/rvm From 40ba62f2a2b4b03ee03ed67a1920c033285fd155 Mon Sep 17 00:00:00 2001 From: Alexander Polcyn Date: Thu, 26 Oct 2017 20:17:26 -0700 Subject: [PATCH 27/86] Bump v1.7.x branch to 1.7.1 --- BUILD | 2 +- CMakeLists.txt | 2 +- Makefile | 4 ++-- build.yaml | 2 +- gRPC-Core.podspec | 2 +- gRPC-ProtoRPC.podspec | 2 +- gRPC-RxLibrary.podspec | 2 +- gRPC.podspec | 2 +- package.json | 2 +- package.xml | 4 ++-- src/cpp/common/version_cc.cc | 2 +- src/csharp/Grpc.Core/Version.csproj.include | 2 +- src/csharp/Grpc.Core/VersionInfo.cs | 4 ++-- src/csharp/build_packages_dotnetcli.bat | 2 +- src/csharp/build_packages_dotnetcli.sh | 4 ++-- src/node/health_check/package.json | 4 ++-- src/node/tools/package.json | 2 +- src/objective-c/!ProtoCompiler-gRPCPlugin.podspec | 2 +- src/objective-c/GRPCClient/private/version.h | 2 +- src/php/composer.json | 2 +- src/php/ext/grpc/version.h | 2 +- src/python/grpcio/grpc/_grpcio_metadata.py | 2 +- src/python/grpcio/grpc_version.py | 2 +- src/python/grpcio_health_checking/grpc_version.py | 2 +- src/python/grpcio_reflection/grpc_version.py | 2 +- src/python/grpcio_testing/grpc_version.py | 2 +- src/python/grpcio_tests/grpc_version.py | 2 +- src/ruby/lib/grpc/version.rb | 2 +- src/ruby/tools/version.rb | 2 +- tools/distrib/python/grpcio_tools/grpc_version.py | 2 +- tools/doxygen/Doxyfile.c++ | 2 +- tools/doxygen/Doxyfile.c++.internal | 2 +- 32 files changed, 37 insertions(+), 37 deletions(-) diff --git a/BUILD b/BUILD index 397203d58a8..e61fed86efc 100644 --- a/BUILD +++ b/BUILD @@ -38,7 +38,7 @@ g_stands_for = "gambit" core_version = "5.0.0" -version = "1.7.0" +version = "1.7.1" GPR_PUBLIC_HDRS = [ "include/grpc/support/alloc.h", diff --git a/CMakeLists.txt b/CMakeLists.txt index 816749473b3..a5f472f4b5f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ cmake_minimum_required(VERSION 2.8) set(PACKAGE_NAME "grpc") -set(PACKAGE_VERSION "1.7.0") +set(PACKAGE_VERSION "1.7.1") set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/") diff --git a/Makefile b/Makefile index 0aafe50e5c5..eeb830e34b0 100644 --- a/Makefile +++ b/Makefile @@ -411,8 +411,8 @@ Q = @ endif CORE_VERSION = 5.0.0 -CPP_VERSION = 1.7.0 -CSHARP_VERSION = 1.7.0 +CPP_VERSION = 1.7.1 +CSHARP_VERSION = 1.7.1 CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES)) CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) diff --git a/build.yaml b/build.yaml index fbe6aef4dd9..159bc2d0e33 100644 --- a/build.yaml +++ b/build.yaml @@ -14,7 +14,7 @@ settings: '#10': See the expand_version.py for all the quirks here core_version: 5.0.0 g_stands_for: gambit - version: 1.7.0 + version: 1.7.1 filegroups: - name: census public_headers: diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 213fb54680b..33d399d9419 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -22,7 +22,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-Core' - version = '1.7.0' + version = '1.7.1' s.version = version s.summary = 'Core cross-platform gRPC library, written in C' s.homepage = 'https://grpc.io' diff --git a/gRPC-ProtoRPC.podspec b/gRPC-ProtoRPC.podspec index 39a76b84b17..6ae01ed73b4 100644 --- a/gRPC-ProtoRPC.podspec +++ b/gRPC-ProtoRPC.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-ProtoRPC' - version = '1.7.0' + version = '1.7.1' s.version = version s.summary = 'RPC library for Protocol Buffers, based on gRPC' s.homepage = 'https://grpc.io' diff --git a/gRPC-RxLibrary.podspec b/gRPC-RxLibrary.podspec index a90a8bc70a8..aa1ec3bad90 100644 --- a/gRPC-RxLibrary.podspec +++ b/gRPC-RxLibrary.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-RxLibrary' - version = '1.7.0' + version = '1.7.1' s.version = version s.summary = 'Reactive Extensions library for iOS/OSX.' s.homepage = 'https://grpc.io' diff --git a/gRPC.podspec b/gRPC.podspec index 16452cd7bf1..f2957a6a885 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -20,7 +20,7 @@ Pod::Spec.new do |s| s.name = 'gRPC' - version = '1.7.0' + version = '1.7.1' s.version = version s.summary = 'gRPC client library for iOS/OSX' s.homepage = 'https://grpc.io' diff --git a/package.json b/package.json index b5dd83f3d7e..b9c2840e0d6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "grpc", - "version": "1.7.0", + "version": "1.7.1", "author": "Google Inc.", "description": "gRPC Library for Node", "homepage": "https://grpc.io/", diff --git a/package.xml b/package.xml index 17503926381..4710deab245 100644 --- a/package.xml +++ b/package.xml @@ -13,8 +13,8 @@ 2017-08-24 - 1.7.0 - 1.7.0 + 1.7.1 + 1.7.1 beta diff --git a/src/cpp/common/version_cc.cc b/src/cpp/common/version_cc.cc index 01b033d04e0..27c386a20e0 100644 --- a/src/cpp/common/version_cc.cc +++ b/src/cpp/common/version_cc.cc @@ -22,5 +22,5 @@ #include namespace grpc { -grpc::string Version() { return "1.7.0"; } +grpc::string Version() { return "1.7.1"; } } diff --git a/src/csharp/Grpc.Core/Version.csproj.include b/src/csharp/Grpc.Core/Version.csproj.include index b34e64adca7..12d8b5fb0be 100755 --- a/src/csharp/Grpc.Core/Version.csproj.include +++ b/src/csharp/Grpc.Core/Version.csproj.include @@ -1,7 +1,7 @@ - 1.7.0 + 1.7.1 3.3.0 diff --git a/src/csharp/Grpc.Core/VersionInfo.cs b/src/csharp/Grpc.Core/VersionInfo.cs index c0de225ca7d..f7971b761e1 100644 --- a/src/csharp/Grpc.Core/VersionInfo.cs +++ b/src/csharp/Grpc.Core/VersionInfo.cs @@ -33,11 +33,11 @@ namespace Grpc.Core /// /// Current AssemblyFileVersion of gRPC C# assemblies /// - public const string CurrentAssemblyFileVersion = "1.7.0.0"; + public const string CurrentAssemblyFileVersion = "1.7.1.0"; /// /// Current version of gRPC C# /// - public const string CurrentVersion = "1.7.0"; + public const string CurrentVersion = "1.7.1"; } } diff --git a/src/csharp/build_packages_dotnetcli.bat b/src/csharp/build_packages_dotnetcli.bat index f25c0038e38..77a262fcb6d 100755 --- a/src/csharp/build_packages_dotnetcli.bat +++ b/src/csharp/build_packages_dotnetcli.bat @@ -13,7 +13,7 @@ @rem limitations under the License. @rem Current package versions -set VERSION=1.7.0 +set VERSION=1.7.1 @rem Adjust the location of nuget.exe set NUGET=C:\nuget\nuget.exe diff --git a/src/csharp/build_packages_dotnetcli.sh b/src/csharp/build_packages_dotnetcli.sh index a4ec409952b..6eac9da1fd7 100755 --- a/src/csharp/build_packages_dotnetcli.sh +++ b/src/csharp/build_packages_dotnetcli.sh @@ -39,7 +39,7 @@ dotnet pack --configuration Release Grpc.Auth --output ../../../artifacts dotnet pack --configuration Release Grpc.HealthCheck --output ../../../artifacts dotnet pack --configuration Release Grpc.Reflection --output ../../../artifacts -nuget pack Grpc.nuspec -Version "1.7.0" -OutputDirectory ../../artifacts -nuget pack Grpc.Tools.nuspec -Version "1.7.0" -OutputDirectory ../../artifacts +nuget pack Grpc.nuspec -Version "1.7.1" -OutputDirectory ../../artifacts +nuget pack Grpc.Tools.nuspec -Version "1.7.1" -OutputDirectory ../../artifacts (cd ../../artifacts && zip csharp_nugets_dotnetcli.zip *.nupkg) diff --git a/src/node/health_check/package.json b/src/node/health_check/package.json index e04f75eb5d5..59fe3bcee15 100644 --- a/src/node/health_check/package.json +++ b/src/node/health_check/package.json @@ -1,6 +1,6 @@ { "name": "grpc-health-check", - "version": "1.7.0", + "version": "1.7.1", "author": "Google Inc.", "description": "Health check service for use with gRPC", "repository": { @@ -15,7 +15,7 @@ } ], "dependencies": { - "grpc": "^1.7.0", + "grpc": "^1.7.1", "lodash": "^3.9.3", "google-protobuf": "^3.0.0" }, diff --git a/src/node/tools/package.json b/src/node/tools/package.json index c51553beb85..bc94731d8f8 100644 --- a/src/node/tools/package.json +++ b/src/node/tools/package.json @@ -1,6 +1,6 @@ { "name": "grpc-tools", - "version": "1.7.0", + "version": "1.7.1", "author": "Google Inc.", "description": "Tools for developing with gRPC on Node.js", "homepage": "https://grpc.io/", diff --git a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec index c1a4b9b0e68..c0bf8f66654 100644 --- a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec +++ b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec @@ -42,7 +42,7 @@ Pod::Spec.new do |s| # exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed # before them. s.name = '!ProtoCompiler-gRPCPlugin' - v = '1.7.0' + v = '1.7.1' s.version = v s.summary = 'The gRPC ProtoC plugin generates Objective-C files from .proto services.' s.description = <<-DESC diff --git a/src/objective-c/GRPCClient/private/version.h b/src/objective-c/GRPCClient/private/version.h index 978e9a50642..5c8d85629c2 100644 --- a/src/objective-c/GRPCClient/private/version.h +++ b/src/objective-c/GRPCClient/private/version.h @@ -23,4 +23,4 @@ // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.7.0" +#define GRPC_OBJC_VERSION_STRING @"1.7.1" diff --git a/src/php/composer.json b/src/php/composer.json index 3606a18f341..0236a9efa2b 100644 --- a/src/php/composer.json +++ b/src/php/composer.json @@ -2,7 +2,7 @@ "name": "grpc/grpc-dev", "description": "gRPC library for PHP - for Developement use only", "license": "Apache-2.0", - "version": "1.7.0", + "version": "1.7.1", "require": { "php": ">=5.5.0", "google/protobuf": "^v3.3.0" diff --git a/src/php/ext/grpc/version.h b/src/php/ext/grpc/version.h index ff246302c4b..14e7480d28b 100644 --- a/src/php/ext/grpc/version.h +++ b/src/php/ext/grpc/version.h @@ -20,6 +20,6 @@ #ifndef VERSION_H #define VERSION_H -#define PHP_GRPC_VERSION "1.7.0" +#define PHP_GRPC_VERSION "1.7.1" #endif /* VERSION_H */ diff --git a/src/python/grpcio/grpc/_grpcio_metadata.py b/src/python/grpcio/grpc/_grpcio_metadata.py index 7b3d2632dc4..e543b502507 100644 --- a/src/python/grpcio/grpc/_grpcio_metadata.py +++ b/src/python/grpcio/grpc/_grpcio_metadata.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc/_grpcio_metadata.py.template`!!! -__version__ = """1.7.0""" +__version__ = """1.7.1""" diff --git a/src/python/grpcio/grpc_version.py b/src/python/grpcio/grpc_version.py index eb8003ce57b..fa44e29e00a 100644 --- a/src/python/grpcio/grpc_version.py +++ b/src/python/grpcio/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_version.py.template`!!! -VERSION='1.7.0' +VERSION='1.7.1' diff --git a/src/python/grpcio_health_checking/grpc_version.py b/src/python/grpcio_health_checking/grpc_version.py index 56382d734fb..c1b030d3399 100644 --- a/src/python/grpcio_health_checking/grpc_version.py +++ b/src/python/grpcio_health_checking/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_health_checking/grpc_version.py.template`!!! -VERSION='1.7.0' +VERSION='1.7.1' diff --git a/src/python/grpcio_reflection/grpc_version.py b/src/python/grpcio_reflection/grpc_version.py index e2c1d4d60da..80ac855af4e 100644 --- a/src/python/grpcio_reflection/grpc_version.py +++ b/src/python/grpcio_reflection/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_reflection/grpc_version.py.template`!!! -VERSION='1.7.0' +VERSION='1.7.1' diff --git a/src/python/grpcio_testing/grpc_version.py b/src/python/grpcio_testing/grpc_version.py index 33d6869ef85..1622c6b75b9 100644 --- a/src/python/grpcio_testing/grpc_version.py +++ b/src/python/grpcio_testing/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_testing/grpc_version.py.template`!!! -VERSION='1.7.0' +VERSION='1.7.1' diff --git a/src/python/grpcio_tests/grpc_version.py b/src/python/grpcio_tests/grpc_version.py index 9334327fef9..de723be3e0d 100644 --- a/src/python/grpcio_tests/grpc_version.py +++ b/src/python/grpcio_tests/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_tests/grpc_version.py.template`!!! -VERSION='1.7.0' +VERSION='1.7.1' diff --git a/src/ruby/lib/grpc/version.rb b/src/ruby/lib/grpc/version.rb index 570915f8ed6..f8d626158bf 100644 --- a/src/ruby/lib/grpc/version.rb +++ b/src/ruby/lib/grpc/version.rb @@ -14,5 +14,5 @@ # GRPC contains the General RPC module. module GRPC - VERSION = '1.7.0' + VERSION = '1.7.1' end diff --git a/src/ruby/tools/version.rb b/src/ruby/tools/version.rb index e37662847f7..65c81bc31f2 100644 --- a/src/ruby/tools/version.rb +++ b/src/ruby/tools/version.rb @@ -14,6 +14,6 @@ module GRPC module Tools - VERSION = '1.7.0' + VERSION = '1.7.1' end end diff --git a/tools/distrib/python/grpcio_tools/grpc_version.py b/tools/distrib/python/grpcio_tools/grpc_version.py index bcc2502dd9f..c7c572272b5 100644 --- a/tools/distrib/python/grpcio_tools/grpc_version.py +++ b/tools/distrib/python/grpcio_tools/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/grpc_version.py.template`!!! -VERSION='1.7.0' +VERSION='1.7.1' diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index 021a664a449..a0d2cffc724 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.7.0 +PROJECT_NUMBER = 1.7.1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index bb07aa44a52..1874830d82c 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.7.0 +PROJECT_NUMBER = 1.7.1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a From e3ee18ada980020ff718332509e0d1d33a8a0885 Mon Sep 17 00:00:00 2001 From: Nicolas Noble Date: Tue, 10 Oct 2017 09:49:10 -0700 Subject: [PATCH 28/86] Fix Windows's memory leak (cherry picked from commit 3290e49a1d5b896b7ce65d658ffef00bf65d35dd) clang-format. (cherry picked from commit c02dbe57c666e26f40e517b6f940f6cbd4bb43fc) --- src/core/lib/support/env_windows.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/lib/support/env_windows.c b/src/core/lib/support/env_windows.c index 652eeb61c67..a6499543f81 100644 --- a/src/core/lib/support/env_windows.c +++ b/src/core/lib/support/env_windows.c @@ -43,7 +43,10 @@ char *gpr_getenv(const char *name) { DWORD ret; ret = GetEnvironmentVariable(tname, NULL, 0); - if (ret == 0) return NULL; + if (ret == 0) { + gpr_free(tname); + return NULL; + } size = ret * (DWORD)sizeof(TCHAR); tresult = gpr_malloc(size); ret = GetEnvironmentVariable(tname, tresult, size); From b32070eff814fa9b6bf2f331aabce0a7ae1af553 Mon Sep 17 00:00:00 2001 From: Alexander Polcyn Date: Tue, 31 Oct 2017 14:54:29 -0700 Subject: [PATCH 29/86] remove use of keyword args --- src/ruby/lib/grpc/generic/interceptors.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/ruby/lib/grpc/generic/interceptors.rb b/src/ruby/lib/grpc/generic/interceptors.rb index 73faec4b9c7..24482f34515 100644 --- a/src/ruby/lib/grpc/generic/interceptors.rb +++ b/src/ruby/lib/grpc/generic/interceptors.rb @@ -41,7 +41,7 @@ module GRPC # @param [Method] method # @param [Hash] metadata # - def request_response(request:, call:, method:, metadata:) + def request_response(request: nil, call: nil, method: nil, metadata: nil) GRPC.logger.debug "Intercepting request response method #{method}" \ " for request #{request} with call #{call} and metadata: #{metadata}" yield @@ -55,7 +55,7 @@ module GRPC # @param [Method] method # @param [Hash] metadata # - def client_streamer(requests:, call:, method:, metadata:) + def client_streamer(requests: nil, call: nil, method: nil, metadata: nil) GRPC.logger.debug "Intercepting client streamer method #{method}" \ " for requests #{requests} with call #{call} and metadata: #{metadata}" yield @@ -69,7 +69,7 @@ module GRPC # @param [Method] method # @param [Hash] metadata # - def server_streamer(request:, call:, method:, metadata:) + def server_streamer(request: nil, call: nil, method: nil, metadata: nil) GRPC.logger.debug "Intercepting server streamer method #{method}" \ " for request #{request} with call #{call} and metadata: #{metadata}" yield @@ -83,7 +83,7 @@ module GRPC # @param [Method] method # @param [Hash] metadata # - def bidi_streamer(requests:, call:, method:, metadata:) + def bidi_streamer(requests: nil, call: nil, method: nil, metadata: nil) GRPC.logger.debug "Intercepting bidi streamer method #{method}" \ " for requests #{requests} with call #{call} and metadata: #{metadata}" yield @@ -102,7 +102,7 @@ module GRPC # @param [GRPC::ActiveCall::SingleReqView] call # @param [Method] method # - def request_response(request:, call:, method:) + def request_response(request: nil, call: nil, method: nil) GRPC.logger.debug "Intercepting request response method #{method}" \ " for request #{request} with call #{call}" yield @@ -114,7 +114,7 @@ module GRPC # @param [GRPC::ActiveCall::MultiReqView] call # @param [Method] method # - def client_streamer(call:, method:) + def client_streamer(call: nil, method: nil) GRPC.logger.debug "Intercepting client streamer method #{method}" \ " with call #{call}" yield @@ -127,7 +127,7 @@ module GRPC # @param [GRPC::ActiveCall::SingleReqView] call # @param [Method] method # - def server_streamer(request:, call:, method:) + def server_streamer(request: nil, call: nil, method: nil) GRPC.logger.debug "Intercepting server streamer method #{method}" \ " for request #{request} with call #{call}" yield @@ -140,7 +140,7 @@ module GRPC # @param [GRPC::ActiveCall::MultiReqView] call # @param [Method] method # - def bidi_streamer(requests:, call:, method:) + def bidi_streamer(requests: nil, call: nil, method: nil) GRPC.logger.debug "Intercepting bidi streamer method #{method}" \ " for requests #{requests} with call #{call}" yield From 9f5163eb85ad14f0a4dfd24846c56d6a20acc838 Mon Sep 17 00:00:00 2001 From: Alexander Polcyn Date: Wed, 1 Nov 2017 11:07:28 -0700 Subject: [PATCH 30/86] Bump v1.7.x branch to 1.7.2 --- BUILD | 2 +- CMakeLists.txt | 2 +- Makefile | 4 ++-- build.yaml | 2 +- gRPC-Core.podspec | 2 +- gRPC-ProtoRPC.podspec | 2 +- gRPC-RxLibrary.podspec | 2 +- gRPC.podspec | 2 +- package.json | 2 +- package.xml | 4 ++-- src/cpp/common/version_cc.cc | 2 +- src/csharp/Grpc.Core/Version.csproj.include | 2 +- src/csharp/Grpc.Core/VersionInfo.cs | 4 ++-- src/csharp/build_packages_dotnetcli.bat | 2 +- src/csharp/build_packages_dotnetcli.sh | 4 ++-- src/node/health_check/package.json | 4 ++-- src/node/tools/package.json | 2 +- src/objective-c/!ProtoCompiler-gRPCPlugin.podspec | 2 +- src/objective-c/GRPCClient/private/version.h | 2 +- src/php/composer.json | 2 +- src/php/ext/grpc/version.h | 2 +- src/python/grpcio/grpc/_grpcio_metadata.py | 2 +- src/python/grpcio/grpc_version.py | 2 +- src/python/grpcio_health_checking/grpc_version.py | 2 +- src/python/grpcio_reflection/grpc_version.py | 2 +- src/python/grpcio_testing/grpc_version.py | 2 +- src/python/grpcio_tests/grpc_version.py | 2 +- src/ruby/lib/grpc/version.rb | 2 +- src/ruby/tools/version.rb | 2 +- tools/distrib/python/grpcio_tools/grpc_version.py | 2 +- tools/doxygen/Doxyfile.c++ | 2 +- tools/doxygen/Doxyfile.c++.internal | 2 +- 32 files changed, 37 insertions(+), 37 deletions(-) diff --git a/BUILD b/BUILD index e61fed86efc..d0c4715969e 100644 --- a/BUILD +++ b/BUILD @@ -38,7 +38,7 @@ g_stands_for = "gambit" core_version = "5.0.0" -version = "1.7.1" +version = "1.7.2" GPR_PUBLIC_HDRS = [ "include/grpc/support/alloc.h", diff --git a/CMakeLists.txt b/CMakeLists.txt index a5f472f4b5f..ccfbccbfa00 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ cmake_minimum_required(VERSION 2.8) set(PACKAGE_NAME "grpc") -set(PACKAGE_VERSION "1.7.1") +set(PACKAGE_VERSION "1.7.2") set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/") diff --git a/Makefile b/Makefile index eeb830e34b0..12d6d6e338d 100644 --- a/Makefile +++ b/Makefile @@ -411,8 +411,8 @@ Q = @ endif CORE_VERSION = 5.0.0 -CPP_VERSION = 1.7.1 -CSHARP_VERSION = 1.7.1 +CPP_VERSION = 1.7.2 +CSHARP_VERSION = 1.7.2 CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES)) CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) diff --git a/build.yaml b/build.yaml index 159bc2d0e33..ac5a6b27818 100644 --- a/build.yaml +++ b/build.yaml @@ -14,7 +14,7 @@ settings: '#10': See the expand_version.py for all the quirks here core_version: 5.0.0 g_stands_for: gambit - version: 1.7.1 + version: 1.7.2 filegroups: - name: census public_headers: diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 33d399d9419..889fa45c7c3 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -22,7 +22,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-Core' - version = '1.7.1' + version = '1.7.2' s.version = version s.summary = 'Core cross-platform gRPC library, written in C' s.homepage = 'https://grpc.io' diff --git a/gRPC-ProtoRPC.podspec b/gRPC-ProtoRPC.podspec index 6ae01ed73b4..8b67fba999e 100644 --- a/gRPC-ProtoRPC.podspec +++ b/gRPC-ProtoRPC.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-ProtoRPC' - version = '1.7.1' + version = '1.7.2' s.version = version s.summary = 'RPC library for Protocol Buffers, based on gRPC' s.homepage = 'https://grpc.io' diff --git a/gRPC-RxLibrary.podspec b/gRPC-RxLibrary.podspec index aa1ec3bad90..41310a51342 100644 --- a/gRPC-RxLibrary.podspec +++ b/gRPC-RxLibrary.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-RxLibrary' - version = '1.7.1' + version = '1.7.2' s.version = version s.summary = 'Reactive Extensions library for iOS/OSX.' s.homepage = 'https://grpc.io' diff --git a/gRPC.podspec b/gRPC.podspec index f2957a6a885..bd404283d83 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -20,7 +20,7 @@ Pod::Spec.new do |s| s.name = 'gRPC' - version = '1.7.1' + version = '1.7.2' s.version = version s.summary = 'gRPC client library for iOS/OSX' s.homepage = 'https://grpc.io' diff --git a/package.json b/package.json index b9c2840e0d6..2b7930ce70c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "grpc", - "version": "1.7.1", + "version": "1.7.2", "author": "Google Inc.", "description": "gRPC Library for Node", "homepage": "https://grpc.io/", diff --git a/package.xml b/package.xml index 4710deab245..cd830df75a9 100644 --- a/package.xml +++ b/package.xml @@ -13,8 +13,8 @@ 2017-08-24 - 1.7.1 - 1.7.1 + 1.7.2 + 1.7.2 beta diff --git a/src/cpp/common/version_cc.cc b/src/cpp/common/version_cc.cc index 27c386a20e0..bba873c7829 100644 --- a/src/cpp/common/version_cc.cc +++ b/src/cpp/common/version_cc.cc @@ -22,5 +22,5 @@ #include namespace grpc { -grpc::string Version() { return "1.7.1"; } +grpc::string Version() { return "1.7.2"; } } diff --git a/src/csharp/Grpc.Core/Version.csproj.include b/src/csharp/Grpc.Core/Version.csproj.include index 12d8b5fb0be..7cae4a55d40 100755 --- a/src/csharp/Grpc.Core/Version.csproj.include +++ b/src/csharp/Grpc.Core/Version.csproj.include @@ -1,7 +1,7 @@ - 1.7.1 + 1.7.2 3.3.0 diff --git a/src/csharp/Grpc.Core/VersionInfo.cs b/src/csharp/Grpc.Core/VersionInfo.cs index f7971b761e1..e4c97ffda76 100644 --- a/src/csharp/Grpc.Core/VersionInfo.cs +++ b/src/csharp/Grpc.Core/VersionInfo.cs @@ -33,11 +33,11 @@ namespace Grpc.Core /// /// Current AssemblyFileVersion of gRPC C# assemblies /// - public const string CurrentAssemblyFileVersion = "1.7.1.0"; + public const string CurrentAssemblyFileVersion = "1.7.2.0"; /// /// Current version of gRPC C# /// - public const string CurrentVersion = "1.7.1"; + public const string CurrentVersion = "1.7.2"; } } diff --git a/src/csharp/build_packages_dotnetcli.bat b/src/csharp/build_packages_dotnetcli.bat index 77a262fcb6d..3be049ae1d0 100755 --- a/src/csharp/build_packages_dotnetcli.bat +++ b/src/csharp/build_packages_dotnetcli.bat @@ -13,7 +13,7 @@ @rem limitations under the License. @rem Current package versions -set VERSION=1.7.1 +set VERSION=1.7.2 @rem Adjust the location of nuget.exe set NUGET=C:\nuget\nuget.exe diff --git a/src/csharp/build_packages_dotnetcli.sh b/src/csharp/build_packages_dotnetcli.sh index 6eac9da1fd7..cf565b2e8d0 100755 --- a/src/csharp/build_packages_dotnetcli.sh +++ b/src/csharp/build_packages_dotnetcli.sh @@ -39,7 +39,7 @@ dotnet pack --configuration Release Grpc.Auth --output ../../../artifacts dotnet pack --configuration Release Grpc.HealthCheck --output ../../../artifacts dotnet pack --configuration Release Grpc.Reflection --output ../../../artifacts -nuget pack Grpc.nuspec -Version "1.7.1" -OutputDirectory ../../artifacts -nuget pack Grpc.Tools.nuspec -Version "1.7.1" -OutputDirectory ../../artifacts +nuget pack Grpc.nuspec -Version "1.7.2" -OutputDirectory ../../artifacts +nuget pack Grpc.Tools.nuspec -Version "1.7.2" -OutputDirectory ../../artifacts (cd ../../artifacts && zip csharp_nugets_dotnetcli.zip *.nupkg) diff --git a/src/node/health_check/package.json b/src/node/health_check/package.json index 59fe3bcee15..fca3a2a7a6b 100644 --- a/src/node/health_check/package.json +++ b/src/node/health_check/package.json @@ -1,6 +1,6 @@ { "name": "grpc-health-check", - "version": "1.7.1", + "version": "1.7.2", "author": "Google Inc.", "description": "Health check service for use with gRPC", "repository": { @@ -15,7 +15,7 @@ } ], "dependencies": { - "grpc": "^1.7.1", + "grpc": "^1.7.2", "lodash": "^3.9.3", "google-protobuf": "^3.0.0" }, diff --git a/src/node/tools/package.json b/src/node/tools/package.json index bc94731d8f8..99fd8540672 100644 --- a/src/node/tools/package.json +++ b/src/node/tools/package.json @@ -1,6 +1,6 @@ { "name": "grpc-tools", - "version": "1.7.1", + "version": "1.7.2", "author": "Google Inc.", "description": "Tools for developing with gRPC on Node.js", "homepage": "https://grpc.io/", diff --git a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec index c0bf8f66654..616fa019578 100644 --- a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec +++ b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec @@ -42,7 +42,7 @@ Pod::Spec.new do |s| # exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed # before them. s.name = '!ProtoCompiler-gRPCPlugin' - v = '1.7.1' + v = '1.7.2' s.version = v s.summary = 'The gRPC ProtoC plugin generates Objective-C files from .proto services.' s.description = <<-DESC diff --git a/src/objective-c/GRPCClient/private/version.h b/src/objective-c/GRPCClient/private/version.h index 5c8d85629c2..ace39f7e775 100644 --- a/src/objective-c/GRPCClient/private/version.h +++ b/src/objective-c/GRPCClient/private/version.h @@ -23,4 +23,4 @@ // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.7.1" +#define GRPC_OBJC_VERSION_STRING @"1.7.2" diff --git a/src/php/composer.json b/src/php/composer.json index 0236a9efa2b..ad448332f10 100644 --- a/src/php/composer.json +++ b/src/php/composer.json @@ -2,7 +2,7 @@ "name": "grpc/grpc-dev", "description": "gRPC library for PHP - for Developement use only", "license": "Apache-2.0", - "version": "1.7.1", + "version": "1.7.2", "require": { "php": ">=5.5.0", "google/protobuf": "^v3.3.0" diff --git a/src/php/ext/grpc/version.h b/src/php/ext/grpc/version.h index 14e7480d28b..1083c2c4f57 100644 --- a/src/php/ext/grpc/version.h +++ b/src/php/ext/grpc/version.h @@ -20,6 +20,6 @@ #ifndef VERSION_H #define VERSION_H -#define PHP_GRPC_VERSION "1.7.1" +#define PHP_GRPC_VERSION "1.7.2" #endif /* VERSION_H */ diff --git a/src/python/grpcio/grpc/_grpcio_metadata.py b/src/python/grpcio/grpc/_grpcio_metadata.py index e543b502507..500a253e540 100644 --- a/src/python/grpcio/grpc/_grpcio_metadata.py +++ b/src/python/grpcio/grpc/_grpcio_metadata.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc/_grpcio_metadata.py.template`!!! -__version__ = """1.7.1""" +__version__ = """1.7.2""" diff --git a/src/python/grpcio/grpc_version.py b/src/python/grpcio/grpc_version.py index fa44e29e00a..a5d4b2082b0 100644 --- a/src/python/grpcio/grpc_version.py +++ b/src/python/grpcio/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_version.py.template`!!! -VERSION='1.7.1' +VERSION='1.7.2' diff --git a/src/python/grpcio_health_checking/grpc_version.py b/src/python/grpcio_health_checking/grpc_version.py index c1b030d3399..dc1bc965032 100644 --- a/src/python/grpcio_health_checking/grpc_version.py +++ b/src/python/grpcio_health_checking/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_health_checking/grpc_version.py.template`!!! -VERSION='1.7.1' +VERSION='1.7.2' diff --git a/src/python/grpcio_reflection/grpc_version.py b/src/python/grpcio_reflection/grpc_version.py index 80ac855af4e..3744cb67dcf 100644 --- a/src/python/grpcio_reflection/grpc_version.py +++ b/src/python/grpcio_reflection/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_reflection/grpc_version.py.template`!!! -VERSION='1.7.1' +VERSION='1.7.2' diff --git a/src/python/grpcio_testing/grpc_version.py b/src/python/grpcio_testing/grpc_version.py index 1622c6b75b9..fbf9f22ed46 100644 --- a/src/python/grpcio_testing/grpc_version.py +++ b/src/python/grpcio_testing/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_testing/grpc_version.py.template`!!! -VERSION='1.7.1' +VERSION='1.7.2' diff --git a/src/python/grpcio_tests/grpc_version.py b/src/python/grpcio_tests/grpc_version.py index de723be3e0d..abd6b50072b 100644 --- a/src/python/grpcio_tests/grpc_version.py +++ b/src/python/grpcio_tests/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_tests/grpc_version.py.template`!!! -VERSION='1.7.1' +VERSION='1.7.2' diff --git a/src/ruby/lib/grpc/version.rb b/src/ruby/lib/grpc/version.rb index f8d626158bf..9b9007c01fe 100644 --- a/src/ruby/lib/grpc/version.rb +++ b/src/ruby/lib/grpc/version.rb @@ -14,5 +14,5 @@ # GRPC contains the General RPC module. module GRPC - VERSION = '1.7.1' + VERSION = '1.7.2' end diff --git a/src/ruby/tools/version.rb b/src/ruby/tools/version.rb index 65c81bc31f2..22fbc5b6deb 100644 --- a/src/ruby/tools/version.rb +++ b/src/ruby/tools/version.rb @@ -14,6 +14,6 @@ module GRPC module Tools - VERSION = '1.7.1' + VERSION = '1.7.2' end end diff --git a/tools/distrib/python/grpcio_tools/grpc_version.py b/tools/distrib/python/grpcio_tools/grpc_version.py index c7c572272b5..bc1e96a686f 100644 --- a/tools/distrib/python/grpcio_tools/grpc_version.py +++ b/tools/distrib/python/grpcio_tools/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/grpc_version.py.template`!!! -VERSION='1.7.1' +VERSION='1.7.2' diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index a0d2cffc724..064ccb06923 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.7.1 +PROJECT_NUMBER = 1.7.2 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 1874830d82c..105aba5267c 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.7.1 +PROJECT_NUMBER = 1.7.2 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a From adbfbd5977104987bee9f946f691683b756305e8 Mon Sep 17 00:00:00 2001 From: ncteisen Date: Thu, 16 Nov 2017 15:35:45 -0800 Subject: [PATCH 31/86] Remove all extern C --- .../impl/codegen/core_codegen_interface.h | 4 -- include/grpc/census.h | 8 +-- include/grpc/compression.h | 8 +-- include/grpc/grpc.h | 8 +-- include/grpc/grpc_cronet.h | 8 +-- include/grpc/grpc_posix.h | 8 +-- include/grpc/grpc_security.h | 8 +-- include/grpc/grpc_security_constants.h | 8 +-- include/grpc/impl/codegen/atm.h | 8 +-- include/grpc/impl/codegen/atm_gcc_atomic.h | 8 +-- include/grpc/impl/codegen/byte_buffer.h | 8 +-- .../grpc/impl/codegen/byte_buffer_reader.h | 8 +-- include/grpc/impl/codegen/compression_types.h | 8 +-- .../grpc/impl/codegen/connectivity_state.h | 8 +-- include/grpc/impl/codegen/gpr_types.h | 8 +-- include/grpc/impl/codegen/grpc_types.h | 8 +-- include/grpc/impl/codegen/propagation_bits.h | 8 +-- include/grpc/impl/codegen/status.h | 8 +-- include/grpc/impl/codegen/sync.h | 8 +-- include/grpc/load_reporting.h | 8 +-- include/grpc/slice.h | 8 +-- include/grpc/slice_buffer.h | 8 +-- include/grpc/support/alloc.h | 8 +-- include/grpc/support/avl.h | 8 +-- include/grpc/support/cmdline.h | 8 +-- include/grpc/support/cpu.h | 8 +-- include/grpc/support/histogram.h | 8 +-- include/grpc/support/host_port.h | 8 +-- include/grpc/support/log.h | 8 +-- include/grpc/support/log_windows.h | 8 +-- include/grpc/support/string_util.h | 8 +-- include/grpc/support/subprocess.h | 8 +-- include/grpc/support/sync.h | 8 +-- include/grpc/support/thd.h | 8 +-- include/grpc/support/time.h | 8 +-- include/grpc/support/tls_pthread.h | 8 +-- .../filters/client_channel/client_channel.h | 8 +-- .../client_channel/client_channel_factory.h | 8 +-- .../client_channel/client_channel_plugin.cc | 4 +- .../ext/filters/client_channel/connector.h | 8 +-- .../client_channel/http_connect_handshaker.h | 8 +-- .../ext/filters/client_channel/http_proxy.h | 8 +-- .../ext/filters/client_channel/lb_policy.h | 8 +-- .../grpclb/client_load_reporting_filter.h | 8 +-- .../client_channel/lb_policy/grpclb/grpclb.cc | 4 +- .../client_channel/lb_policy/grpclb/grpclb.h | 8 +-- .../lb_policy/grpclb/grpclb_channel.h | 8 +-- .../lb_policy/grpclb/grpclb_client_stats.h | 8 +-- .../lb_policy/grpclb/load_balancer_api.h | 8 +-- .../lb_policy/pick_first/pick_first.cc | 4 +- .../lb_policy/round_robin/round_robin.cc | 4 +- .../lb_policy/subchannel_list.h | 8 +-- .../client_channel/lb_policy_factory.h | 8 +-- .../client_channel/lb_policy_registry.h | 8 +-- .../filters/client_channel/parse_address.h | 8 +-- .../ext/filters/client_channel/proxy_mapper.h | 8 +-- .../client_channel/proxy_mapper_registry.h | 8 +-- .../ext/filters/client_channel/resolver.h | 8 +-- .../resolver/dns/c_ares/dns_resolver_ares.cc | 8 +-- .../resolver/dns/c_ares/grpc_ares_ev_driver.h | 8 +-- .../resolver/dns/c_ares/grpc_ares_wrapper.h | 8 +-- .../resolver/dns/native/dns_resolver.cc | 4 +- .../resolver/fake/fake_resolver.cc | 4 +- .../resolver/fake/fake_resolver.h | 8 +-- .../resolver/sockaddr/sockaddr_resolver.cc | 4 +- .../filters/client_channel/resolver_factory.h | 8 +-- .../client_channel/resolver_registry.h | 8 +-- .../filters/client_channel/retry_throttle.h | 8 +-- .../ext/filters/client_channel/subchannel.h | 8 +-- .../filters/client_channel/subchannel_index.h | 8 +-- .../ext/filters/client_channel/uri_parser.h | 8 +-- .../ext/filters/deadline/deadline_filter.cc | 4 +- .../ext/filters/deadline/deadline_filter.h | 8 +-- .../filters/http/client/http_client_filter.h | 8 +-- .../ext/filters/http/http_filters_plugin.cc | 4 +- .../message_compress_filter.h | 8 +-- .../filters/http/server/http_server_filter.h | 8 +-- .../server_load_reporting_filter.h | 8 +-- .../server_load_reporting_plugin.cc | 4 +- .../server_load_reporting_plugin.h | 8 +-- .../ext/filters/max_age/max_age_filter.cc | 4 +- src/core/ext/filters/max_age/max_age_filter.h | 8 +-- .../message_size/message_size_filter.cc | 4 +- .../message_size/message_size_filter.h | 8 +-- .../workaround_cronet_compression_filter.cc | 4 +- .../workaround_cronet_compression_filter.h | 8 +-- .../filters/workarounds/workaround_utils.h | 8 +-- src/core/ext/transport/chttp2/alpn/alpn.h | 8 +-- .../chttp2/client/chttp2_connector.h | 8 +-- .../transport/chttp2/server/chttp2_server.h | 8 +-- .../transport/chttp2/transport/bin_decoder.h | 8 +-- .../transport/chttp2/transport/bin_encoder.h | 8 +-- .../chttp2/transport/chttp2_plugin.cc | 4 +- .../chttp2/transport/chttp2_transport.h | 8 +-- .../transport/chttp2/transport/flow_control.h | 2 +- .../ext/transport/chttp2/transport/frame.h | 8 +-- .../transport/chttp2/transport/frame_data.h | 8 +-- .../transport/chttp2/transport/frame_goaway.h | 8 +-- .../transport/chttp2/transport/frame_ping.h | 8 +-- .../chttp2/transport/frame_rst_stream.h | 8 +-- .../chttp2/transport/frame_settings.h | 8 +-- .../chttp2/transport/frame_window_update.h | 8 +-- .../chttp2/transport/hpack_encoder.h | 8 +-- .../transport/chttp2/transport/hpack_parser.h | 8 +-- .../transport/chttp2/transport/hpack_table.h | 8 +-- .../chttp2/transport/http2_settings.h | 8 +-- .../ext/transport/chttp2/transport/huffsyms.h | 8 +-- .../chttp2/transport/incoming_metadata.h | 8 +-- .../ext/transport/chttp2/transport/internal.h | 8 +-- .../transport/chttp2/transport/stream_map.h | 8 +-- .../ext/transport/chttp2/transport/varint.h | 8 +-- .../cronet/transport/cronet_transport.h | 8 +-- .../ext/transport/inproc/inproc_plugin.cc | 4 +- .../ext/transport/inproc/inproc_transport.h | 8 +-- src/core/lib/backoff/backoff.h | 8 +-- src/core/lib/channel/channel_args.h | 8 +-- src/core/lib/channel/channel_stack.h | 8 +-- src/core/lib/channel/channel_stack_builder.h | 8 +-- src/core/lib/channel/connected_channel.h | 8 +-- src/core/lib/channel/handshaker.h | 8 +-- src/core/lib/channel/handshaker_factory.h | 8 +-- src/core/lib/channel/handshaker_registry.h | 8 +-- src/core/lib/compression/algorithm_metadata.h | 8 +-- src/core/lib/compression/message_compress.h | 8 +-- src/core/lib/compression/stream_compression.h | 8 +-- .../lib/compression/stream_compression_gzip.h | 8 +-- .../compression/stream_compression_identity.h | 8 +-- src/core/lib/debug/stats.h | 8 +-- src/core/lib/debug/stats_data.h | 8 +-- src/core/lib/debug/trace.h | 8 +-- src/core/lib/http/format_request.h | 8 +-- src/core/lib/http/httpcli.h | 8 +-- src/core/lib/http/parser.h | 8 +-- src/core/lib/iomgr/block_annotate.h | 8 +-- src/core/lib/iomgr/call_combiner.h | 8 +-- src/core/lib/iomgr/combiner.h | 8 +-- src/core/lib/iomgr/endpoint.h | 8 +-- src/core/lib/iomgr/endpoint_pair.h | 8 +-- src/core/lib/iomgr/error.h | 8 +-- src/core/lib/iomgr/error_internal.h | 8 +-- src/core/lib/iomgr/ev_epoll1_linux.h | 8 +-- src/core/lib/iomgr/ev_epollex_linux.h | 8 +-- src/core/lib/iomgr/ev_epollsig_linux.h | 8 +-- src/core/lib/iomgr/ev_poll_posix.h | 8 +-- src/core/lib/iomgr/ev_posix.cc | 3 - src/core/lib/iomgr/ev_posix.h | 8 +-- src/core/lib/iomgr/exec_ctx.h | 8 +-- src/core/lib/iomgr/executor.h | 8 +-- src/core/lib/iomgr/gethostname.h | 8 +-- src/core/lib/iomgr/iocp_windows.h | 8 +-- src/core/lib/iomgr/iomgr.h | 8 +-- src/core/lib/iomgr/iomgr_internal.h | 8 +-- src/core/lib/iomgr/iomgr_uv.h | 8 +-- .../lib/iomgr/is_epollexclusive_available.h | 8 +-- src/core/lib/iomgr/load_file.h | 8 +-- src/core/lib/iomgr/polling_entity.h | 8 +-- src/core/lib/iomgr/pollset.h | 8 +-- src/core/lib/iomgr/pollset_set.h | 8 +-- src/core/lib/iomgr/pollset_uv.h | 8 +-- src/core/lib/iomgr/pollset_windows.h | 8 +-- src/core/lib/iomgr/resolve_address.h | 8 +-- src/core/lib/iomgr/resource_quota.h | 8 +-- src/core/lib/iomgr/sockaddr_utils.h | 8 +-- src/core/lib/iomgr/socket_factory_posix.h | 8 +-- src/core/lib/iomgr/socket_mutator.h | 8 +-- src/core/lib/iomgr/socket_utils.h | 8 +-- src/core/lib/iomgr/socket_utils_posix.h | 8 +-- src/core/lib/iomgr/socket_windows.h | 8 +-- src/core/lib/iomgr/tcp_client.h | 8 +-- src/core/lib/iomgr/tcp_client_posix.cc | 2 - src/core/lib/iomgr/tcp_client_posix.h | 8 +-- src/core/lib/iomgr/tcp_client_windows.cc | 2 - src/core/lib/iomgr/tcp_posix.h | 8 +-- src/core/lib/iomgr/tcp_server.h | 8 +-- src/core/lib/iomgr/tcp_server_utils_posix.h | 8 +-- src/core/lib/iomgr/tcp_uv.h | 8 +-- src/core/lib/iomgr/tcp_windows.h | 8 +-- src/core/lib/iomgr/time_averaged_stats.h | 8 +-- src/core/lib/iomgr/timer.h | 8 +-- src/core/lib/iomgr/timer_generic.cc | 2 - src/core/lib/iomgr/timer_heap.h | 8 +-- src/core/lib/iomgr/timer_manager.h | 8 +-- src/core/lib/iomgr/timer_uv.cc | 2 - src/core/lib/iomgr/udp_server.h | 8 +-- src/core/lib/iomgr/unix_sockets_posix.h | 8 +-- src/core/lib/iomgr/wakeup_fd_cv.h | 8 +-- src/core/lib/iomgr/wakeup_fd_pipe.h | 8 +-- src/core/lib/iomgr/wakeup_fd_posix.h | 8 +-- src/core/lib/json/json.h | 8 +-- src/core/lib/json/json_reader.h | 8 +-- src/core/lib/json/json_writer.h | 8 +-- src/core/lib/profiling/timers.h | 8 +-- .../lib/security/context/security_context.h | 8 +-- .../composite/composite_credentials.h | 8 +-- .../lib/security/credentials/credentials.h | 8 +-- .../credentials/fake/fake_credentials.h | 8 +-- .../google_default_credentials.h | 8 +-- .../lib/security/credentials/jwt/json_token.h | 8 +-- .../credentials/jwt/jwt_credentials.h | 8 +-- .../security/credentials/jwt/jwt_verifier.h | 8 +-- .../credentials/oauth2/oauth2_credentials.h | 8 +-- .../credentials/ssl/ssl_credentials.h | 8 +-- .../lib/security/transport/auth_filters.h | 8 +-- .../lib/security/transport/lb_targets_info.h | 8 +-- .../lib/security/transport/secure_endpoint.h | 8 +-- .../security/transport/security_connector.h | 8 +-- .../security/transport/security_handshaker.h | 8 +-- src/core/lib/security/transport/tsi_error.h | 8 +-- src/core/lib/security/util/json_util.h | 8 +-- src/core/lib/slice/b64.h | 8 +-- src/core/lib/slice/percent_encoding.h | 8 +-- src/core/lib/slice/slice_hash_table.h | 8 +-- src/core/lib/slice/slice_internal.h | 8 +-- src/core/lib/slice/slice_string_helpers.h | 8 +-- src/core/lib/slice/slice_traits.h | 8 +-- src/core/lib/support/arena.h | 8 +-- src/core/lib/support/env.h | 8 +-- src/core/lib/support/log.cc | 2 +- src/core/lib/support/log_android.cc | 4 +- src/core/lib/support/log_linux.cc | 2 +- src/core/lib/support/log_posix.cc | 2 +- src/core/lib/support/log_windows.cc | 2 +- src/core/lib/support/mpscq.h | 8 +-- src/core/lib/support/murmur_hash.h | 8 +-- src/core/lib/support/stack_lockfree.h | 8 +-- src/core/lib/support/string.h | 8 +-- src/core/lib/support/string_windows.h | 8 +-- src/core/lib/support/time_posix.cc | 2 - src/core/lib/support/time_precise.h | 8 +-- src/core/lib/support/time_windows.cc | 2 - src/core/lib/support/tmpfile.h | 8 +-- src/core/lib/surface/alarm_internal.h | 8 +-- src/core/lib/surface/api_trace.h | 8 +-- src/core/lib/surface/call.h | 8 +-- src/core/lib/surface/call_test_only.h | 8 +-- src/core/lib/surface/channel.h | 8 +-- src/core/lib/surface/channel_init.h | 8 +-- src/core/lib/surface/channel_stack_type.h | 8 +-- src/core/lib/surface/completion_queue.h | 8 +-- .../lib/surface/completion_queue_factory.h | 8 +-- src/core/lib/surface/event_string.h | 8 +-- src/core/lib/surface/init.h | 8 +-- src/core/lib/surface/lame_client.cc | 4 +- src/core/lib/surface/lame_client.h | 8 +-- src/core/lib/surface/server.h | 8 +-- src/core/lib/surface/validate_metadata.h | 8 +-- src/core/lib/transport/byte_stream.h | 8 +-- src/core/lib/transport/connectivity_state.h | 8 +-- src/core/lib/transport/error_utils.h | 8 +-- src/core/lib/transport/metadata.h | 8 +-- src/core/lib/transport/metadata_batch.h | 8 +-- src/core/lib/transport/service_config.h | 8 +-- src/core/lib/transport/static_metadata.h | 8 +-- src/core/lib/transport/status_conversion.h | 8 +-- src/core/lib/transport/timeout_encoding.h | 8 +-- src/core/lib/transport/transport.h | 8 +-- src/core/lib/transport/transport_impl.h | 8 +-- .../grpc_cronet_plugin_registry.cc | 24 +++---- .../plugin_registry/grpc_plugin_registry.cc | 68 +++++++++---------- .../grpc_unsecure_plugin_registry.cc | 64 ++++++++--------- src/core/tsi/fake_transport_security.h | 8 +-- src/core/tsi/gts_transport_security.cc | 4 +- src/core/tsi/gts_transport_security.h | 8 +-- src/core/tsi/ssl_transport_security.h | 8 +-- src/core/tsi/ssl_types.h | 8 +-- src/core/tsi/transport_security.h | 8 +-- src/core/tsi/transport_security_adapter.h | 8 +-- src/core/tsi/transport_security_grpc.h | 8 +-- src/core/tsi/transport_security_interface.h | 8 +-- src/cpp/common/channel_arguments.cc | 3 +- src/cpp/common/channel_filter.cc | 2 - src/cpp/common/channel_filter.h | 2 - src/cpp/common/core_codegen.cc | 2 - templates/src/core/plugin_registry.template | 4 +- test/core/end2end/cq_verifier.h | 8 +-- test/core/end2end/data/ssl_test_data.h | 8 +-- test/core/end2end/end2end_tests.h | 8 +-- test/core/end2end/fuzzers/api_fuzzer.cc | 2 +- test/core/end2end/tests/no_logging.cc | 2 +- test/core/util/port.h | 8 +-- test/core/util/test_config.h | 8 +-- test/cpp/client/client_channel_stress_test.cc | 2 - test/cpp/interop/stress_test.cc | 2 - 283 files changed, 602 insertions(+), 1596 deletions(-) diff --git a/include/grpc++/impl/codegen/core_codegen_interface.h b/include/grpc++/impl/codegen/core_codegen_interface.h index 1949cdab761..d7ad7a4b573 100644 --- a/include/grpc++/impl/codegen/core_codegen_interface.h +++ b/include/grpc++/impl/codegen/core_codegen_interface.h @@ -25,10 +25,6 @@ #include #include -extern "C" { -struct grpc_byte_buffer; -} - namespace grpc { /// Interface between the codegen library and the minimal subset of core diff --git a/include/grpc/census.h b/include/grpc/census.h index 2258af88989..d7f2fab50b5 100644 --- a/include/grpc/census.h +++ b/include/grpc/census.h @@ -21,9 +21,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + /** A Census Context is a handle used by Census to represent the current tracing @@ -31,8 +29,6 @@ extern "C" { (this is the responsibility of the local RPC system). */ typedef struct census_context census_context; -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CENSUS_H */ diff --git a/include/grpc/compression.h b/include/grpc/compression.h index b42f428d7de..c0db8c2bfa6 100644 --- a/include/grpc/compression.h +++ b/include/grpc/compression.h @@ -26,9 +26,7 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif + /** Parses the \a slice as a grpc_compression_algorithm instance and updating \a * algorithm. Returns 1 upon success, 0 otherwise. */ @@ -85,8 +83,6 @@ GRPCAPI int grpc_compression_options_is_stream_compression_algorithm_enabled( const grpc_compression_options* opts, grpc_stream_compression_algorithm algorithm); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_COMPRESSION_H */ diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index f083bc591e6..6d6d56a7b36 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -29,9 +29,7 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif + /*! \mainpage GRPC Core * @@ -466,8 +464,6 @@ GRPCAPI void grpc_resource_quota_resize(grpc_resource_quota* resource_quota, */ GRPCAPI const grpc_arg_pointer_vtable* grpc_resource_quota_arg_vtable(void); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_GRPC_H */ diff --git a/include/grpc/grpc_cronet.h b/include/grpc/grpc_cronet.h index 127d5d038d0..b3e7ec2705d 100644 --- a/include/grpc/grpc_cronet.h +++ b/include/grpc/grpc_cronet.h @@ -21,16 +21,12 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + GRPCAPI grpc_channel* grpc_cronet_secure_channel_create( void* engine, const char* target, const grpc_channel_args* args, void* reserved); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_GRPC_CRONET_H */ diff --git a/include/grpc/grpc_posix.h b/include/grpc/grpc_posix.h index fa7ebced3f3..f14cbaa81bb 100644 --- a/include/grpc/grpc_posix.h +++ b/include/grpc/grpc_posix.h @@ -24,9 +24,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + /*! \mainpage GRPC Core POSIX * @@ -59,8 +57,6 @@ GRPCAPI void grpc_server_add_insecure_channel_from_fd(grpc_server* server, - This API is optional but if called, it MUST be called before grpc_init() */ GRPCAPI void grpc_use_signal(int signum); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_GRPC_POSIX_H */ diff --git a/include/grpc/grpc_security.h b/include/grpc/grpc_security.h index 7e87217de78..f2a05074c2d 100644 --- a/include/grpc/grpc_security.h +++ b/include/grpc/grpc_security.h @@ -23,9 +23,7 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif + /** --- Authentication Context. --- */ @@ -461,8 +459,6 @@ typedef struct { GRPCAPI void grpc_server_credentials_set_auth_metadata_processor( grpc_server_credentials* creds, grpc_auth_metadata_processor processor); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_GRPC_SECURITY_H */ diff --git a/include/grpc/grpc_security_constants.h b/include/grpc/grpc_security_constants.h index 60e167eb885..1923525ea05 100644 --- a/include/grpc/grpc_security_constants.h +++ b/include/grpc/grpc_security_constants.h @@ -19,9 +19,7 @@ #ifndef GRPC_GRPC_SECURITY_CONSTANTS_H #define GRPC_GRPC_SECURITY_CONSTANTS_H -#ifdef __cplusplus -extern "C" { -#endif + #define GRPC_TRANSPORT_SECURITY_TYPE_PROPERTY_NAME "transport_security_type" #define GRPC_SSL_TRANSPORT_SECURITY_TYPE "ssl" @@ -99,8 +97,6 @@ typedef enum { GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY } grpc_ssl_client_certificate_request_type; -#ifdef __cplusplus -} -#endif + #endif /* GRPC_GRPC_SECURITY_CONSTANTS_H */ diff --git a/include/grpc/impl/codegen/atm.h b/include/grpc/impl/codegen/atm.h index 00d83f0604f..7bb41c55d2a 100644 --- a/include/grpc/impl/codegen/atm.h +++ b/include/grpc/impl/codegen/atm.h @@ -79,17 +79,13 @@ #error could not determine platform for atm #endif -#ifdef __cplusplus -extern "C" { -#endif + /** Adds \a delta to \a *value, clamping the result to the range specified by \a min and \a max. Returns the new value. */ gpr_atm gpr_atm_no_barrier_clamped_add(gpr_atm* value, gpr_atm delta, gpr_atm min, gpr_atm max); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_IMPL_CODEGEN_ATM_H */ diff --git a/include/grpc/impl/codegen/atm_gcc_atomic.h b/include/grpc/impl/codegen/atm_gcc_atomic.h index 58797085482..52eebb3c728 100644 --- a/include/grpc/impl/codegen/atm_gcc_atomic.h +++ b/include/grpc/impl/codegen/atm_gcc_atomic.h @@ -23,9 +23,7 @@ __atomic_* interface. */ #include -#ifdef __cplusplus -extern "C" { -#endif + typedef intptr_t gpr_atm; #define GPR_ATM_MAX INTPTR_MAX @@ -84,8 +82,6 @@ static __inline int gpr_atm_full_cas(gpr_atm* p, gpr_atm o, gpr_atm n) { #define gpr_atm_full_xchg(p, n) \ GPR_ATM_INC_CAS_THEN(__atomic_exchange_n((p), (n), __ATOMIC_ACQ_REL)) -#ifdef __cplusplus -} -#endif + #endif /* GRPC_IMPL_CODEGEN_ATM_GCC_ATOMIC_H */ diff --git a/include/grpc/impl/codegen/byte_buffer.h b/include/grpc/impl/codegen/byte_buffer.h index f8dfbd1d7dc..082fb9b36fb 100644 --- a/include/grpc/impl/codegen/byte_buffer.h +++ b/include/grpc/impl/codegen/byte_buffer.h @@ -21,9 +21,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + /** Returns a RAW byte buffer instance over the given slices (up to \a nslices). * @@ -79,8 +77,6 @@ grpc_byte_buffer_reader_readall(grpc_byte_buffer_reader* reader); GRPCAPI grpc_byte_buffer* grpc_raw_byte_buffer_from_reader( grpc_byte_buffer_reader* reader); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_IMPL_CODEGEN_BYTE_BUFFER_H */ diff --git a/include/grpc/impl/codegen/byte_buffer_reader.h b/include/grpc/impl/codegen/byte_buffer_reader.h index e06e19558a1..adb64e78316 100644 --- a/include/grpc/impl/codegen/byte_buffer_reader.h +++ b/include/grpc/impl/codegen/byte_buffer_reader.h @@ -19,9 +19,7 @@ #ifndef GRPC_IMPL_CODEGEN_BYTE_BUFFER_READER_H #define GRPC_IMPL_CODEGEN_BYTE_BUFFER_READER_H -#ifdef __cplusplus -extern "C" { -#endif + struct grpc_byte_buffer; @@ -35,8 +33,6 @@ struct grpc_byte_buffer_reader { } current; }; -#ifdef __cplusplus -} -#endif + #endif /* GRPC_IMPL_CODEGEN_BYTE_BUFFER_READER_H */ diff --git a/include/grpc/impl/codegen/compression_types.h b/include/grpc/impl/codegen/compression_types.h index 4419e2a4479..ad19ea6b31f 100644 --- a/include/grpc/impl/codegen/compression_types.h +++ b/include/grpc/impl/codegen/compression_types.h @@ -21,9 +21,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + /** To be used as initial metadata key for the request of a concrete compression * algorithm */ @@ -157,8 +155,6 @@ typedef struct grpc_compression_options { } grpc_compression_options; -#ifdef __cplusplus -} -#endif + #endif /* GRPC_IMPL_CODEGEN_COMPRESSION_TYPES_H */ diff --git a/include/grpc/impl/codegen/connectivity_state.h b/include/grpc/impl/codegen/connectivity_state.h index b70dbef3564..713652de24f 100644 --- a/include/grpc/impl/codegen/connectivity_state.h +++ b/include/grpc/impl/codegen/connectivity_state.h @@ -19,9 +19,7 @@ #ifndef GRPC_IMPL_CODEGEN_CONNECTIVITY_STATE_H #define GRPC_IMPL_CODEGEN_CONNECTIVITY_STATE_H -#ifdef __cplusplus -extern "C" { -#endif + /** Connectivity state of a channel. */ typedef enum { @@ -37,8 +35,6 @@ typedef enum { GRPC_CHANNEL_SHUTDOWN } grpc_connectivity_state; -#ifdef __cplusplus -} -#endif + #endif /* GRPC_IMPL_CODEGEN_CONNECTIVITY_STATE_H */ diff --git a/include/grpc/impl/codegen/gpr_types.h b/include/grpc/impl/codegen/gpr_types.h index d7bb54527ec..153d4ec7db0 100644 --- a/include/grpc/impl/codegen/gpr_types.h +++ b/include/grpc/impl/codegen/gpr_types.h @@ -23,9 +23,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + /** The clocks we support. */ typedef enum { @@ -52,8 +50,6 @@ typedef struct gpr_timespec { gpr_clock_type clock_type; } gpr_timespec; -#ifdef __cplusplus -} -#endif + #endif /* GRPC_IMPL_CODEGEN_GPR_TYPES_H */ diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h index 03be610d255..faa21a4e409 100644 --- a/include/grpc/impl/codegen/grpc_types.h +++ b/include/grpc/impl/codegen/grpc_types.h @@ -29,9 +29,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + typedef enum { GRPC_BB_RAW @@ -628,8 +626,6 @@ typedef struct grpc_completion_queue_attributes { /** The completion queue factory structure is opaque to the callers of grpc */ typedef struct grpc_completion_queue_factory grpc_completion_queue_factory; -#ifdef __cplusplus -} -#endif + #endif /* GRPC_IMPL_CODEGEN_GRPC_TYPES_H */ diff --git a/include/grpc/impl/codegen/propagation_bits.h b/include/grpc/impl/codegen/propagation_bits.h index 824bdbd8c9b..4eac3806fcd 100644 --- a/include/grpc/impl/codegen/propagation_bits.h +++ b/include/grpc/impl/codegen/propagation_bits.h @@ -21,9 +21,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + /** Propagation bits: this can be bitwise or-ed to form propagation_mask for * grpc_call */ @@ -45,8 +43,6 @@ extern "C" { 0xffff | GRPC_PROPAGATE_DEADLINE | GRPC_PROPAGATE_CENSUS_STATS_CONTEXT | \ GRPC_PROPAGATE_CENSUS_TRACING_CONTEXT | GRPC_PROPAGATE_CANCELLATION))) -#ifdef __cplusplus -} -#endif + #endif /* GRPC_IMPL_CODEGEN_PROPAGATION_BITS_H */ diff --git a/include/grpc/impl/codegen/status.h b/include/grpc/impl/codegen/status.h index 9bc3dc95609..4f1bce3a921 100644 --- a/include/grpc/impl/codegen/status.h +++ b/include/grpc/impl/codegen/status.h @@ -19,9 +19,7 @@ #ifndef GRPC_IMPL_CODEGEN_STATUS_H #define GRPC_IMPL_CODEGEN_STATUS_H -#ifdef __cplusplus -extern "C" { -#endif + typedef enum { /** Not an error; returned on success */ @@ -146,8 +144,6 @@ typedef enum { GRPC_STATUS__DO_NOT_USE = -1 } grpc_status_code; -#ifdef __cplusplus -} -#endif + #endif /* GRPC_IMPL_CODEGEN_STATUS_H */ diff --git a/include/grpc/impl/codegen/sync.h b/include/grpc/impl/codegen/sync.h index 6cdb0c5153d..b9cd7204c00 100644 --- a/include/grpc/impl/codegen/sync.h +++ b/include/grpc/impl/codegen/sync.h @@ -37,9 +37,7 @@ provides no memory barriers. */ -#ifdef __cplusplus -extern "C" { -#endif + /* Platform-specific type declarations of gpr_mu and gpr_cv. */ #include @@ -55,8 +53,6 @@ extern "C" { #error Unable to determine platform for sync #endif -#ifdef __cplusplus -} -#endif + #endif /* GRPC_IMPL_CODEGEN_SYNC_H */ diff --git a/include/grpc/load_reporting.h b/include/grpc/load_reporting.h index 55f50ea85e9..23ae315a895 100644 --- a/include/grpc/load_reporting.h +++ b/include/grpc/load_reporting.h @@ -21,9 +21,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + /** Metadata key for the gRPC LB load balancer token. * @@ -41,8 +39,6 @@ extern "C" { * call. */ #define GRPC_LB_COST_MD_KEY "lb-cost-bin" -#ifdef __cplusplus -} -#endif + #endif /* GRPC_LOAD_REPORTING_H */ diff --git a/include/grpc/slice.h b/include/grpc/slice.h index 10b6a624b32..dd188d68495 100644 --- a/include/grpc/slice.h +++ b/include/grpc/slice.h @@ -22,9 +22,7 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif + /** Increment the refcount of s. Requires slice is initialized. Returns s. */ @@ -163,8 +161,6 @@ GPRAPI grpc_slice grpc_slice_dup(grpc_slice a); NULL's. Returned string must be freed with gpr_free. */ GPRAPI char* grpc_slice_to_c_string(grpc_slice s); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_SLICE_H */ diff --git a/include/grpc/slice_buffer.h b/include/grpc/slice_buffer.h index 6510c151b3c..4ba9f600a50 100644 --- a/include/grpc/slice_buffer.h +++ b/include/grpc/slice_buffer.h @@ -21,9 +21,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + /** initialize a slice buffer */ GPRAPI void grpc_slice_buffer_init(grpc_slice_buffer* sb); @@ -76,8 +74,6 @@ GPRAPI grpc_slice grpc_slice_buffer_take_first(grpc_slice_buffer* src); GPRAPI void grpc_slice_buffer_undo_take_first(grpc_slice_buffer* src, grpc_slice slice); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_SLICE_BUFFER_H */ diff --git a/include/grpc/support/alloc.h b/include/grpc/support/alloc.h index 31cb2256385..d9398a29026 100644 --- a/include/grpc/support/alloc.h +++ b/include/grpc/support/alloc.h @@ -23,9 +23,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + typedef struct gpr_allocation_functions { void* (*malloc_fn)(size_t size); @@ -60,8 +58,6 @@ GPRAPI void gpr_set_allocation_functions(gpr_allocation_functions functions); /** Return the family of allocation functions currently in effect. */ GPRAPI gpr_allocation_functions gpr_get_allocation_functions(); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_SUPPORT_ALLOC_H */ diff --git a/include/grpc/support/avl.h b/include/grpc/support/avl.h index b5a8c0ffa1c..d43196f99bc 100644 --- a/include/grpc/support/avl.h +++ b/include/grpc/support/avl.h @@ -21,9 +21,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + /** internal node of an AVL tree */ typedef struct gpr_avl_node { @@ -95,8 +93,6 @@ GPRAPI int gpr_avl_maybe_get(gpr_avl avl, void* key, void** value, /** Return 1 if avl is empty, 0 otherwise */ GPRAPI int gpr_avl_is_empty(gpr_avl avl); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_SUPPORT_AVL_H */ diff --git a/include/grpc/support/cmdline.h b/include/grpc/support/cmdline.h index c34a109fbd9..e242eb592ba 100644 --- a/include/grpc/support/cmdline.h +++ b/include/grpc/support/cmdline.h @@ -21,9 +21,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + /** Simple command line parser. @@ -81,8 +79,6 @@ GPRAPI void gpr_cmdline_destroy(gpr_cmdline* cl); /** Get a string describing usage */ GPRAPI char* gpr_cmdline_usage_string(gpr_cmdline* cl, const char* argv0); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_SUPPORT_CMDLINE_H */ diff --git a/include/grpc/support/cpu.h b/include/grpc/support/cpu.h index f0e898e8596..dbc7c92993d 100644 --- a/include/grpc/support/cpu.h +++ b/include/grpc/support/cpu.h @@ -21,9 +21,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + /** Interface providing CPU information for currently running system */ @@ -37,8 +35,6 @@ GPRAPI unsigned gpr_cpu_num_cores(void); [0, gpr_cpu_num_cores() - 1] */ GPRAPI unsigned gpr_cpu_current_cpu(void); -#ifdef __cplusplus -} // extern "C" -#endif + #endif /* GRPC_SUPPORT_CPU_H */ diff --git a/include/grpc/support/histogram.h b/include/grpc/support/histogram.h index d2794d847e8..cc08cfa6884 100644 --- a/include/grpc/support/histogram.h +++ b/include/grpc/support/histogram.h @@ -22,9 +22,7 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif + typedef struct gpr_histogram gpr_histogram; @@ -57,8 +55,6 @@ GPRAPI void gpr_histogram_merge_contents(gpr_histogram* histogram, double max_seen, double sum, double sum_of_squares, double count); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_SUPPORT_HISTOGRAM_H */ diff --git a/include/grpc/support/host_port.h b/include/grpc/support/host_port.h index 9805811bfb6..7880b642b55 100644 --- a/include/grpc/support/host_port.h +++ b/include/grpc/support/host_port.h @@ -21,9 +21,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + /** Given a host and port, creates a newly-allocated string of the form "host:port" or "[ho:st]:port", depending on whether the host contains colons @@ -44,8 +42,6 @@ GPRAPI int gpr_join_host_port(char** out, const char* host, int port); failure. */ GPRAPI int gpr_split_host_port(const char* name, char** host, char** port); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_SUPPORT_HOST_PORT_H */ diff --git a/include/grpc/support/log.h b/include/grpc/support/log.h index 497cca90815..af8e6231306 100644 --- a/include/grpc/support/log.h +++ b/include/grpc/support/log.h @@ -25,9 +25,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + /** GPR log API. @@ -96,8 +94,6 @@ GPRAPI void gpr_set_log_function(gpr_log_func func); } \ } while (0) -#ifdef __cplusplus -} -#endif + #endif /* GRPC_SUPPORT_LOG_H */ diff --git a/include/grpc/support/log_windows.h b/include/grpc/support/log_windows.h index e833f9d9dfd..93d4fc73c4e 100644 --- a/include/grpc/support/log_windows.h +++ b/include/grpc/support/log_windows.h @@ -21,9 +21,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + /** Returns a string allocated with gpr_malloc that contains a UTF-8 * formatted error message, corresponding to the error messageid. @@ -31,8 +29,6 @@ extern "C" { */ GPRAPI char* gpr_format_message(int messageid); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_SUPPORT_LOG_WINDOWS_H */ diff --git a/include/grpc/support/string_util.h b/include/grpc/support/string_util.h index 2c7460fa157..5c5b60d67e5 100644 --- a/include/grpc/support/string_util.h +++ b/include/grpc/support/string_util.h @@ -21,9 +21,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + /** String utility functions */ @@ -42,8 +40,6 @@ GPRAPI char* gpr_strdup(const char* src); GPRAPI int gpr_asprintf(char** strp, const char* format, ...) GPR_PRINT_FORMAT_CHECK(2, 3); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_SUPPORT_STRING_UTIL_H */ diff --git a/include/grpc/support/subprocess.h b/include/grpc/support/subprocess.h index 175f7b50eba..a050c1ba827 100644 --- a/include/grpc/support/subprocess.h +++ b/include/grpc/support/subprocess.h @@ -21,9 +21,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + typedef struct gpr_subprocess gpr_subprocess; @@ -37,8 +35,6 @@ GPRAPI void gpr_subprocess_destroy(gpr_subprocess* p); GPRAPI int gpr_subprocess_join(gpr_subprocess* p); GPRAPI void gpr_subprocess_interrupt(gpr_subprocess* p); -#ifdef __cplusplus -} // extern "C" -#endif + #endif /* GRPC_SUPPORT_SUBPROCESS_H */ diff --git a/include/grpc/support/sync.h b/include/grpc/support/sync.h index 75192673a6f..2953e24944f 100644 --- a/include/grpc/support/sync.h +++ b/include/grpc/support/sync.h @@ -22,9 +22,7 @@ #include /* for gpr_timespec */ #include -#ifdef __cplusplus -extern "C" { -#endif + /** --- Mutex interface --- @@ -273,9 +271,6 @@ GPRAPI intptr_t gpr_stats_read(const gpr_stats_counter* c); } #endif /* 0 */ -#ifdef __cplusplus -} // extern "C" - namespace grpc_core { class mu_guard { @@ -291,6 +286,5 @@ class mu_guard { }; } // namespace grpc_core -#endif #endif /* GRPC_SUPPORT_SYNC_H */ diff --git a/include/grpc/support/thd.h b/include/grpc/support/thd.h index 225d9d6c755..6d398931be5 100644 --- a/include/grpc/support/thd.h +++ b/include/grpc/support/thd.h @@ -29,9 +29,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + typedef uintptr_t gpr_thd_id; @@ -69,8 +67,6 @@ GPRAPI gpr_thd_id gpr_thd_currentid(void); Calling this on a detached thread has unpredictable results. */ GPRAPI void gpr_thd_join(gpr_thd_id t); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_SUPPORT_THD_H */ diff --git a/include/grpc/support/time.h b/include/grpc/support/time.h index 62d354aafe8..1ed5ee6ae40 100644 --- a/include/grpc/support/time.h +++ b/include/grpc/support/time.h @@ -24,9 +24,7 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif + /** Time constants. */ GPRAPI gpr_timespec @@ -83,8 +81,6 @@ GPRAPI void gpr_sleep_until(gpr_timespec until); GPRAPI double gpr_timespec_to_micros(gpr_timespec t); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_SUPPORT_TIME_H */ diff --git a/include/grpc/support/tls_pthread.h b/include/grpc/support/tls_pthread.h index fb0edd8e744..5a6ff129e8d 100644 --- a/include/grpc/support/tls_pthread.h +++ b/include/grpc/support/tls_pthread.h @@ -34,12 +34,8 @@ struct gpr_pthread_thread_local { #define gpr_tls_init(tls) GPR_ASSERT(0 == pthread_key_create(&(tls)->key, NULL)) #define gpr_tls_destroy(tls) pthread_key_delete((tls)->key) #define gpr_tls_get(tls) ((intptr_t)pthread_getspecific((tls)->key)) -#ifdef __cplusplus -extern "C" { -#endif + intptr_t gpr_tls_set(struct gpr_pthread_thread_local* tls, intptr_t value); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_SUPPORT_TLS_PTHREAD_H */ diff --git a/src/core/ext/filters/client_channel/client_channel.h b/src/core/ext/filters/client_channel/client_channel.h index 27862cf2391..36165172a2f 100644 --- a/src/core/ext/filters/client_channel/client_channel.h +++ b/src/core/ext/filters/client_channel/client_channel.h @@ -28,9 +28,7 @@ extern grpc_tracer_flag grpc_client_channel_trace; // Channel arg key for server URI string. #define GRPC_ARG_SERVER_URI "grpc.server_uri" -#ifdef __cplusplus -extern "C" { -#endif + /* A client channel is a channel that begins disconnected, and can connect to some endpoint on demand. If that endpoint disconnects, it will be @@ -56,8 +54,6 @@ void grpc_client_channel_watch_connectivity_state( grpc_subchannel_call* grpc_client_channel_get_subchannel_call( grpc_call_element* elem); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_CLIENT_CHANNEL_H */ diff --git a/src/core/ext/filters/client_channel/client_channel_factory.h b/src/core/ext/filters/client_channel/client_channel_factory.h index db8645cd00a..9616e9fad01 100644 --- a/src/core/ext/filters/client_channel/client_channel_factory.h +++ b/src/core/ext/filters/client_channel/client_channel_factory.h @@ -27,9 +27,7 @@ // Channel arg key for client channel factory. #define GRPC_ARG_CLIENT_CHANNEL_FACTORY "grpc.client_channel_factory" -#ifdef __cplusplus -extern "C" { -#endif + typedef struct grpc_client_channel_factory grpc_client_channel_factory; typedef struct grpc_client_channel_factory_vtable @@ -78,8 +76,6 @@ grpc_channel* grpc_client_channel_factory_create_channel( grpc_arg grpc_client_channel_factory_create_channel_arg( grpc_client_channel_factory* factory); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_CLIENT_CHANNEL_FACTORY_H */ diff --git a/src/core/ext/filters/client_channel/client_channel_plugin.cc b/src/core/ext/filters/client_channel/client_channel_plugin.cc index eebef6827c5..7b1e642bb85 100644 --- a/src/core/ext/filters/client_channel/client_channel_plugin.cc +++ b/src/core/ext/filters/client_channel/client_channel_plugin.cc @@ -65,7 +65,7 @@ static bool set_default_host_if_unset(grpc_exec_ctx* exec_ctx, return true; } -extern "C" void grpc_client_channel_init(void) { +void grpc_client_channel_init(void) { grpc_lb_policy_registry_init(); grpc_resolver_registry_init(); grpc_retry_throttle_map_init(); @@ -84,7 +84,7 @@ extern "C" void grpc_client_channel_init(void) { #endif } -extern "C" void grpc_client_channel_shutdown(void) { +void grpc_client_channel_shutdown(void) { grpc_subchannel_index_shutdown(); grpc_channel_init_shutdown(); grpc_proxy_mapper_registry_shutdown(); diff --git a/src/core/ext/filters/client_channel/connector.h b/src/core/ext/filters/client_channel/connector.h index 12dc59bcdf8..62b943852fe 100644 --- a/src/core/ext/filters/client_channel/connector.h +++ b/src/core/ext/filters/client_channel/connector.h @@ -23,9 +23,7 @@ #include "src/core/lib/iomgr/resolve_address.h" #include "src/core/lib/transport/transport.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef struct grpc_connector grpc_connector; typedef struct grpc_connector_vtable grpc_connector_vtable; @@ -74,8 +72,6 @@ void grpc_connector_connect(grpc_exec_ctx* exec_ctx, grpc_connector* connector, void grpc_connector_shutdown(grpc_exec_ctx* exec_ctx, grpc_connector* connector, grpc_error* why); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_CONNECTOR_H */ diff --git a/src/core/ext/filters/client_channel/http_connect_handshaker.h b/src/core/ext/filters/client_channel/http_connect_handshaker.h index 05a23cdba34..c676c2ad550 100644 --- a/src/core/ext/filters/client_channel/http_connect_handshaker.h +++ b/src/core/ext/filters/client_channel/http_connect_handshaker.h @@ -28,15 +28,11 @@ /// seperated by colons. #define GRPC_ARG_HTTP_CONNECT_HEADERS "grpc.http_connect_headers" -#ifdef __cplusplus -extern "C" { -#endif + /// Registers handshaker factory. void grpc_http_connect_register_handshaker_factory(); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_HTTP_CONNECT_HANDSHAKER_H */ diff --git a/src/core/ext/filters/client_channel/http_proxy.h b/src/core/ext/filters/client_channel/http_proxy.h index bdad03def31..894f5482736 100644 --- a/src/core/ext/filters/client_channel/http_proxy.h +++ b/src/core/ext/filters/client_channel/http_proxy.h @@ -19,14 +19,10 @@ #ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_HTTP_PROXY_H #define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_HTTP_PROXY_H -#ifdef __cplusplus -extern "C" { -#endif + void grpc_register_http_proxy_mapper(); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_HTTP_PROXY_H */ diff --git a/src/core/ext/filters/client_channel/lb_policy.h b/src/core/ext/filters/client_channel/lb_policy.h index 590094e67eb..7c1f1942efd 100644 --- a/src/core/ext/filters/client_channel/lb_policy.h +++ b/src/core/ext/filters/client_channel/lb_policy.h @@ -23,9 +23,7 @@ #include "src/core/lib/iomgr/polling_entity.h" #include "src/core/lib/transport/connectivity_state.h" -#ifdef __cplusplus -extern "C" { -#endif + /** A load balancing policy: specified by a vtable and a struct (which is expected to be extended to contain some parameters) */ @@ -208,8 +206,6 @@ void grpc_lb_policy_update_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy, const grpc_lb_policy_args* lb_policy_args); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_H */ diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h b/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h index abf613a23b2..b6cbd1b3c44 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h @@ -21,15 +21,11 @@ #include "src/core/lib/channel/channel_stack.h" -#ifdef __cplusplus -extern "C" { -#endif + extern const grpc_channel_filter grpc_client_load_reporting_filter; -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_CLIENT_LOAD_REPORTING_FILTER_H \ */ diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc index ad9a2bb83b2..98f85ae52eb 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc @@ -2001,7 +2001,7 @@ static bool maybe_add_client_load_reporting_filter( return true; } -extern "C" void grpc_lb_policy_grpclb_init() { +void grpc_lb_policy_grpclb_init() { grpc_register_lb_policy(grpc_glb_lb_factory_create()); grpc_register_tracer(&grpc_lb_glb_trace); #ifndef NDEBUG @@ -2013,4 +2013,4 @@ extern "C" void grpc_lb_policy_grpclb_init() { (void*)&grpc_client_load_reporting_filter); } -extern "C" void grpc_lb_policy_grpclb_shutdown() {} +void grpc_lb_policy_grpclb_shutdown() {} diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h index b6135a47684..14895945169 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h @@ -21,17 +21,13 @@ #include "src/core/ext/filters/client_channel/lb_policy_factory.h" -#ifdef __cplusplus -extern "C" { -#endif + /** Returns a load balancing factory for the glb policy, which tries to connect * to a load balancing server to decide the next successfully connected * subchannel to pick. */ grpc_lb_policy_factory* grpc_glb_lb_factory_create(); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_GRPCLB_H */ diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h index 39cbf534289..4bc8d71a390 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h @@ -23,9 +23,7 @@ #include "src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h" #include "src/core/lib/slice/slice_hash_table.h" -#ifdef __cplusplus -extern "C" { -#endif + /** Create the channel used for communicating with an LB service. * Note that an LB *service* may be comprised of several LB *servers*. @@ -44,9 +42,7 @@ grpc_channel_args* grpc_lb_policy_grpclb_build_lb_channel_args( grpc_fake_resolver_response_generator* response_generator, const grpc_channel_args* args); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_GRPCLB_CHANNEL_H \ */ diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h index ce88cf9ee4d..54eaa3e5c7c 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h @@ -23,9 +23,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + typedef struct grpc_grpclb_client_stats grpc_grpclb_client_stats; @@ -65,9 +63,7 @@ void grpc_grpclb_client_stats_get_locked( void grpc_grpclb_dropped_call_counts_destroy( grpc_grpclb_dropped_call_counts* drop_entries); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_GRPCLB_CLIENT_STATS_H \ */ diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h b/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h index 138012c63ae..d0e632b10ee 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h @@ -25,9 +25,7 @@ #include "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h" #include "src/core/ext/filters/client_channel/lb_policy_factory.h" -#ifdef __cplusplus -extern "C" { -#endif + #define GRPC_GRPCLB_SERVICE_NAME_MAX_LENGTH 128 @@ -87,9 +85,7 @@ grpc_millis grpc_grpclb_duration_to_millis(grpc_grpclb_duration* duration_pb); void grpc_grpclb_initial_response_destroy( grpc_grpclb_initial_response* response); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_LOAD_BALANCER_API_H \ */ diff --git a/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc b/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc index dbd4754e875..4e249207fae 100644 --- a/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +++ b/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc @@ -593,9 +593,9 @@ static grpc_lb_policy_factory* pick_first_lb_factory_create() { /* Plugin registration */ -extern "C" void grpc_lb_policy_pick_first_init() { +void grpc_lb_policy_pick_first_init() { grpc_register_lb_policy(pick_first_lb_factory_create()); grpc_register_tracer(&grpc_lb_pick_first_trace); } -extern "C" void grpc_lb_policy_pick_first_shutdown() {} +void grpc_lb_policy_pick_first_shutdown() {} diff --git a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc index 6ea1f025df0..359aa0e8253 100644 --- a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +++ b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc @@ -689,9 +689,9 @@ static grpc_lb_policy_factory* round_robin_lb_factory_create() { /* Plugin registration */ -extern "C" void grpc_lb_policy_round_robin_init() { +void grpc_lb_policy_round_robin_init() { grpc_register_lb_policy(round_robin_lb_factory_create()); grpc_register_tracer(&grpc_lb_round_robin_trace); } -extern "C" void grpc_lb_policy_round_robin_shutdown() {} +void grpc_lb_policy_round_robin_shutdown() {} diff --git a/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h b/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h index e18ad490e8e..f3db9b15fcf 100644 --- a/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +++ b/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h @@ -36,9 +36,7 @@ // round_robin that could be refactored and moved here. In a future PR, // need to clean this up. -#ifdef __cplusplus -extern "C" { -#endif + typedef struct grpc_lb_subchannel_list grpc_lb_subchannel_list; @@ -146,8 +144,6 @@ void grpc_lb_subchannel_list_shutdown_and_unref( grpc_exec_ctx* exec_ctx, grpc_lb_subchannel_list* subchannel_list, const char* reason); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_SUBCHANNEL_LIST_H */ diff --git a/src/core/ext/filters/client_channel/lb_policy_factory.h b/src/core/ext/filters/client_channel/lb_policy_factory.h index 360a42b1779..79c771221d8 100644 --- a/src/core/ext/filters/client_channel/lb_policy_factory.h +++ b/src/core/ext/filters/client_channel/lb_policy_factory.h @@ -29,9 +29,7 @@ // Channel arg key for grpc_lb_addresses. #define GRPC_ARG_LB_ADDRESSES "grpc.lb_addresses" -#ifdef __cplusplus -extern "C" { -#endif + typedef struct grpc_lb_policy_factory grpc_lb_policy_factory; typedef struct grpc_lb_policy_factory_vtable grpc_lb_policy_factory_vtable; @@ -134,8 +132,6 @@ grpc_lb_policy* grpc_lb_policy_factory_create_lb_policy( grpc_exec_ctx* exec_ctx, grpc_lb_policy_factory* factory, grpc_lb_policy_args* args); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_FACTORY_H */ diff --git a/src/core/ext/filters/client_channel/lb_policy_registry.h b/src/core/ext/filters/client_channel/lb_policy_registry.h index 055f751b57b..de089a8fc8c 100644 --- a/src/core/ext/filters/client_channel/lb_policy_registry.h +++ b/src/core/ext/filters/client_channel/lb_policy_registry.h @@ -22,9 +22,7 @@ #include "src/core/ext/filters/client_channel/lb_policy_factory.h" #include "src/core/lib/iomgr/exec_ctx.h" -#ifdef __cplusplus -extern "C" { -#endif + /** Initialize the registry and set \a default_factory as the factory to be * returned when no name is provided in a lookup */ @@ -41,8 +39,6 @@ void grpc_register_lb_policy(grpc_lb_policy_factory* factory); grpc_lb_policy* grpc_lb_policy_create(grpc_exec_ctx* exec_ctx, const char* name, grpc_lb_policy_args* args); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_REGISTRY_H */ diff --git a/src/core/ext/filters/client_channel/parse_address.h b/src/core/ext/filters/client_channel/parse_address.h index b45859f9a23..825cd123933 100644 --- a/src/core/ext/filters/client_channel/parse_address.h +++ b/src/core/ext/filters/client_channel/parse_address.h @@ -24,9 +24,7 @@ #include "src/core/ext/filters/client_channel/uri_parser.h" #include "src/core/lib/iomgr/resolve_address.h" -#ifdef __cplusplus -extern "C" { -#endif + /** Populate \a resolved_addr from \a uri, whose path is expected to contain a * unix socket path. Returns true upon success. */ @@ -49,8 +47,6 @@ bool grpc_parse_ipv4_hostport(const char* hostport, grpc_resolved_address* addr, bool grpc_parse_ipv6_hostport(const char* hostport, grpc_resolved_address* addr, bool log_errors); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_PARSE_ADDRESS_H */ diff --git a/src/core/ext/filters/client_channel/proxy_mapper.h b/src/core/ext/filters/client_channel/proxy_mapper.h index bb8259f8545..81ecfb71bb5 100644 --- a/src/core/ext/filters/client_channel/proxy_mapper.h +++ b/src/core/ext/filters/client_channel/proxy_mapper.h @@ -25,9 +25,7 @@ #include "src/core/lib/iomgr/resolve_address.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef struct grpc_proxy_mapper grpc_proxy_mapper; @@ -75,8 +73,6 @@ bool grpc_proxy_mapper_map_address(grpc_exec_ctx* exec_ctx, void grpc_proxy_mapper_destroy(grpc_proxy_mapper* mapper); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_PROXY_MAPPER_H */ diff --git a/src/core/ext/filters/client_channel/proxy_mapper_registry.h b/src/core/ext/filters/client_channel/proxy_mapper_registry.h index 39c607cefcf..f17fdd89df9 100644 --- a/src/core/ext/filters/client_channel/proxy_mapper_registry.h +++ b/src/core/ext/filters/client_channel/proxy_mapper_registry.h @@ -21,9 +21,7 @@ #include "src/core/ext/filters/client_channel/proxy_mapper.h" -#ifdef __cplusplus -extern "C" { -#endif + void grpc_proxy_mapper_registry_init(); void grpc_proxy_mapper_registry_shutdown(); @@ -45,8 +43,6 @@ bool grpc_proxy_mappers_map_address(grpc_exec_ctx* exec_ctx, grpc_resolved_address** new_address, grpc_channel_args** new_args); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_PROXY_MAPPER_REGISTRY_H */ diff --git a/src/core/ext/filters/client_channel/resolver.h b/src/core/ext/filters/client_channel/resolver.h index a0eb0bcfdf4..ac956662407 100644 --- a/src/core/ext/filters/client_channel/resolver.h +++ b/src/core/ext/filters/client_channel/resolver.h @@ -22,9 +22,7 @@ #include "src/core/ext/filters/client_channel/subchannel.h" #include "src/core/lib/iomgr/iomgr.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef struct grpc_resolver grpc_resolver; typedef struct grpc_resolver_vtable grpc_resolver_vtable; @@ -91,8 +89,6 @@ void grpc_resolver_next_locked(grpc_exec_ctx* exec_ctx, grpc_resolver* resolver, grpc_channel_args** result, grpc_closure* on_complete); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_H */ diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc b/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc index 07737b19d23..3a16b3492d1 100644 --- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc @@ -425,7 +425,7 @@ static grpc_resolver_factory* dns_ares_resolver_factory_create() { return &dns_resolver_factory; } -extern "C" void grpc_resolver_dns_ares_init(void) { +void grpc_resolver_dns_ares_init(void) { char* resolver = gpr_getenv("GRPC_DNS_RESOLVER"); /* TODO(zyc): Turn on c-ares based resolver by default after the address sorter and the CNAME support are added. */ @@ -441,7 +441,7 @@ extern "C" void grpc_resolver_dns_ares_init(void) { gpr_free(resolver); } -extern "C" void grpc_resolver_dns_ares_shutdown(void) { +void grpc_resolver_dns_ares_shutdown(void) { char* resolver = gpr_getenv("GRPC_DNS_RESOLVER"); if (resolver != nullptr && gpr_stricmp(resolver, "ares") == 0) { grpc_ares_cleanup(); @@ -451,8 +451,8 @@ extern "C" void grpc_resolver_dns_ares_shutdown(void) { #else /* GRPC_ARES == 1 && !defined(GRPC_UV) */ -extern "C" void grpc_resolver_dns_ares_init(void) {} +void grpc_resolver_dns_ares_init(void) {} -extern "C" void grpc_resolver_dns_ares_shutdown(void) {} +void grpc_resolver_dns_ares_shutdown(void) {} #endif /* GRPC_ARES == 1 && !defined(GRPC_UV) */ diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h index 0062aa561a0..54e04f7aeb8 100644 --- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h @@ -23,9 +23,7 @@ #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/pollset_set.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef struct grpc_ares_ev_driver grpc_ares_ev_driver; @@ -54,9 +52,7 @@ void grpc_ares_ev_driver_destroy(grpc_ares_ev_driver* ev_driver); void grpc_ares_ev_driver_shutdown(grpc_exec_ctx* exec_ctx, grpc_ares_ev_driver* ev_driver); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_DNS_C_ARES_GRPC_ARES_EV_DRIVER_H \ */ diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h index 6882b7b1d16..8c6499f8f86 100644 --- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h @@ -25,9 +25,7 @@ #include "src/core/lib/iomgr/polling_entity.h" #include "src/core/lib/iomgr/resolve_address.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef struct grpc_ares_request grpc_ares_request; @@ -69,9 +67,7 @@ grpc_error* grpc_ares_init(void); it has been called the same number of times as grpc_ares_init(). */ void grpc_ares_cleanup(void); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_DNS_C_ARES_GRPC_ARES_WRAPPER_H \ */ diff --git a/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc b/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc index 589c74807f2..fc40ce69668 100644 --- a/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +++ b/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc @@ -295,7 +295,7 @@ static grpc_resolver_factory* dns_resolver_factory_create() { return &dns_resolver_factory; } -extern "C" void grpc_resolver_dns_native_init(void) { +void grpc_resolver_dns_native_init(void) { char* resolver = gpr_getenv("GRPC_DNS_RESOLVER"); if (resolver != nullptr && gpr_stricmp(resolver, "native") == 0) { gpr_log(GPR_DEBUG, "Using native dns resolver"); @@ -313,4 +313,4 @@ extern "C" void grpc_resolver_dns_native_init(void) { gpr_free(resolver); } -extern "C" void grpc_resolver_dns_native_shutdown(void) {} +void grpc_resolver_dns_native_shutdown(void) {} diff --git a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc index 85d7090144d..44798ca434e 100644 --- a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +++ b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc @@ -258,8 +258,8 @@ static const grpc_resolver_factory_vtable fake_resolver_factory_vtable = { static grpc_resolver_factory fake_resolver_factory = { &fake_resolver_factory_vtable}; -extern "C" void grpc_resolver_fake_init(void) { +void grpc_resolver_fake_init(void) { grpc_register_resolver_type(&fake_resolver_factory); } -extern "C" void grpc_resolver_fake_shutdown(void) {} +void grpc_resolver_fake_shutdown(void) {} diff --git a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h index 3f341fa8ed6..c56c34b59c2 100644 --- a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +++ b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h @@ -21,9 +21,7 @@ #include "src/core/ext/filters/client_channel/uri_parser.h" #include "src/core/lib/channel/channel_args.h" -#ifdef __cplusplus -extern "C" { -#endif + #define GRPC_ARG_FAKE_RESOLVER_RESPONSE_GENERATOR \ "grpc.fake_resolver.response_generator" @@ -60,9 +58,7 @@ grpc_fake_resolver_response_generator_ref( void grpc_fake_resolver_response_generator_unref( grpc_fake_resolver_response_generator* generator); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_FAKE_FAKE_RESOLVER_H \ */ diff --git a/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc b/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc index 1da8ab91618..f0934b5943b 100644 --- a/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +++ b/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc @@ -211,7 +211,7 @@ DECL_FACTORY(unix); DECL_FACTORY(ipv4); DECL_FACTORY(ipv6); -extern "C" void grpc_resolver_sockaddr_init(void) { +void grpc_resolver_sockaddr_init(void) { grpc_register_resolver_type(&ipv4_resolver_factory); grpc_register_resolver_type(&ipv6_resolver_factory); #ifdef GRPC_HAVE_UNIX_SOCKET @@ -219,4 +219,4 @@ extern "C" void grpc_resolver_sockaddr_init(void) { #endif } -extern "C" void grpc_resolver_sockaddr_shutdown(void) {} +void grpc_resolver_sockaddr_shutdown(void) {} diff --git a/src/core/ext/filters/client_channel/resolver_factory.h b/src/core/ext/filters/client_channel/resolver_factory.h index 62555a4f01f..8bba90d0ace 100644 --- a/src/core/ext/filters/client_channel/resolver_factory.h +++ b/src/core/ext/filters/client_channel/resolver_factory.h @@ -24,9 +24,7 @@ #include "src/core/ext/filters/client_channel/uri_parser.h" #include "src/core/lib/iomgr/pollset_set.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef struct grpc_resolver_factory grpc_resolver_factory; typedef struct grpc_resolver_factory_vtable grpc_resolver_factory_vtable; @@ -71,8 +69,6 @@ grpc_resolver* grpc_resolver_factory_create_resolver( char* grpc_resolver_factory_get_default_authority( grpc_resolver_factory* factory, grpc_uri* uri); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_FACTORY_H */ diff --git a/src/core/ext/filters/client_channel/resolver_registry.h b/src/core/ext/filters/client_channel/resolver_registry.h index 01a2d0b18bf..6f7f8945c31 100644 --- a/src/core/ext/filters/client_channel/resolver_registry.h +++ b/src/core/ext/filters/client_channel/resolver_registry.h @@ -22,9 +22,7 @@ #include "src/core/ext/filters/client_channel/resolver_factory.h" #include "src/core/lib/iomgr/pollset_set.h" -#ifdef __cplusplus -extern "C" { -#endif + void grpc_resolver_registry_init(); void grpc_resolver_registry_shutdown(void); @@ -70,8 +68,6 @@ char* grpc_get_default_authority(grpc_exec_ctx* exec_ctx, const char* target); char* grpc_resolver_factory_add_default_prefix_if_needed( grpc_exec_ctx* exec_ctx, const char* target); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_REGISTRY_H */ diff --git a/src/core/ext/filters/client_channel/retry_throttle.h b/src/core/ext/filters/client_channel/retry_throttle.h index 399383df78b..305dd1ca5de 100644 --- a/src/core/ext/filters/client_channel/retry_throttle.h +++ b/src/core/ext/filters/client_channel/retry_throttle.h @@ -21,9 +21,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + /// Tracks retry throttling data for an individual server name. typedef struct grpc_server_retry_throttle_data grpc_server_retry_throttle_data; @@ -51,8 +49,6 @@ void grpc_retry_throttle_map_shutdown(); grpc_server_retry_throttle_data* grpc_retry_throttle_map_get_data_for_server( const char* server_name, int max_milli_tokens, int milli_token_ratio); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RETRY_THROTTLE_H */ diff --git a/src/core/ext/filters/client_channel/subchannel.h b/src/core/ext/filters/client_channel/subchannel.h index 970f182ff0c..44491c3cded 100644 --- a/src/core/ext/filters/client_channel/subchannel.h +++ b/src/core/ext/filters/client_channel/subchannel.h @@ -26,9 +26,7 @@ #include "src/core/lib/transport/connectivity_state.h" #include "src/core/lib/transport/metadata.h" -#ifdef __cplusplus -extern "C" { -#endif + // Channel arg containing a grpc_resolved_address to connect to. #define GRPC_ARG_SUBCHANNEL_ADDRESS "grpc.subchannel_address" @@ -192,8 +190,6 @@ const char* grpc_get_subchannel_address_uri_arg(const grpc_channel_args* args); /// Caller is responsible for freeing the string. grpc_arg grpc_create_subchannel_address_arg(const grpc_resolved_address* addr); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_SUBCHANNEL_H */ diff --git a/src/core/ext/filters/client_channel/subchannel_index.h b/src/core/ext/filters/client_channel/subchannel_index.h index 47f9c7bb1ec..23ba7e210fd 100644 --- a/src/core/ext/filters/client_channel/subchannel_index.h +++ b/src/core/ext/filters/client_channel/subchannel_index.h @@ -21,9 +21,7 @@ #include "src/core/ext/filters/client_channel/subchannel.h" -#ifdef __cplusplus -extern "C" { -#endif + /** \file Provides an index of active subchannels so that they can be shared amongst channels */ @@ -82,8 +80,6 @@ void grpc_subchannel_index_unref(void); * force_creation set. */ void grpc_subchannel_index_test_only_set_force_creation(bool force_creation); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_SUBCHANNEL_INDEX_H */ diff --git a/src/core/ext/filters/client_channel/uri_parser.h b/src/core/ext/filters/client_channel/uri_parser.h index cd877ade8d8..3bf4c196548 100644 --- a/src/core/ext/filters/client_channel/uri_parser.h +++ b/src/core/ext/filters/client_channel/uri_parser.h @@ -22,9 +22,7 @@ #include #include "src/core/lib/iomgr/exec_ctx.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef struct { char* scheme; @@ -51,8 +49,6 @@ const char* grpc_uri_get_query_arg(const grpc_uri* uri, const char* key); /** destroy a uri */ void grpc_uri_destroy(grpc_uri* uri); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_URI_PARSER_H */ diff --git a/src/core/ext/filters/deadline/deadline_filter.cc b/src/core/ext/filters/deadline/deadline_filter.cc index 849ce7153e7..5db7584a59d 100644 --- a/src/core/ext/filters/deadline/deadline_filter.cc +++ b/src/core/ext/filters/deadline/deadline_filter.cc @@ -382,7 +382,7 @@ static bool maybe_add_deadline_filter(grpc_exec_ctx* exec_ctx, : true; } -extern "C" void grpc_deadline_filter_init(void) { +void grpc_deadline_filter_init(void) { grpc_channel_init_register_stage( GRPC_CLIENT_DIRECT_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, maybe_add_deadline_filter, (void*)&grpc_client_deadline_filter); @@ -391,4 +391,4 @@ extern "C" void grpc_deadline_filter_init(void) { maybe_add_deadline_filter, (void*)&grpc_server_deadline_filter); } -extern "C" void grpc_deadline_filter_shutdown(void) {} +void grpc_deadline_filter_shutdown(void) {} diff --git a/src/core/ext/filters/deadline/deadline_filter.h b/src/core/ext/filters/deadline/deadline_filter.h index e665dc53ee3..6be9015ab9e 100644 --- a/src/core/ext/filters/deadline/deadline_filter.h +++ b/src/core/ext/filters/deadline/deadline_filter.h @@ -20,9 +20,7 @@ #include "src/core/lib/channel/channel_stack.h" #include "src/core/lib/iomgr/timer.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef enum grpc_deadline_timer_state { GRPC_DEADLINE_STATE_INITIAL, @@ -94,8 +92,6 @@ bool grpc_deadline_checking_enabled(const grpc_channel_args* args); extern const grpc_channel_filter grpc_client_deadline_filter; extern const grpc_channel_filter grpc_server_deadline_filter; -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_FILTERS_DEADLINE_DEADLINE_FILTER_H */ diff --git a/src/core/ext/filters/http/client/http_client_filter.h b/src/core/ext/filters/http/client/http_client_filter.h index 9ed8e769150..1237c0a3de1 100644 --- a/src/core/ext/filters/http/client/http_client_filter.h +++ b/src/core/ext/filters/http/client/http_client_filter.h @@ -20,9 +20,7 @@ #include "src/core/lib/channel/channel_stack.h" -#ifdef __cplusplus -extern "C" { -#endif + /* Processes metadata on the client side for HTTP2 transports */ extern const grpc_channel_filter grpc_http_client_filter; @@ -30,8 +28,6 @@ extern const grpc_channel_filter grpc_http_client_filter; /* Channel arg to determine maximum size of payload eligable for GET request */ #define GRPC_ARG_MAX_PAYLOAD_SIZE_FOR_GET "grpc.max_payload_size_for_get" -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_FILTERS_HTTP_CLIENT_HTTP_CLIENT_FILTER_H */ diff --git a/src/core/ext/filters/http/http_filters_plugin.cc b/src/core/ext/filters/http/http_filters_plugin.cc index 69dbde409c3..61d73edfc04 100644 --- a/src/core/ext/filters/http/http_filters_plugin.cc +++ b/src/core/ext/filters/http/http_filters_plugin.cc @@ -64,7 +64,7 @@ static bool maybe_add_required_filter(grpc_exec_ctx* exec_ctx, : true; } -extern "C" void grpc_http_filters_init(void) { +void grpc_http_filters_init(void) { grpc_register_tracer(&grpc_compression_trace); grpc_channel_init_register_stage(GRPC_CLIENT_SUBCHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, @@ -86,4 +86,4 @@ extern "C" void grpc_http_filters_init(void) { maybe_add_required_filter, (void*)&grpc_http_server_filter); } -extern "C" void grpc_http_filters_shutdown(void) {} +void grpc_http_filters_shutdown(void) {} diff --git a/src/core/ext/filters/http/message_compress/message_compress_filter.h b/src/core/ext/filters/http/message_compress/message_compress_filter.h index 79a2815655c..c76682f5b5b 100644 --- a/src/core/ext/filters/http/message_compress/message_compress_filter.h +++ b/src/core/ext/filters/http/message_compress/message_compress_filter.h @@ -23,9 +23,7 @@ #include "src/core/lib/channel/channel_stack.h" -#ifdef __cplusplus -extern "C" { -#endif + /** Compression filter for outgoing data. * @@ -51,9 +49,7 @@ extern "C" { extern const grpc_channel_filter grpc_message_compress_filter; -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_FILTERS_HTTP_MESSAGE_COMPRESS_MESSAGE_COMPRESS_FILTER_H \ */ diff --git a/src/core/ext/filters/http/server/http_server_filter.h b/src/core/ext/filters/http/server/http_server_filter.h index 4b38cc5bf76..2d724def18c 100644 --- a/src/core/ext/filters/http/server/http_server_filter.h +++ b/src/core/ext/filters/http/server/http_server_filter.h @@ -21,15 +21,11 @@ #include "src/core/lib/channel/channel_stack.h" -#ifdef __cplusplus -extern "C" { -#endif + /* Processes metadata on the client side for HTTP2 transports */ extern const grpc_channel_filter grpc_http_server_filter; -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_FILTERS_HTTP_SERVER_HTTP_SERVER_FILTER_H */ diff --git a/src/core/ext/filters/load_reporting/server_load_reporting_filter.h b/src/core/ext/filters/load_reporting/server_load_reporting_filter.h index 356f8b8e662..00e8e4c37f9 100644 --- a/src/core/ext/filters/load_reporting/server_load_reporting_filter.h +++ b/src/core/ext/filters/load_reporting/server_load_reporting_filter.h @@ -22,15 +22,11 @@ #include "src/core/ext/filters/load_reporting/server_load_reporting_plugin.h" #include "src/core/lib/channel/channel_stack.h" -#ifdef __cplusplus -extern "C" { -#endif + extern const grpc_channel_filter grpc_server_load_reporting_filter; -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_FILTERS_LOAD_REPORTING_SERVER_LOAD_REPORTING_FILTER_H \ */ diff --git a/src/core/ext/filters/load_reporting/server_load_reporting_plugin.cc b/src/core/ext/filters/load_reporting/server_load_reporting_plugin.cc index ab8387967ce..accb7797dd5 100644 --- a/src/core/ext/filters/load_reporting/server_load_reporting_plugin.cc +++ b/src/core/ext/filters/load_reporting/server_load_reporting_plugin.cc @@ -61,10 +61,10 @@ grpc_arg grpc_load_reporting_enable_arg() { /* Plugin registration */ -extern "C" void grpc_server_load_reporting_plugin_init(void) { +void grpc_server_load_reporting_plugin_init(void) { grpc_channel_init_register_stage(GRPC_SERVER_CHANNEL, INT_MAX, maybe_add_server_load_reporting_filter, (void*)&grpc_server_load_reporting_filter); } -extern "C" void grpc_server_load_reporting_plugin_shutdown() {} +void grpc_server_load_reporting_plugin_shutdown() {} diff --git a/src/core/ext/filters/load_reporting/server_load_reporting_plugin.h b/src/core/ext/filters/load_reporting/server_load_reporting_plugin.h index a6448ce97e1..af2bbfcc093 100644 --- a/src/core/ext/filters/load_reporting/server_load_reporting_plugin.h +++ b/src/core/ext/filters/load_reporting/server_load_reporting_plugin.h @@ -23,9 +23,7 @@ #include "src/core/lib/channel/channel_stack.h" -#ifdef __cplusplus -extern "C" { -#endif + /** Identifiers for the invocation point of the users LR callback */ typedef enum grpc_load_reporting_source { @@ -59,9 +57,7 @@ typedef struct grpc_load_reporting_call_data { /** Return a \a grpc_arg enabling load reporting */ grpc_arg grpc_load_reporting_enable_arg(); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_FILTERS_LOAD_REPORTING_SERVER_LOAD_REPORTING_PLUGIN_H \ */ diff --git a/src/core/ext/filters/max_age/max_age_filter.cc b/src/core/ext/filters/max_age/max_age_filter.cc index 001f9f39062..89c17ae5014 100644 --- a/src/core/ext/filters/max_age/max_age_filter.cc +++ b/src/core/ext/filters/max_age/max_age_filter.cc @@ -404,10 +404,10 @@ static bool maybe_add_max_age_filter(grpc_exec_ctx* exec_ctx, } } -extern "C" void grpc_max_age_filter_init(void) { +void grpc_max_age_filter_init(void) { grpc_channel_init_register_stage(GRPC_SERVER_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, maybe_add_max_age_filter, nullptr); } -extern "C" void grpc_max_age_filter_shutdown(void) {} +void grpc_max_age_filter_shutdown(void) {} diff --git a/src/core/ext/filters/max_age/max_age_filter.h b/src/core/ext/filters/max_age/max_age_filter.h index eeeefd695e2..e0885982773 100644 --- a/src/core/ext/filters/max_age/max_age_filter.h +++ b/src/core/ext/filters/max_age/max_age_filter.h @@ -19,14 +19,10 @@ #include "src/core/lib/channel/channel_stack.h" -#ifdef __cplusplus -extern "C" { -#endif + extern const grpc_channel_filter grpc_max_age_filter; -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_FILTERS_MAX_AGE_MAX_AGE_FILTER_H */ diff --git a/src/core/ext/filters/message_size/message_size_filter.cc b/src/core/ext/filters/message_size/message_size_filter.cc index 2e81d099613..3d2252af2e6 100644 --- a/src/core/ext/filters/message_size/message_size_filter.cc +++ b/src/core/ext/filters/message_size/message_size_filter.cc @@ -310,7 +310,7 @@ static bool maybe_add_message_size_filter(grpc_exec_ctx* exec_ctx, } } -extern "C" void grpc_message_size_filter_init(void) { +void grpc_message_size_filter_init(void) { grpc_channel_init_register_stage(GRPC_CLIENT_SUBCHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, maybe_add_message_size_filter, nullptr); @@ -322,4 +322,4 @@ extern "C" void grpc_message_size_filter_init(void) { maybe_add_message_size_filter, nullptr); } -extern "C" void grpc_message_size_filter_shutdown(void) {} +void grpc_message_size_filter_shutdown(void) {} diff --git a/src/core/ext/filters/message_size/message_size_filter.h b/src/core/ext/filters/message_size/message_size_filter.h index da325d6f890..7c170fa7e1b 100644 --- a/src/core/ext/filters/message_size/message_size_filter.h +++ b/src/core/ext/filters/message_size/message_size_filter.h @@ -19,14 +19,10 @@ #include "src/core/lib/channel/channel_stack.h" -#ifdef __cplusplus -extern "C" { -#endif + extern const grpc_channel_filter grpc_message_size_filter; -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_FILTERS_MESSAGE_SIZE_MESSAGE_SIZE_FILTER_H */ diff --git a/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc b/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc index 6bbb4d57398..f26cac26a44 100644 --- a/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc +++ b/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc @@ -196,7 +196,7 @@ static bool register_workaround_cronet_compression( builder, &grpc_workaround_cronet_compression_filter, nullptr, nullptr); } -extern "C" void grpc_workaround_cronet_compression_filter_init(void) { +void grpc_workaround_cronet_compression_filter_init(void) { grpc_channel_init_register_stage( GRPC_SERVER_CHANNEL, GRPC_WORKAROUND_PRIORITY_HIGH, register_workaround_cronet_compression, nullptr); @@ -204,4 +204,4 @@ extern "C" void grpc_workaround_cronet_compression_filter_init(void) { parse_user_agent); } -extern "C" void grpc_workaround_cronet_compression_filter_shutdown(void) {} +void grpc_workaround_cronet_compression_filter_shutdown(void) {} diff --git a/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h b/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h index c8b07df63ec..38a88cb6318 100644 --- a/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h +++ b/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h @@ -19,15 +19,11 @@ #include "src/core/lib/channel/channel_stack.h" -#ifdef __cplusplus -extern "C" { -#endif + extern const grpc_channel_filter grpc_workaround_cronet_compression_filter; -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_FILTERS_WORKAROUNDS_WORKAROUND_CRONET_COMPRESSION_FILTER_H \ */ diff --git a/src/core/ext/filters/workarounds/workaround_utils.h b/src/core/ext/filters/workarounds/workaround_utils.h index a954ad40014..4267b486c1c 100644 --- a/src/core/ext/filters/workarounds/workaround_utils.h +++ b/src/core/ext/filters/workarounds/workaround_utils.h @@ -24,9 +24,7 @@ #define GRPC_WORKAROUND_PRIORITY_HIGH 10001 #define GRPC_WORKAROUND_PROIRITY_LOW 9999 -#ifdef __cplusplus -extern "C" { -#endif + typedef struct grpc_workaround_user_agent_md { bool workaround_active[GRPC_MAX_WORKAROUND_ID]; @@ -38,8 +36,6 @@ typedef bool (*user_agent_parser)(grpc_mdelem); void grpc_register_workaround(uint32_t id, user_agent_parser parser); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_FILTERS_WORKAROUNDS_WORKAROUND_UTILS_H */ diff --git a/src/core/ext/transport/chttp2/alpn/alpn.h b/src/core/ext/transport/chttp2/alpn/alpn.h index 4a420e83e07..8f13ebdfc22 100644 --- a/src/core/ext/transport/chttp2/alpn/alpn.h +++ b/src/core/ext/transport/chttp2/alpn/alpn.h @@ -21,9 +21,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + /* Retuns 1 if the version is supported, 0 otherwise. */ int grpc_chttp2_is_alpn_version_supported(const char* version, size_t size); @@ -35,8 +33,6 @@ size_t grpc_chttp2_num_alpn_versions(void); * grpc_chttp2_num_alpn_versions()) */ const char* grpc_chttp2_get_alpn_version_index(size_t i); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_ALPN_ALPN_H */ diff --git a/src/core/ext/transport/chttp2/client/chttp2_connector.h b/src/core/ext/transport/chttp2/client/chttp2_connector.h index 63f264e0efa..dc8f26cc0a0 100644 --- a/src/core/ext/transport/chttp2/client/chttp2_connector.h +++ b/src/core/ext/transport/chttp2/client/chttp2_connector.h @@ -19,16 +19,12 @@ #ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_CLIENT_CHTTP2_CONNECTOR_H #define GRPC_CORE_EXT_TRANSPORT_CHTTP2_CLIENT_CHTTP2_CONNECTOR_H -#ifdef __cplusplus -extern "C" { -#endif + #include "src/core/ext/filters/client_channel/connector.h" grpc_connector* grpc_chttp2_connector_create(); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_CLIENT_CHTTP2_CONNECTOR_H */ diff --git a/src/core/ext/transport/chttp2/server/chttp2_server.h b/src/core/ext/transport/chttp2/server/chttp2_server.h index 4e0e7aa6175..ed798d243d3 100644 --- a/src/core/ext/transport/chttp2/server/chttp2_server.h +++ b/src/core/ext/transport/chttp2/server/chttp2_server.h @@ -23,9 +23,7 @@ #include "src/core/lib/iomgr/exec_ctx.h" -#ifdef __cplusplus -extern "C" { -#endif + /// Adds a port to \a server. Sets \a port_num to the port number. /// Takes ownership of \a args. @@ -33,8 +31,6 @@ grpc_error* grpc_chttp2_server_add_port(grpc_exec_ctx* exec_ctx, grpc_server* server, const char* addr, grpc_channel_args* args, int* port_num); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_SERVER_CHTTP2_SERVER_H */ diff --git a/src/core/ext/transport/chttp2/transport/bin_decoder.h b/src/core/ext/transport/chttp2/transport/bin_decoder.h index a9c4c9a0f6c..33cff858357 100644 --- a/src/core/ext/transport/chttp2/transport/bin_decoder.h +++ b/src/core/ext/transport/chttp2/transport/bin_decoder.h @@ -22,9 +22,7 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif + struct grpc_base64_decode_context { /* input/output: */ @@ -53,8 +51,6 @@ grpc_slice grpc_chttp2_base64_decode_with_length(grpc_exec_ctx* exec_ctx, grpc_slice input, size_t output_length); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_DECODER_H */ diff --git a/src/core/ext/transport/chttp2/transport/bin_encoder.h b/src/core/ext/transport/chttp2/transport/bin_encoder.h index 0be3633354e..620a6e50d81 100644 --- a/src/core/ext/transport/chttp2/transport/bin_encoder.h +++ b/src/core/ext/transport/chttp2/transport/bin_encoder.h @@ -21,9 +21,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + /* base64 encode a slice. Returns a new slice, does not take ownership of the input */ @@ -40,8 +38,6 @@ grpc_slice grpc_chttp2_huffman_compress(grpc_slice input); return y; */ grpc_slice grpc_chttp2_base64_encode_and_huffman_compress(grpc_slice input); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_ENCODER_H */ diff --git a/src/core/ext/transport/chttp2/transport/chttp2_plugin.cc b/src/core/ext/transport/chttp2/transport/chttp2_plugin.cc index ac9ae5c395f..6d09953830c 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_plugin.cc +++ b/src/core/ext/transport/chttp2/transport/chttp2_plugin.cc @@ -20,7 +20,7 @@ #include "src/core/lib/debug/trace.h" #include "src/core/lib/transport/metadata.h" -extern "C" void grpc_chttp2_plugin_init(void) { +void grpc_chttp2_plugin_init(void) { grpc_register_tracer(&grpc_http_trace); grpc_register_tracer(&grpc_flowctl_trace); grpc_register_tracer(&grpc_trace_http2_stream_state); @@ -29,4 +29,4 @@ extern "C" void grpc_chttp2_plugin_init(void) { #endif } -extern "C" void grpc_chttp2_plugin_shutdown(void) {} +void grpc_chttp2_plugin_shutdown(void) {} diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.h b/src/core/ext/transport/chttp2/transport/chttp2_transport.h index 972104f62c6..2b2c82af4d4 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.h +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.h @@ -23,9 +23,7 @@ #include "src/core/lib/iomgr/endpoint.h" #include "src/core/lib/transport/transport.h" -#ifdef __cplusplus -extern "C" { -#endif + extern grpc_tracer_flag grpc_http_trace; extern grpc_tracer_flag grpc_flowctl_trace; @@ -45,8 +43,6 @@ void grpc_chttp2_transport_start_reading(grpc_exec_ctx* exec_ctx, grpc_transport* transport, grpc_slice_buffer* read_buffer); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_CHTTP2_TRANSPORT_H */ diff --git a/src/core/ext/transport/chttp2/transport/flow_control.h b/src/core/ext/transport/chttp2/transport/flow_control.h index 7dd348ed5f1..46d00a10327 100644 --- a/src/core/ext/transport/chttp2/transport/flow_control.h +++ b/src/core/ext/transport/chttp2/transport/flow_control.h @@ -30,7 +30,7 @@ struct grpc_chttp2_transport; struct grpc_chttp2_stream; -extern "C" grpc_tracer_flag grpc_flowctl_trace; +extern grpc_tracer_flag grpc_flowctl_trace; namespace grpc { namespace testing { diff --git a/src/core/ext/transport/chttp2/transport/frame.h b/src/core/ext/transport/chttp2/transport/frame.h index e7debdad79a..404ee2fee45 100644 --- a/src/core/ext/transport/chttp2/transport/frame.h +++ b/src/core/ext/transport/chttp2/transport/frame.h @@ -24,9 +24,7 @@ #include "src/core/lib/iomgr/error.h" -#ifdef __cplusplus -extern "C" { -#endif + /* defined in internal.h */ typedef struct grpc_chttp2_stream grpc_chttp2_stream; @@ -47,8 +45,6 @@ typedef struct grpc_chttp2_transport grpc_chttp2_transport; #define GRPC_CHTTP2_DATA_FLAG_PADDED 8 #define GRPC_CHTTP2_FLAG_HAS_PRIORITY 0x20 -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_H */ diff --git a/src/core/ext/transport/chttp2/transport/frame_data.h b/src/core/ext/transport/chttp2/transport/frame_data.h index 96f823a0ad1..217927799ac 100644 --- a/src/core/ext/transport/chttp2/transport/frame_data.h +++ b/src/core/ext/transport/chttp2/transport/frame_data.h @@ -28,9 +28,7 @@ #include "src/core/lib/transport/byte_stream.h" #include "src/core/lib/transport/transport.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef enum { GRPC_CHTTP2_DATA_FH_0, @@ -84,8 +82,6 @@ grpc_error* grpc_deframe_unprocessed_incoming_frames( grpc_slice_buffer* slices, grpc_slice* slice_out, grpc_byte_stream** stream_out); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_DATA_H */ diff --git a/src/core/ext/transport/chttp2/transport/frame_goaway.h b/src/core/ext/transport/chttp2/transport/frame_goaway.h index 9790d0b08d0..b3c910f5ea9 100644 --- a/src/core/ext/transport/chttp2/transport/frame_goaway.h +++ b/src/core/ext/transport/chttp2/transport/frame_goaway.h @@ -25,9 +25,7 @@ #include "src/core/ext/transport/chttp2/transport/frame.h" #include "src/core/lib/iomgr/exec_ctx.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef enum { GRPC_CHTTP2_GOAWAY_LSI0, @@ -64,8 +62,6 @@ void grpc_chttp2_goaway_append(uint32_t last_stream_id, uint32_t error_code, grpc_slice debug_data, grpc_slice_buffer* slice_buffer); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_GOAWAY_H */ diff --git a/src/core/ext/transport/chttp2/transport/frame_ping.h b/src/core/ext/transport/chttp2/transport/frame_ping.h index 034aad002e2..0767182e09f 100644 --- a/src/core/ext/transport/chttp2/transport/frame_ping.h +++ b/src/core/ext/transport/chttp2/transport/frame_ping.h @@ -23,9 +23,7 @@ #include "src/core/ext/transport/chttp2/transport/frame.h" #include "src/core/lib/iomgr/exec_ctx.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef struct { uint8_t byte; @@ -45,8 +43,6 @@ grpc_error* grpc_chttp2_ping_parser_parse(grpc_exec_ctx* exec_ctx, void* parser, /* Test-only function for disabling ping ack */ void grpc_set_disable_ping_ack(bool disable_ping_ack); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_PING_H */ diff --git a/src/core/ext/transport/chttp2/transport/frame_rst_stream.h b/src/core/ext/transport/chttp2/transport/frame_rst_stream.h index 3f5417e9935..dd98c04b6af 100644 --- a/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +++ b/src/core/ext/transport/chttp2/transport/frame_rst_stream.h @@ -24,9 +24,7 @@ #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/transport/transport.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef struct { uint8_t byte; @@ -44,8 +42,6 @@ grpc_error* grpc_chttp2_rst_stream_parser_parse(grpc_exec_ctx* exec_ctx, grpc_chttp2_stream* s, grpc_slice slice, int is_last); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_RST_STREAM_H */ diff --git a/src/core/ext/transport/chttp2/transport/frame_settings.h b/src/core/ext/transport/chttp2/transport/frame_settings.h index 18bde928153..52b4ef1924a 100644 --- a/src/core/ext/transport/chttp2/transport/frame_settings.h +++ b/src/core/ext/transport/chttp2/transport/frame_settings.h @@ -25,9 +25,7 @@ #include "src/core/ext/transport/chttp2/transport/http2_settings.h" #include "src/core/lib/iomgr/exec_ctx.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef enum { GRPC_CHTTP2_SPS_ID0, @@ -62,8 +60,6 @@ grpc_error* grpc_chttp2_settings_parser_parse(grpc_exec_ctx* exec_ctx, grpc_chttp2_stream* s, grpc_slice slice, int is_last); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_SETTINGS_H */ diff --git a/src/core/ext/transport/chttp2/transport/frame_window_update.h b/src/core/ext/transport/chttp2/transport/frame_window_update.h index daf7d2da6b8..1b7e061c8b4 100644 --- a/src/core/ext/transport/chttp2/transport/frame_window_update.h +++ b/src/core/ext/transport/chttp2/transport/frame_window_update.h @@ -24,9 +24,7 @@ #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/transport/transport.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef struct { uint8_t byte; @@ -43,8 +41,6 @@ grpc_error* grpc_chttp2_window_update_parser_parse( grpc_exec_ctx* exec_ctx, void* parser, grpc_chttp2_transport* t, grpc_chttp2_stream* s, grpc_slice slice, int is_last); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_WINDOW_UPDATE_H */ diff --git a/src/core/ext/transport/chttp2/transport/hpack_encoder.h b/src/core/ext/transport/chttp2/transport/hpack_encoder.h index fd01d1621ab..0e11f99fd02 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_encoder.h +++ b/src/core/ext/transport/chttp2/transport/hpack_encoder.h @@ -34,9 +34,7 @@ /* maximum table size we'll actually use */ #define GRPC_CHTTP2_HPACKC_MAX_TABLE_SIZE (1024 * 1024) -#ifdef __cplusplus -extern "C" { -#endif + typedef struct { uint32_t filter_elems_sum; @@ -95,8 +93,6 @@ void grpc_chttp2_encode_header(grpc_exec_ctx* exec_ctx, const grpc_encode_header_options* options, grpc_slice_buffer* outbuf); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_ENCODER_H */ diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser.h b/src/core/ext/transport/chttp2/transport/hpack_parser.h index 838c482e4a2..452165e8d00 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_parser.h +++ b/src/core/ext/transport/chttp2/transport/hpack_parser.h @@ -27,9 +27,7 @@ #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/transport/metadata.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef struct grpc_chttp2_hpack_parser grpc_chttp2_hpack_parser; @@ -115,8 +113,6 @@ grpc_error* grpc_chttp2_header_parser_parse(grpc_exec_ctx* exec_ctx, grpc_chttp2_stream* s, grpc_slice slice, int is_last); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_PARSER_H */ diff --git a/src/core/ext/transport/chttp2/transport/hpack_table.h b/src/core/ext/transport/chttp2/transport/hpack_table.h index ddc8888f864..0e41dbeea5d 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_table.h +++ b/src/core/ext/transport/chttp2/transport/hpack_table.h @@ -24,9 +24,7 @@ #include "src/core/lib/iomgr/error.h" #include "src/core/lib/transport/metadata.h" -#ifdef __cplusplus -extern "C" { -#endif + /* HPACK header table */ @@ -98,8 +96,6 @@ typedef struct { grpc_chttp2_hptbl_find_result grpc_chttp2_hptbl_find( const grpc_chttp2_hptbl* tbl, grpc_mdelem md); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_TABLE_H */ diff --git a/src/core/ext/transport/chttp2/transport/http2_settings.h b/src/core/ext/transport/chttp2/transport/http2_settings.h index 86069b498bd..baac528c9a0 100644 --- a/src/core/ext/transport/chttp2/transport/http2_settings.h +++ b/src/core/ext/transport/chttp2/transport/http2_settings.h @@ -36,9 +36,7 @@ typedef enum { #define GRPC_CHTTP2_NUM_SETTINGS 7 -#ifdef __cplusplus -extern "C" { -#endif + extern const uint16_t grpc_setting_id_to_wire_id[]; bool grpc_wire_id_to_setting_id(uint32_t wire_id, grpc_chttp2_setting_id* out); @@ -60,8 +58,6 @@ typedef struct { extern const grpc_chttp2_setting_parameters grpc_chttp2_settings_parameters[GRPC_CHTTP2_NUM_SETTINGS]; -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HTTP2_SETTINGS_H */ diff --git a/src/core/ext/transport/chttp2/transport/huffsyms.h b/src/core/ext/transport/chttp2/transport/huffsyms.h index 4002706bc0f..7014fb60c46 100644 --- a/src/core/ext/transport/chttp2/transport/huffsyms.h +++ b/src/core/ext/transport/chttp2/transport/huffsyms.h @@ -19,9 +19,7 @@ #ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HUFFSYMS_H #define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HUFFSYMS_H -#ifdef __cplusplus -extern "C" { -#endif + /* HPACK static huffman table */ @@ -34,8 +32,6 @@ typedef struct { extern const grpc_chttp2_huffsym grpc_chttp2_huffsyms[GRPC_CHTTP2_NUM_HUFFSYMS]; -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HUFFSYMS_H */ diff --git a/src/core/ext/transport/chttp2/transport/incoming_metadata.h b/src/core/ext/transport/chttp2/transport/incoming_metadata.h index 7ccb4a01266..9dbf8987d16 100644 --- a/src/core/ext/transport/chttp2/transport/incoming_metadata.h +++ b/src/core/ext/transport/chttp2/transport/incoming_metadata.h @@ -21,9 +21,7 @@ #include "src/core/lib/transport/transport.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef struct { gpr_arena* arena; @@ -49,8 +47,6 @@ grpc_error* grpc_chttp2_incoming_metadata_buffer_replace_or_add( void grpc_chttp2_incoming_metadata_buffer_set_deadline( grpc_chttp2_incoming_metadata_buffer* buffer, grpc_millis deadline); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_INCOMING_METADATA_H */ diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index 60cc280c431..c579b6be6bb 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -42,9 +42,7 @@ #include "src/core/lib/transport/connectivity_state.h" #include "src/core/lib/transport/transport_impl.h" -#ifdef __cplusplus -extern "C" { -#endif + /* streams are kept in various linked lists depending on what things need to happen to them... this enum labels each list */ @@ -778,8 +776,6 @@ void grpc_chttp2_fail_pending_writes(grpc_exec_ctx* exec_ctx, void grpc_chttp2_config_default_keepalive_args(grpc_channel_args* args, bool is_client); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_INTERNAL_H */ diff --git a/src/core/ext/transport/chttp2/transport/stream_map.h b/src/core/ext/transport/chttp2/transport/stream_map.h index c89d20047c4..37b71a30435 100644 --- a/src/core/ext/transport/chttp2/transport/stream_map.h +++ b/src/core/ext/transport/chttp2/transport/stream_map.h @@ -23,9 +23,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + /* Data structure to map a uint32_t to a data object (represented by a void*) @@ -69,8 +67,6 @@ void grpc_chttp2_stream_map_for_each(grpc_chttp2_stream_map* map, void* value), void* user_data); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_STREAM_MAP_H */ diff --git a/src/core/ext/transport/chttp2/transport/varint.h b/src/core/ext/transport/chttp2/transport/varint.h index d3a9d902c42..4da8aa5bd96 100644 --- a/src/core/ext/transport/chttp2/transport/varint.h +++ b/src/core/ext/transport/chttp2/transport/varint.h @@ -21,9 +21,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + /* Helpers for hpack varint encoding */ @@ -61,8 +59,6 @@ void grpc_chttp2_hpack_write_varint_tail(uint32_t tail_value, uint8_t* target, } \ } while (0) -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_VARINT_H */ diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.h b/src/core/ext/transport/cronet/transport/cronet_transport.h index 7643fdb585e..699818904e9 100644 --- a/src/core/ext/transport/cronet/transport/cronet_transport.h +++ b/src/core/ext/transport/cronet/transport/cronet_transport.h @@ -21,16 +21,12 @@ #include "src/core/lib/transport/transport.h" -#ifdef __cplusplus -extern "C" { -#endif + grpc_transport* grpc_create_cronet_transport(void* engine, const char* target, const grpc_channel_args* args, void* reserved); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_TRANSPORT_CRONET_TRANSPORT_CRONET_TRANSPORT_H */ diff --git a/src/core/ext/transport/inproc/inproc_plugin.cc b/src/core/ext/transport/inproc/inproc_plugin.cc index 5d8a1c74abd..74451b32345 100644 --- a/src/core/ext/transport/inproc/inproc_plugin.cc +++ b/src/core/ext/transport/inproc/inproc_plugin.cc @@ -21,11 +21,11 @@ grpc_tracer_flag grpc_inproc_trace = GRPC_TRACER_INITIALIZER(false, "inproc"); -extern "C" void grpc_inproc_plugin_init(void) { +void grpc_inproc_plugin_init(void) { grpc_register_tracer(&grpc_inproc_trace); grpc_inproc_transport_init(); } -extern "C" void grpc_inproc_plugin_shutdown(void) { +void grpc_inproc_plugin_shutdown(void) { grpc_inproc_transport_shutdown(); } diff --git a/src/core/ext/transport/inproc/inproc_transport.h b/src/core/ext/transport/inproc/inproc_transport.h index 6e83af3b4cc..74cba41afd1 100644 --- a/src/core/ext/transport/inproc/inproc_transport.h +++ b/src/core/ext/transport/inproc/inproc_transport.h @@ -21,9 +21,7 @@ #include "src/core/lib/transport/transport_impl.h" -#ifdef __cplusplus -extern "C" { -#endif + grpc_channel* grpc_inproc_channel_create(grpc_server* server, grpc_channel_args* args, @@ -34,8 +32,6 @@ extern grpc_tracer_flag grpc_inproc_trace; void grpc_inproc_transport_init(void); void grpc_inproc_transport_shutdown(void); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_EXT_TRANSPORT_INPROC_INPROC_TRANSPORT_H */ diff --git a/src/core/lib/backoff/backoff.h b/src/core/lib/backoff/backoff.h index 1067281403a..e59c343d599 100644 --- a/src/core/lib/backoff/backoff.h +++ b/src/core/lib/backoff/backoff.h @@ -21,9 +21,7 @@ #include "src/core/lib/iomgr/exec_ctx.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef struct { /// const: how long to wait after the first failure before retrying @@ -76,8 +74,6 @@ grpc_backoff_result grpc_backoff_step(grpc_exec_ctx* exec_ctx, /// grpc_backoff_begin. void grpc_backoff_reset(grpc_backoff* backoff); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_BACKOFF_BACKOFF_H */ diff --git a/src/core/lib/channel/channel_args.h b/src/core/lib/channel/channel_args.h index d36761da573..7f8305dae3b 100644 --- a/src/core/lib/channel/channel_args.h +++ b/src/core/lib/channel/channel_args.h @@ -23,9 +23,7 @@ #include #include "src/core/lib/iomgr/socket_mutator.h" -#ifdef __cplusplus -extern "C" { -#endif + // Channel args are intentionally immutable, to avoid the need for locking. @@ -153,8 +151,6 @@ grpc_arg grpc_channel_arg_integer_create(char* name, int value); grpc_arg grpc_channel_arg_pointer_create(char* name, void* value, const grpc_arg_pointer_vtable* vtable); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_CHANNEL_CHANNEL_ARGS_H */ diff --git a/src/core/lib/channel/channel_stack.h b/src/core/lib/channel/channel_stack.h index aa993112a02..478a03ee732 100644 --- a/src/core/lib/channel/channel_stack.h +++ b/src/core/lib/channel/channel_stack.h @@ -45,9 +45,7 @@ #include "src/core/lib/support/arena.h" #include "src/core/lib/transport/transport.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef struct grpc_channel_element grpc_channel_element; typedef struct grpc_call_element grpc_call_element; @@ -290,8 +288,6 @@ extern grpc_tracer_flag grpc_trace_channel; #define GRPC_CALL_LOG_OP(sev, elem, op) \ if (GRPC_TRACER_ON(grpc_trace_channel)) grpc_call_log_op(sev, elem, op) -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_CHANNEL_CHANNEL_STACK_H */ diff --git a/src/core/lib/channel/channel_stack_builder.h b/src/core/lib/channel/channel_stack_builder.h index 23134b7d10f..4f5e1dc7d51 100644 --- a/src/core/lib/channel/channel_stack_builder.h +++ b/src/core/lib/channel/channel_stack_builder.h @@ -24,9 +24,7 @@ #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_stack.h" -#ifdef __cplusplus -extern "C" { -#endif + /// grpc_channel_stack_builder offers a programmatic interface to selected /// and order channel filters @@ -162,8 +160,6 @@ void grpc_channel_stack_builder_destroy(grpc_exec_ctx* exec_ctx, extern grpc_tracer_flag grpc_trace_channel_stack_builder; -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_CHANNEL_CHANNEL_STACK_BUILDER_H */ diff --git a/src/core/lib/channel/connected_channel.h b/src/core/lib/channel/connected_channel.h index cca19737dce..6807049ea39 100644 --- a/src/core/lib/channel/connected_channel.h +++ b/src/core/lib/channel/connected_channel.h @@ -21,9 +21,7 @@ #include "src/core/lib/channel/channel_stack_builder.h" -#ifdef __cplusplus -extern "C" { -#endif + extern const grpc_channel_filter grpc_connected_filter; @@ -34,8 +32,6 @@ bool grpc_add_connected_filter(grpc_exec_ctx* exec_ctx, /* Debug helper to dig the transport stream out of a call element */ grpc_stream* grpc_connected_channel_get_stream(grpc_call_element* elem); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_CHANNEL_CONNECTED_CHANNEL_H */ diff --git a/src/core/lib/channel/handshaker.h b/src/core/lib/channel/handshaker.h index 8ed38c15ba1..6f7b01bc5dc 100644 --- a/src/core/lib/channel/handshaker.h +++ b/src/core/lib/channel/handshaker.h @@ -26,9 +26,7 @@ #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/tcp_server.h" -#ifdef __cplusplus -extern "C" { -#endif + /// Handshakers are used to perform initial handshakes on a connection /// before the client sends the initial request. Some examples of what @@ -168,8 +166,6 @@ void grpc_handshake_manager_pending_list_remove(grpc_handshake_manager** head, void grpc_handshake_manager_pending_list_shutdown_all( grpc_exec_ctx* exec_ctx, grpc_handshake_manager* head, grpc_error* why); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_CHANNEL_HANDSHAKER_H */ diff --git a/src/core/lib/channel/handshaker_factory.h b/src/core/lib/channel/handshaker_factory.h index 63d9b5af72a..79e22c59b21 100644 --- a/src/core/lib/channel/handshaker_factory.h +++ b/src/core/lib/channel/handshaker_factory.h @@ -24,9 +24,7 @@ #include "src/core/lib/channel/handshaker.h" #include "src/core/lib/iomgr/exec_ctx.h" -#ifdef __cplusplus -extern "C" { -#endif + // A handshaker factory is used to create handshakers. @@ -52,8 +50,6 @@ void grpc_handshaker_factory_add_handshakers( void grpc_handshaker_factory_destroy( grpc_exec_ctx* exec_ctx, grpc_handshaker_factory* handshaker_factory); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_CHANNEL_HANDSHAKER_FACTORY_H */ diff --git a/src/core/lib/channel/handshaker_registry.h b/src/core/lib/channel/handshaker_registry.h index ddd280bea8a..5c503ec8834 100644 --- a/src/core/lib/channel/handshaker_registry.h +++ b/src/core/lib/channel/handshaker_registry.h @@ -24,9 +24,7 @@ #include "src/core/lib/channel/handshaker_factory.h" #include "src/core/lib/iomgr/exec_ctx.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef enum { HANDSHAKER_CLIENT = 0, @@ -49,8 +47,6 @@ void grpc_handshakers_add(grpc_exec_ctx* exec_ctx, const grpc_channel_args* args, grpc_handshake_manager* handshake_mgr); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_CHANNEL_HANDSHAKER_REGISTRY_H */ diff --git a/src/core/lib/compression/algorithm_metadata.h b/src/core/lib/compression/algorithm_metadata.h index 17caf58f69c..7e32fe14372 100644 --- a/src/core/lib/compression/algorithm_metadata.h +++ b/src/core/lib/compression/algorithm_metadata.h @@ -22,9 +22,7 @@ #include #include "src/core/lib/transport/metadata.h" -#ifdef __cplusplus -extern "C" { -#endif + /** Return compression algorithm based metadata value */ grpc_slice grpc_compression_algorithm_slice( @@ -53,8 +51,6 @@ grpc_compression_algorithm grpc_compression_algorithm_from_slice( grpc_stream_compression_algorithm grpc_stream_compression_algorithm_from_slice( grpc_slice str); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_COMPRESSION_ALGORITHM_METADATA_H */ diff --git a/src/core/lib/compression/message_compress.h b/src/core/lib/compression/message_compress.h index fffe175fd22..137e45431c8 100644 --- a/src/core/lib/compression/message_compress.h +++ b/src/core/lib/compression/message_compress.h @@ -22,9 +22,7 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif + /* compress 'input' to 'output' using 'algorithm'. On success, appends compressed slices to output and returns 1. @@ -40,8 +38,6 @@ int grpc_msg_decompress(grpc_exec_ctx* exec_ctx, grpc_compression_algorithm algorithm, grpc_slice_buffer* input, grpc_slice_buffer* output); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_COMPRESSION_MESSAGE_COMPRESS_H */ diff --git a/src/core/lib/compression/stream_compression.h b/src/core/lib/compression/stream_compression.h index b56c142543d..8d4f0e725d4 100644 --- a/src/core/lib/compression/stream_compression.h +++ b/src/core/lib/compression/stream_compression.h @@ -26,9 +26,7 @@ #include "src/core/lib/transport/static_metadata.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef struct grpc_stream_compression_vtable grpc_stream_compression_vtable; @@ -115,8 +113,6 @@ void grpc_stream_compression_context_destroy( int grpc_stream_compression_method_parse( grpc_slice value, bool is_compress, grpc_stream_compression_method* method); -#ifdef __cplusplus -} -#endif + #endif diff --git a/src/core/lib/compression/stream_compression_gzip.h b/src/core/lib/compression/stream_compression_gzip.h index a3f1b0406fe..735543f3f99 100644 --- a/src/core/lib/compression/stream_compression_gzip.h +++ b/src/core/lib/compression/stream_compression_gzip.h @@ -21,14 +21,10 @@ #include "src/core/lib/compression/stream_compression.h" -#ifdef __cplusplus -extern "C" { -#endif + extern const grpc_stream_compression_vtable grpc_stream_compression_gzip_vtable; -#ifdef __cplusplus -} -#endif + #endif diff --git a/src/core/lib/compression/stream_compression_identity.h b/src/core/lib/compression/stream_compression_identity.h index 3a729fafad8..9f1166724b6 100644 --- a/src/core/lib/compression/stream_compression_identity.h +++ b/src/core/lib/compression/stream_compression_identity.h @@ -21,15 +21,11 @@ #include "src/core/lib/compression/stream_compression.h" -#ifdef __cplusplus -extern "C" { -#endif + extern const grpc_stream_compression_vtable grpc_stream_compression_identity_vtable; -#ifdef __cplusplus -} -#endif + #endif diff --git a/src/core/lib/debug/stats.h b/src/core/lib/debug/stats.h index 1c19e723455..1a3a9c5384c 100644 --- a/src/core/lib/debug/stats.h +++ b/src/core/lib/debug/stats.h @@ -23,9 +23,7 @@ #include "src/core/lib/debug/stats_data.h" #include "src/core/lib/iomgr/exec_ctx.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef struct grpc_stats_data { gpr_atm counters[GRPC_STATS_COUNTER_COUNT]; @@ -62,8 +60,6 @@ double grpc_stats_histo_percentile(const grpc_stats_data* data, size_t grpc_stats_histo_count(const grpc_stats_data* data, grpc_stats_histograms histogram); -#ifdef __cplusplus -} -#endif + #endif diff --git a/src/core/lib/debug/stats_data.h b/src/core/lib/debug/stats_data.h index fbfcce83ba3..7bd6ccff6fb 100644 --- a/src/core/lib/debug/stats_data.h +++ b/src/core/lib/debug/stats_data.h @@ -24,9 +24,7 @@ #include #include "src/core/lib/iomgr/exec_ctx.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef enum { GRPC_STATS_COUNTER_CLIENT_CALLS_CREATED, @@ -502,8 +500,6 @@ extern const int* const grpc_stats_histo_bucket_boundaries[13]; extern void (*const grpc_stats_inc_histogram[13])(grpc_exec_ctx* exec_ctx, int x); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_DEBUG_STATS_DATA_H */ diff --git a/src/core/lib/debug/trace.h b/src/core/lib/debug/trace.h index 7447d5d94af..237793eeb3e 100644 --- a/src/core/lib/debug/trace.h +++ b/src/core/lib/debug/trace.h @@ -23,9 +23,7 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif + #if defined(__has_feature) #if __has_feature(thread_sanitizer) @@ -56,8 +54,6 @@ void grpc_register_tracer(grpc_tracer_flag* flag); void grpc_tracer_init(const char* env_var_name); void grpc_tracer_shutdown(void); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_DEBUG_TRACE_H */ diff --git a/src/core/lib/http/format_request.h b/src/core/lib/http/format_request.h index 32054805b4d..65be293f1bd 100644 --- a/src/core/lib/http/format_request.h +++ b/src/core/lib/http/format_request.h @@ -22,9 +22,7 @@ #include #include "src/core/lib/http/httpcli.h" -#ifdef __cplusplus -extern "C" { -#endif + grpc_slice grpc_httpcli_format_get_request(const grpc_httpcli_request* request); grpc_slice grpc_httpcli_format_post_request(const grpc_httpcli_request* request, @@ -33,8 +31,6 @@ grpc_slice grpc_httpcli_format_post_request(const grpc_httpcli_request* request, grpc_slice grpc_httpcli_format_connect_request( const grpc_httpcli_request* request); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_HTTP_FORMAT_REQUEST_H */ diff --git a/src/core/lib/http/httpcli.h b/src/core/lib/http/httpcli.h index a3411341ad3..d1027b82c38 100644 --- a/src/core/lib/http/httpcli.h +++ b/src/core/lib/http/httpcli.h @@ -32,9 +32,7 @@ /* User agent this library reports */ #define GRPC_HTTPCLI_USER_AGENT "grpc-httpcli/0.0" -#ifdef __cplusplus -extern "C" { -#endif + /* Tracks in-progress http requests TODO(ctiller): allow caching and capturing multiple requests for the @@ -127,8 +125,6 @@ typedef int (*grpc_httpcli_post_override)( void grpc_httpcli_set_override(grpc_httpcli_get_override get, grpc_httpcli_post_override post); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_HTTP_HTTPCLI_H */ diff --git a/src/core/lib/http/parser.h b/src/core/lib/http/parser.h index 3d28481c4ce..0a17e6b6941 100644 --- a/src/core/lib/http/parser.h +++ b/src/core/lib/http/parser.h @@ -27,9 +27,7 @@ /* Maximum length of a header string of the form 'Key: Value\r\n' */ #define GRPC_HTTP_PARSER_MAX_HEADER_LENGTH 4096 -#ifdef __cplusplus -extern "C" { -#endif + /* A single header to be passed in a request */ typedef struct grpc_http_header { @@ -113,8 +111,6 @@ void grpc_http_response_destroy(grpc_http_response* response); extern grpc_tracer_flag grpc_http1_trace; -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_HTTP_PARSER_H */ diff --git a/src/core/lib/iomgr/block_annotate.h b/src/core/lib/iomgr/block_annotate.h index fcbfe9eb1a0..6eecd651f9a 100644 --- a/src/core/lib/iomgr/block_annotate.h +++ b/src/core/lib/iomgr/block_annotate.h @@ -19,16 +19,12 @@ #ifndef GRPC_CORE_LIB_IOMGR_BLOCK_ANNOTATE_H #define GRPC_CORE_LIB_IOMGR_BLOCK_ANNOTATE_H -#ifdef __cplusplus -extern "C" { -#endif + void gpr_thd_start_blocking_region(); void gpr_thd_end_blocking_region(); -#ifdef __cplusplus -} -#endif + /* These annotations identify the beginning and end of regions where the code may block for reasons other than synchronization functions. diff --git a/src/core/lib/iomgr/call_combiner.h b/src/core/lib/iomgr/call_combiner.h index 527f84fce04..66aaf50a499 100644 --- a/src/core/lib/iomgr/call_combiner.h +++ b/src/core/lib/iomgr/call_combiner.h @@ -27,9 +27,7 @@ #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/support/mpscq.h" -#ifdef __cplusplus -extern "C" { -#endif + // A simple, lock-free mechanism for serializing activity related to a // single call. This is similar to a combiner but is more lightweight. @@ -122,8 +120,6 @@ void grpc_call_combiner_cancel(grpc_exec_ctx* exec_ctx, grpc_call_combiner* call_combiner, grpc_error* error); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_CALL_COMBINER_H */ diff --git a/src/core/lib/iomgr/combiner.h b/src/core/lib/iomgr/combiner.h index f8a8b9df624..e37e621a758 100644 --- a/src/core/lib/iomgr/combiner.h +++ b/src/core/lib/iomgr/combiner.h @@ -26,9 +26,7 @@ #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/support/mpscq.h" -#ifdef __cplusplus -extern "C" { -#endif + // Provides serialized access to some resource. // Each action queued on a combiner is executed serially in a borrowed thread. @@ -67,8 +65,6 @@ bool grpc_combiner_continue_exec_ctx(grpc_exec_ctx* exec_ctx); extern grpc_tracer_flag grpc_combiner_trace; -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_COMBINER_H */ diff --git a/src/core/lib/iomgr/endpoint.h b/src/core/lib/iomgr/endpoint.h index 1b0a9e725e3..8918438d230 100644 --- a/src/core/lib/iomgr/endpoint.h +++ b/src/core/lib/iomgr/endpoint.h @@ -26,9 +26,7 @@ #include "src/core/lib/iomgr/pollset_set.h" #include "src/core/lib/iomgr/resource_quota.h" -#ifdef __cplusplus -extern "C" { -#endif + /* An endpoint caps a streaming channel between two communicating processes. Examples may be: a tcp socket, , or some shared memory. */ @@ -106,8 +104,6 @@ struct grpc_endpoint { const grpc_endpoint_vtable* vtable; }; -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_ENDPOINT_H */ diff --git a/src/core/lib/iomgr/endpoint_pair.h b/src/core/lib/iomgr/endpoint_pair.h index 219eea85506..35158da0aaa 100644 --- a/src/core/lib/iomgr/endpoint_pair.h +++ b/src/core/lib/iomgr/endpoint_pair.h @@ -21,9 +21,7 @@ #include "src/core/lib/iomgr/endpoint.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef struct { grpc_endpoint* client; @@ -33,8 +31,6 @@ typedef struct { grpc_endpoint_pair grpc_iomgr_create_endpoint_pair(const char* name, grpc_channel_args* args); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_ENDPOINT_PAIR_H */ diff --git a/src/core/lib/iomgr/error.h b/src/core/lib/iomgr/error.h index 8d7aea4872c..f0d4437a511 100644 --- a/src/core/lib/iomgr/error.h +++ b/src/core/lib/iomgr/error.h @@ -29,9 +29,7 @@ #include "src/core/lib/debug/trace.h" -#ifdef __cplusplus -extern "C" { -#endif + /// Opaque representation of an error. /// See https://github.com/grpc/grpc/blob/master/doc/core/grpc-error.md for a @@ -205,8 +203,6 @@ bool grpc_log_if_error(const char* what, grpc_error* error, const char* file, #define GRPC_LOG_IF_ERROR(what, error) \ grpc_log_if_error((what), (error), __FILE__, __LINE__) -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_ERROR_H */ diff --git a/src/core/lib/iomgr/error_internal.h b/src/core/lib/iomgr/error_internal.h index d5ccbae9e76..26088b2210e 100644 --- a/src/core/lib/iomgr/error_internal.h +++ b/src/core/lib/iomgr/error_internal.h @@ -25,9 +25,7 @@ #include #include "src/core/lib/iomgr/error.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef struct grpc_linked_error grpc_linked_error; @@ -62,8 +60,6 @@ struct grpc_error { bool grpc_error_is_special(struct grpc_error* err); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_ERROR_INTERNAL_H */ diff --git a/src/core/lib/iomgr/ev_epoll1_linux.h b/src/core/lib/iomgr/ev_epoll1_linux.h index 3e66747f6ca..03b61f5eb1d 100644 --- a/src/core/lib/iomgr/ev_epoll1_linux.h +++ b/src/core/lib/iomgr/ev_epoll1_linux.h @@ -22,16 +22,12 @@ #include "src/core/lib/iomgr/ev_posix.h" #include "src/core/lib/iomgr/port.h" -#ifdef __cplusplus -extern "C" { -#endif + // a polling engine that utilizes a singleton epoll set and turnstile polling const grpc_event_engine_vtable* grpc_init_epoll1_linux(bool explicit_request); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_EV_EPOLL1_LINUX_H */ diff --git a/src/core/lib/iomgr/ev_epollex_linux.h b/src/core/lib/iomgr/ev_epollex_linux.h index 22b536c7d4d..6eb980d593f 100644 --- a/src/core/lib/iomgr/ev_epollex_linux.h +++ b/src/core/lib/iomgr/ev_epollex_linux.h @@ -22,15 +22,11 @@ #include "src/core/lib/iomgr/ev_posix.h" #include "src/core/lib/iomgr/port.h" -#ifdef __cplusplus -extern "C" { -#endif + const grpc_event_engine_vtable* grpc_init_epollex_linux( bool explicitly_requested); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_EV_EPOLLEX_LINUX_H */ diff --git a/src/core/lib/iomgr/ev_epollsig_linux.h b/src/core/lib/iomgr/ev_epollsig_linux.h index ca68595734e..15e94bba73d 100644 --- a/src/core/lib/iomgr/ev_epollsig_linux.h +++ b/src/core/lib/iomgr/ev_epollsig_linux.h @@ -22,9 +22,7 @@ #include "src/core/lib/iomgr/ev_posix.h" #include "src/core/lib/iomgr/port.h" -#ifdef __cplusplus -extern "C" { -#endif + const grpc_event_engine_vtable* grpc_init_epollsig_linux(bool explicit_request); @@ -34,8 +32,6 @@ void* grpc_pollset_get_polling_island(grpc_pollset* ps); bool grpc_are_polling_islands_equal(void* p, void* q); #endif /* defined(GRPC_LINUX_EPOLL) */ -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_EV_EPOLLSIG_LINUX_H */ diff --git a/src/core/lib/iomgr/ev_poll_posix.h b/src/core/lib/iomgr/ev_poll_posix.h index 626e95bc8fe..820e14c3379 100644 --- a/src/core/lib/iomgr/ev_poll_posix.h +++ b/src/core/lib/iomgr/ev_poll_posix.h @@ -21,15 +21,11 @@ #include "src/core/lib/iomgr/ev_posix.h" -#ifdef __cplusplus -extern "C" { -#endif + const grpc_event_engine_vtable* grpc_init_poll_posix(bool explicit_request); const grpc_event_engine_vtable* grpc_init_poll_cv_posix(bool explicit_request); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_EV_POLL_POSIX_H */ diff --git a/src/core/lib/iomgr/ev_posix.cc b/src/core/lib/iomgr/ev_posix.cc index 076d2e6bab1..6157b54404b 100644 --- a/src/core/lib/iomgr/ev_posix.cc +++ b/src/core/lib/iomgr/ev_posix.cc @@ -63,8 +63,6 @@ typedef struct { namespace { -extern "C" { - grpc_poll_function_type real_poll_function; int dummy_poll(struct pollfd fds[], nfds_t nfds, int timeout) { @@ -76,7 +74,6 @@ int dummy_poll(struct pollfd fds[], nfds_t nfds, int timeout) { return -1; } } -} // extern "C" const grpc_event_engine_vtable* init_non_polling(bool explicit_request) { if (!explicit_request) { diff --git a/src/core/lib/iomgr/ev_posix.h b/src/core/lib/iomgr/ev_posix.h index d719b8f3c92..acc7f3df398 100644 --- a/src/core/lib/iomgr/ev_posix.h +++ b/src/core/lib/iomgr/ev_posix.h @@ -27,9 +27,7 @@ #include "src/core/lib/iomgr/pollset_set.h" #include "src/core/lib/iomgr/wakeup_fd_posix.h" -#ifdef __cplusplus -extern "C" { -#endif + extern grpc_tracer_flag grpc_polling_trace; /* Disabled by default */ @@ -162,8 +160,6 @@ extern grpc_poll_function_type grpc_poll_function; void grpc_set_event_engine_test_only(const grpc_event_engine_vtable*); const grpc_event_engine_vtable* grpc_get_event_engine_test_only(); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_EV_POSIX_H */ diff --git a/src/core/lib/iomgr/exec_ctx.h b/src/core/lib/iomgr/exec_ctx.h index bd27506152a..1baca89d6ed 100644 --- a/src/core/lib/iomgr/exec_ctx.h +++ b/src/core/lib/iomgr/exec_ctx.h @@ -24,9 +24,7 @@ #include "src/core/lib/iomgr/closure.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef gpr_atm grpc_millis; @@ -124,8 +122,4 @@ gpr_timespec grpc_millis_to_timespec(grpc_millis millis, gpr_clock_type clock); grpc_millis grpc_timespec_to_millis_round_down(gpr_timespec timespec); grpc_millis grpc_timespec_to_millis_round_up(gpr_timespec timespec); -#ifdef __cplusplus -} -#endif - #endif /* GRPC_CORE_LIB_IOMGR_EXEC_CTX_H */ diff --git a/src/core/lib/iomgr/executor.h b/src/core/lib/iomgr/executor.h index 8418ace06ef..35823b0f0ec 100644 --- a/src/core/lib/iomgr/executor.h +++ b/src/core/lib/iomgr/executor.h @@ -21,9 +21,7 @@ #include "src/core/lib/iomgr/closure.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef enum { GRPC_EXECUTOR_SHORT, @@ -49,8 +47,6 @@ bool grpc_executor_is_threaded(); grpc_executor_shutdown */ void grpc_executor_set_threading(grpc_exec_ctx* exec_ctx, bool enable); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_EXECUTOR_H */ diff --git a/src/core/lib/iomgr/gethostname.h b/src/core/lib/iomgr/gethostname.h index 2e65b5ffbfc..19da54378ac 100644 --- a/src/core/lib/iomgr/gethostname.h +++ b/src/core/lib/iomgr/gethostname.h @@ -19,16 +19,12 @@ #ifndef GRPC_CORE_LIB_IOMGR_GETHOSTNAME_H #define GRPC_CORE_LIB_IOMGR_GETHOSTNAME_H -#ifdef __cplusplus -extern "C" { -#endif + // Returns the hostname of the local machine. // Caller takes ownership of result. char* grpc_gethostname(); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_GETHOSTNAME_H */ diff --git a/src/core/lib/iomgr/iocp_windows.h b/src/core/lib/iomgr/iocp_windows.h index d112c505388..ca6d3c91bd3 100644 --- a/src/core/lib/iomgr/iocp_windows.h +++ b/src/core/lib/iomgr/iocp_windows.h @@ -27,9 +27,7 @@ #include "src/core/lib/iomgr/socket_windows.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef enum { GRPC_IOCP_WORK_WORK, @@ -45,9 +43,7 @@ void grpc_iocp_flush(void); void grpc_iocp_shutdown(void); void grpc_iocp_add_socket(grpc_winsocket*); -#ifdef __cplusplus -} -#endif + #endif diff --git a/src/core/lib/iomgr/iomgr.h b/src/core/lib/iomgr/iomgr.h index d1549c8c630..4e4fb4a1a22 100644 --- a/src/core/lib/iomgr/iomgr.h +++ b/src/core/lib/iomgr/iomgr.h @@ -22,9 +22,7 @@ #include #include "src/core/lib/iomgr/port.h" -#ifdef __cplusplus -extern "C" { -#endif + /** Initializes the iomgr. */ void grpc_iomgr_init(grpc_exec_ctx* exec_ctx); @@ -36,8 +34,6 @@ void grpc_iomgr_start(grpc_exec_ctx* exec_ctx); * exec_ctx. */ void grpc_iomgr_shutdown(grpc_exec_ctx* exec_ctx); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_IOMGR_H */ diff --git a/src/core/lib/iomgr/iomgr_internal.h b/src/core/lib/iomgr/iomgr_internal.h index b818c68da03..144a92a6c4e 100644 --- a/src/core/lib/iomgr/iomgr_internal.h +++ b/src/core/lib/iomgr/iomgr_internal.h @@ -23,9 +23,7 @@ #include "src/core/lib/iomgr/iomgr.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef struct grpc_iomgr_object { char* name; @@ -44,8 +42,6 @@ void grpc_iomgr_platform_shutdown(void); bool grpc_iomgr_abort_on_leaks(void); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_IOMGR_INTERNAL_H */ diff --git a/src/core/lib/iomgr/iomgr_uv.h b/src/core/lib/iomgr/iomgr_uv.h index bc42ca8c1c0..218e696e3ab 100644 --- a/src/core/lib/iomgr/iomgr_uv.h +++ b/src/core/lib/iomgr/iomgr_uv.h @@ -23,17 +23,13 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + /* The thread ID of the thread on which grpc was initialized. Used to verify * that all calls into libuv are made on that same thread */ extern gpr_thd_id g_init_thread; -#ifdef __cplusplus -} -#endif + #ifdef GRPC_UV_THREAD_CHECK #define GRPC_UV_ASSERT_SAME_THREAD() \ diff --git a/src/core/lib/iomgr/is_epollexclusive_available.h b/src/core/lib/iomgr/is_epollexclusive_available.h index 9ae9c5c1915..8dc7af0bcee 100644 --- a/src/core/lib/iomgr/is_epollexclusive_available.h +++ b/src/core/lib/iomgr/is_epollexclusive_available.h @@ -21,14 +21,10 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + bool grpc_is_epollexclusive_available(void); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_IS_EPOLLEXCLUSIVE_AVAILABLE_H */ diff --git a/src/core/lib/iomgr/load_file.h b/src/core/lib/iomgr/load_file.h index 5b367c189d5..61e0cb1a1a4 100644 --- a/src/core/lib/iomgr/load_file.h +++ b/src/core/lib/iomgr/load_file.h @@ -25,17 +25,13 @@ #include "src/core/lib/iomgr/error.h" -#ifdef __cplusplus -extern "C" { -#endif + /* Loads the content of a file into a slice. add_null_terminator will add a NULL terminator if non-zero. */ grpc_error* grpc_load_file(const char* filename, int add_null_terminator, grpc_slice* slice); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_LOAD_FILE_H */ diff --git a/src/core/lib/iomgr/polling_entity.h b/src/core/lib/iomgr/polling_entity.h index 867e0851535..f0b4617a9d8 100644 --- a/src/core/lib/iomgr/polling_entity.h +++ b/src/core/lib/iomgr/polling_entity.h @@ -22,9 +22,7 @@ #include "src/core/lib/iomgr/pollset.h" #include "src/core/lib/iomgr/pollset_set.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef enum grpc_pollset_tag { GRPC_POLLS_NONE, @@ -68,8 +66,6 @@ void grpc_polling_entity_add_to_pollset_set(grpc_exec_ctx* exec_ctx, void grpc_polling_entity_del_from_pollset_set(grpc_exec_ctx* exec_ctx, grpc_polling_entity* pollent, grpc_pollset_set* pss_dst); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_POLLING_ENTITY_H */ diff --git a/src/core/lib/iomgr/pollset.h b/src/core/lib/iomgr/pollset.h index c99b930e8e2..761aa806433 100644 --- a/src/core/lib/iomgr/pollset.h +++ b/src/core/lib/iomgr/pollset.h @@ -25,9 +25,7 @@ #include "src/core/lib/iomgr/exec_ctx.h" -#ifdef __cplusplus -extern "C" { -#endif + #ifndef NDEBUG extern grpc_tracer_flag grpc_trace_fd_refcount; @@ -84,8 +82,6 @@ grpc_error* grpc_pollset_kick(grpc_exec_ctx* exec_ctx, grpc_pollset* pollset, grpc_pollset_worker* specific_worker) GRPC_MUST_USE_RESULT; -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_POLLSET_H */ diff --git a/src/core/lib/iomgr/pollset_set.h b/src/core/lib/iomgr/pollset_set.h index 0167a50a568..4a3793eccbd 100644 --- a/src/core/lib/iomgr/pollset_set.h +++ b/src/core/lib/iomgr/pollset_set.h @@ -21,9 +21,7 @@ #include "src/core/lib/iomgr/pollset.h" -#ifdef __cplusplus -extern "C" { -#endif + /* A grpc_pollset_set is a set of pollsets that are interested in an action. Adding a pollset to a pollset_set automatically adds any @@ -48,8 +46,6 @@ void grpc_pollset_set_del_pollset_set(grpc_exec_ctx* exec_ctx, grpc_pollset_set* bag, grpc_pollset_set* item); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_POLLSET_SET_H */ diff --git a/src/core/lib/iomgr/pollset_uv.h b/src/core/lib/iomgr/pollset_uv.h index 5cc9faf4ff1..ce62297cc79 100644 --- a/src/core/lib/iomgr/pollset_uv.h +++ b/src/core/lib/iomgr/pollset_uv.h @@ -19,17 +19,13 @@ #ifndef GRPC_CORE_LIB_IOMGR_POLLSET_UV_H #define GRPC_CORE_LIB_IOMGR_POLLSET_UV_H -#ifdef __cplusplus -extern "C" { -#endif + extern int grpc_pollset_work_run_loop; void grpc_pollset_global_init(void); void grpc_pollset_global_shutdown(void); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_POLLSET_UV_H */ diff --git a/src/core/lib/iomgr/pollset_windows.h b/src/core/lib/iomgr/pollset_windows.h index f6da9da6019..d0b4144c276 100644 --- a/src/core/lib/iomgr/pollset_windows.h +++ b/src/core/lib/iomgr/pollset_windows.h @@ -26,9 +26,7 @@ #ifdef GRPC_WINSOCK_SOCKET #include "src/core/lib/iomgr/socket_windows.h" -#ifdef __cplusplus -extern "C" { -#endif + /* There isn't really any such thing as a pollset under Windows, due to the nature of the IO completion ports. A Windows "pollset" is merely a mutex @@ -67,9 +65,7 @@ struct grpc_pollset { void grpc_pollset_global_init(void); void grpc_pollset_global_shutdown(void); -#ifdef __cplusplus -} -#endif + #endif diff --git a/src/core/lib/iomgr/resolve_address.h b/src/core/lib/iomgr/resolve_address.h index 847e10f177c..790d614aae2 100644 --- a/src/core/lib/iomgr/resolve_address.h +++ b/src/core/lib/iomgr/resolve_address.h @@ -25,9 +25,7 @@ #define GRPC_MAX_SOCKADDR_SIZE 128 -#ifdef __cplusplus -extern "C" { -#endif + typedef struct { char addr[GRPC_MAX_SOCKADDR_SIZE]; @@ -56,8 +54,6 @@ extern grpc_error* (*grpc_blocking_resolve_address)( const char* name, const char* default_port, grpc_resolved_addresses** addresses); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_RESOLVE_ADDRESS_H */ diff --git a/src/core/lib/iomgr/resource_quota.h b/src/core/lib/iomgr/resource_quota.h index fcdf9c2de5d..331efe0e358 100644 --- a/src/core/lib/iomgr/resource_quota.h +++ b/src/core/lib/iomgr/resource_quota.h @@ -24,9 +24,7 @@ #include "src/core/lib/debug/trace.h" #include "src/core/lib/iomgr/exec_ctx.h" -#ifdef __cplusplus -extern "C" { -#endif + /** \file Tracks resource usage against a pool. @@ -154,8 +152,6 @@ grpc_slice grpc_resource_user_slice_malloc(grpc_exec_ctx* exec_ctx, grpc_resource_user* resource_user, size_t size); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_RESOURCE_QUOTA_H */ diff --git a/src/core/lib/iomgr/sockaddr_utils.h b/src/core/lib/iomgr/sockaddr_utils.h index 090470d49e3..0d5cc5bb425 100644 --- a/src/core/lib/iomgr/sockaddr_utils.h +++ b/src/core/lib/iomgr/sockaddr_utils.h @@ -21,9 +21,7 @@ #include "src/core/lib/iomgr/resolve_address.h" -#ifdef __cplusplus -extern "C" { -#endif + /* Returns true if addr is an IPv4-mapped IPv6 address within the ::ffff:0.0.0.0/96 range, or false otherwise. @@ -81,8 +79,6 @@ const char* grpc_sockaddr_get_uri_scheme(const grpc_resolved_address* addr); int grpc_sockaddr_get_family(const grpc_resolved_address* resolved_addr); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_SOCKADDR_UTILS_H */ diff --git a/src/core/lib/iomgr/socket_factory_posix.h b/src/core/lib/iomgr/socket_factory_posix.h index e8257b07c48..920a72901e7 100644 --- a/src/core/lib/iomgr/socket_factory_posix.h +++ b/src/core/lib/iomgr/socket_factory_posix.h @@ -23,9 +23,7 @@ #include #include "src/core/lib/iomgr/resolve_address.h" -#ifdef __cplusplus -extern "C" { -#endif + /** The virtual table of grpc_socket_factory */ typedef struct { @@ -68,8 +66,6 @@ int grpc_socket_factory_compare(grpc_socket_factory* a, grpc_socket_factory* b); grpc_socket_factory* grpc_socket_factory_ref(grpc_socket_factory* factory); void grpc_socket_factory_unref(grpc_socket_factory* factory); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_SOCKET_FACTORY_POSIX_H */ diff --git a/src/core/lib/iomgr/socket_mutator.h b/src/core/lib/iomgr/socket_mutator.h index b4103f7e93a..703aee3145f 100644 --- a/src/core/lib/iomgr/socket_mutator.h +++ b/src/core/lib/iomgr/socket_mutator.h @@ -24,9 +24,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + /** The virtual table of grpc_socket_mutator */ typedef struct { @@ -60,8 +58,6 @@ int grpc_socket_mutator_compare(grpc_socket_mutator* a, grpc_socket_mutator* b); grpc_socket_mutator* grpc_socket_mutator_ref(grpc_socket_mutator* mutator); void grpc_socket_mutator_unref(grpc_socket_mutator* mutator); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_SOCKET_MUTATOR_H */ diff --git a/src/core/lib/iomgr/socket_utils.h b/src/core/lib/iomgr/socket_utils.h index 4816ab6be78..dc5c4dc56e0 100644 --- a/src/core/lib/iomgr/socket_utils.h +++ b/src/core/lib/iomgr/socket_utils.h @@ -21,15 +21,11 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + /* A wrapper for inet_ntop on POSIX systems and InetNtop on Windows systems */ const char* grpc_inet_ntop(int af, const void* src, char* dst, size_t size); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_SOCKET_UTILS_H */ diff --git a/src/core/lib/iomgr/socket_utils_posix.h b/src/core/lib/iomgr/socket_utils_posix.h index 7a9c8139e7d..02fdd02e2b3 100644 --- a/src/core/lib/iomgr/socket_utils_posix.h +++ b/src/core/lib/iomgr/socket_utils_posix.h @@ -29,9 +29,7 @@ #include "src/core/lib/iomgr/socket_factory_posix.h" #include "src/core/lib/iomgr/socket_mutator.h" -#ifdef __cplusplus -extern "C" { -#endif + /* a wrapper for accept or accept4 */ int grpc_accept4(int sockfd, grpc_resolved_address* resolved_addr, int nonblock, @@ -133,8 +131,6 @@ grpc_error* grpc_create_dualstack_socket_using_factory( grpc_socket_factory* factory, const grpc_resolved_address* addr, int type, int protocol, grpc_dualstack_mode* dsmode, int* newfd); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_SOCKET_UTILS_POSIX_H */ diff --git a/src/core/lib/iomgr/socket_windows.h b/src/core/lib/iomgr/socket_windows.h index c3ad99d82fb..5a09c52b7a5 100644 --- a/src/core/lib/iomgr/socket_windows.h +++ b/src/core/lib/iomgr/socket_windows.h @@ -31,9 +31,7 @@ #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/iomgr_internal.h" -#ifdef __cplusplus -extern "C" { -#endif + /* This holds the data for an outstanding read or write on a socket. The mutex to protect the concurrent access to that data is the one @@ -114,9 +112,7 @@ void grpc_socket_become_ready(grpc_exec_ctx* exec_ctx, grpc_winsocket* winsocket, grpc_winsocket_callback_info* ci); -#ifdef __cplusplus -} -#endif + #endif diff --git a/src/core/lib/iomgr/tcp_client.h b/src/core/lib/iomgr/tcp_client.h index c18d8a93165..9ad06f2f9ed 100644 --- a/src/core/lib/iomgr/tcp_client.h +++ b/src/core/lib/iomgr/tcp_client.h @@ -25,9 +25,7 @@ #include "src/core/lib/iomgr/pollset_set.h" #include "src/core/lib/iomgr/resolve_address.h" -#ifdef __cplusplus -extern "C" { -#endif + /* Asynchronously connect to an address (specified as (addr, len)), and call cb with arg and the completed connection when done (or call cb with arg and @@ -41,8 +39,6 @@ void grpc_tcp_client_connect(grpc_exec_ctx* exec_ctx, grpc_closure* on_connect, const grpc_resolved_address* addr, grpc_millis deadline); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_TCP_CLIENT_H */ diff --git a/src/core/lib/iomgr/tcp_client_posix.cc b/src/core/lib/iomgr/tcp_client_posix.cc index cb0f627c940..92120a50224 100644 --- a/src/core/lib/iomgr/tcp_client_posix.cc +++ b/src/core/lib/iomgr/tcp_client_posix.cc @@ -334,13 +334,11 @@ done: } // overridden by api_fuzzer.c -extern "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_channel_args* channel_args, const grpc_resolved_address* addr, grpc_millis deadline) = tcp_client_connect_impl; -} void grpc_tcp_client_connect(grpc_exec_ctx* exec_ctx, grpc_closure* closure, grpc_endpoint** ep, diff --git a/src/core/lib/iomgr/tcp_client_posix.h b/src/core/lib/iomgr/tcp_client_posix.h index 13d917891e3..aac74effba3 100644 --- a/src/core/lib/iomgr/tcp_client_posix.h +++ b/src/core/lib/iomgr/tcp_client_posix.h @@ -23,16 +23,12 @@ #include "src/core/lib/iomgr/ev_posix.h" #include "src/core/lib/iomgr/tcp_client.h" -#ifdef __cplusplus -extern "C" { -#endif + grpc_endpoint* grpc_tcp_client_create_from_fd( grpc_exec_ctx* exec_ctx, grpc_fd* fd, const grpc_channel_args* channel_args, const char* addr_str); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_TCP_CLIENT_POSIX_H */ diff --git a/src/core/lib/iomgr/tcp_client_windows.cc b/src/core/lib/iomgr/tcp_client_windows.cc index 103e6b78deb..5e30725e904 100644 --- a/src/core/lib/iomgr/tcp_client_windows.cc +++ b/src/core/lib/iomgr/tcp_client_windows.cc @@ -226,13 +226,11 @@ failure: } // overridden by api_fuzzer.c -extern "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_channel_args* channel_args, const grpc_resolved_address* addr, grpc_millis deadline) = tcp_client_connect_impl; -} void grpc_tcp_client_connect(grpc_exec_ctx* exec_ctx, grpc_closure* closure, grpc_endpoint** ep, diff --git a/src/core/lib/iomgr/tcp_posix.h b/src/core/lib/iomgr/tcp_posix.h index ff1060b0ffd..273e3277a93 100644 --- a/src/core/lib/iomgr/tcp_posix.h +++ b/src/core/lib/iomgr/tcp_posix.h @@ -33,9 +33,7 @@ #include "src/core/lib/iomgr/endpoint.h" #include "src/core/lib/iomgr/ev_posix.h" -#ifdef __cplusplus -extern "C" { -#endif + extern grpc_tracer_flag grpc_tcp_trace; @@ -57,8 +55,6 @@ int grpc_tcp_fd(grpc_endpoint* ep); void grpc_tcp_destroy_and_release_fd(grpc_exec_ctx* exec_ctx, grpc_endpoint* ep, int* fd, grpc_closure* done); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_TCP_POSIX_H */ diff --git a/src/core/lib/iomgr/tcp_server.h b/src/core/lib/iomgr/tcp_server.h index ef983199b81..ab271f997c1 100644 --- a/src/core/lib/iomgr/tcp_server.h +++ b/src/core/lib/iomgr/tcp_server.h @@ -25,9 +25,7 @@ #include "src/core/lib/iomgr/endpoint.h" #include "src/core/lib/iomgr/resolve_address.h" -#ifdef __cplusplus -extern "C" { -#endif + /* Forward decl of grpc_tcp_server */ typedef struct grpc_tcp_server grpc_tcp_server; @@ -102,8 +100,6 @@ void grpc_tcp_server_unref(grpc_exec_ctx* exec_ctx, grpc_tcp_server* s); void grpc_tcp_server_shutdown_listeners(grpc_exec_ctx* exec_ctx, grpc_tcp_server* s); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_TCP_SERVER_H */ diff --git a/src/core/lib/iomgr/tcp_server_utils_posix.h b/src/core/lib/iomgr/tcp_server_utils_posix.h index 608fba3346c..fb2510ec390 100644 --- a/src/core/lib/iomgr/tcp_server_utils_posix.h +++ b/src/core/lib/iomgr/tcp_server_utils_posix.h @@ -24,9 +24,7 @@ #include "src/core/lib/iomgr/socket_utils_posix.h" #include "src/core/lib/iomgr/tcp_server.h" -#ifdef __cplusplus -extern "C" { -#endif + /* one listening port */ typedef struct grpc_tcp_listener { @@ -121,8 +119,6 @@ grpc_error* grpc_tcp_server_prepare_socket(int fd, /* Ruturn true if the platform supports ifaddrs */ bool grpc_tcp_server_have_ifaddrs(void); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_TCP_SERVER_UTILS_POSIX_H */ diff --git a/src/core/lib/iomgr/tcp_uv.h b/src/core/lib/iomgr/tcp_uv.h index 708e8469e69..df12c882e0d 100644 --- a/src/core/lib/iomgr/tcp_uv.h +++ b/src/core/lib/iomgr/tcp_uv.h @@ -42,17 +42,13 @@ extern grpc_tracer_flag grpc_tcp_trace; #define GRPC_TCP_DEFAULT_READ_SLICE_SIZE 8192 -#ifdef __cplusplus -extern "C" { -#endif + grpc_endpoint* grpc_tcp_create(uv_tcp_t* handle, grpc_resource_quota* resource_quota, char* peer_string); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_UV */ diff --git a/src/core/lib/iomgr/tcp_windows.h b/src/core/lib/iomgr/tcp_windows.h index 9c7ccdf132b..ccfde727231 100644 --- a/src/core/lib/iomgr/tcp_windows.h +++ b/src/core/lib/iomgr/tcp_windows.h @@ -35,9 +35,7 @@ #include "src/core/lib/iomgr/endpoint.h" #include "src/core/lib/iomgr/socket_windows.h" -#ifdef __cplusplus -extern "C" { -#endif + /* Create a tcp endpoint given a winsock handle. * Takes ownership of the handle. @@ -48,9 +46,7 @@ grpc_endpoint* grpc_tcp_create(grpc_exec_ctx* exec_ctx, grpc_winsocket* socket, grpc_error* grpc_tcp_prepare_socket(SOCKET sock); -#ifdef __cplusplus -} -#endif + #endif diff --git a/src/core/lib/iomgr/time_averaged_stats.h b/src/core/lib/iomgr/time_averaged_stats.h index d38ed272b6d..519bc2db16c 100644 --- a/src/core/lib/iomgr/time_averaged_stats.h +++ b/src/core/lib/iomgr/time_averaged_stats.h @@ -19,9 +19,7 @@ #ifndef GRPC_CORE_LIB_IOMGR_TIME_AVERAGED_STATS_H #define GRPC_CORE_LIB_IOMGR_TIME_AVERAGED_STATS_H -#ifdef __cplusplus -extern "C" { -#endif + /* This tracks a time-decaying weighted average. It works by collecting batches of samples and then mixing their average into a time-decaying @@ -74,8 +72,6 @@ void grpc_time_averaged_stats_add_sample(grpc_time_averaged_stats* stats, value. */ double grpc_time_averaged_stats_update_average(grpc_time_averaged_stats* stats); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_TIME_AVERAGED_STATS_H */ diff --git a/src/core/lib/iomgr/timer.h b/src/core/lib/iomgr/timer.h index cd8334ecebe..9e454d995df 100644 --- a/src/core/lib/iomgr/timer.h +++ b/src/core/lib/iomgr/timer.h @@ -32,9 +32,7 @@ #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/iomgr.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef struct grpc_timer grpc_timer; @@ -106,8 +104,6 @@ void grpc_timer_consume_kick(void); void grpc_kick_poller(void); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_TIMER_H */ diff --git a/src/core/lib/iomgr/timer_generic.cc b/src/core/lib/iomgr/timer_generic.cc index a4bfbcb342c..4216caa54ff 100644 --- a/src/core/lib/iomgr/timer_generic.cc +++ b/src/core/lib/iomgr/timer_generic.cc @@ -42,11 +42,9 @@ #define MIN_QUEUE_WINDOW_DURATION 0.01 #define MAX_QUEUE_WINDOW_DURATION 1 -extern "C" { grpc_tracer_flag grpc_timer_trace = GRPC_TRACER_INITIALIZER(false, "timer"); grpc_tracer_flag grpc_timer_check_trace = GRPC_TRACER_INITIALIZER(false, "timer_check"); -} /* A "timer shard". Contains a 'heap' and a 'list' of timers. All timers with * deadlines earlier than 'queue_deadline" cap are maintained in the heap and diff --git a/src/core/lib/iomgr/timer_heap.h b/src/core/lib/iomgr/timer_heap.h index ae56e5a73ed..12a7ab2884f 100644 --- a/src/core/lib/iomgr/timer_heap.h +++ b/src/core/lib/iomgr/timer_heap.h @@ -21,9 +21,7 @@ #include "src/core/lib/iomgr/timer.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef struct { grpc_timer** timers; @@ -43,8 +41,6 @@ void grpc_timer_heap_pop(grpc_timer_heap* heap); int grpc_timer_heap_is_empty(grpc_timer_heap* heap); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_TIMER_HEAP_H */ diff --git a/src/core/lib/iomgr/timer_manager.h b/src/core/lib/iomgr/timer_manager.h index 72960d6ffc0..861ee6845e7 100644 --- a/src/core/lib/iomgr/timer_manager.h +++ b/src/core/lib/iomgr/timer_manager.h @@ -21,9 +21,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + /* Timer Manager tries to keep one thread waiting for the next timeout at all times */ @@ -38,8 +36,6 @@ void grpc_timer_manager_set_threading(bool enabled); * disabled */ void grpc_timer_manager_tick(void); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_TIMER_MANAGER_H */ diff --git a/src/core/lib/iomgr/timer_uv.cc b/src/core/lib/iomgr/timer_uv.cc index df40e54ae63..3d0450cfb54 100644 --- a/src/core/lib/iomgr/timer_uv.cc +++ b/src/core/lib/iomgr/timer_uv.cc @@ -29,11 +29,9 @@ #include -extern "C" { grpc_tracer_flag grpc_timer_trace = GRPC_TRACER_INITIALIZER(false, "timer"); grpc_tracer_flag grpc_timer_check_trace = GRPC_TRACER_INITIALIZER(false, "timer_check"); -} static void timer_close_callback(uv_handle_t* handle) { gpr_free(handle); } diff --git a/src/core/lib/iomgr/udp_server.h b/src/core/lib/iomgr/udp_server.h index bca0f049fb3..6bd5b205c3b 100644 --- a/src/core/lib/iomgr/udp_server.h +++ b/src/core/lib/iomgr/udp_server.h @@ -23,9 +23,7 @@ #include "src/core/lib/iomgr/ev_posix.h" #include "src/core/lib/iomgr/resolve_address.h" -#ifdef __cplusplus -extern "C" { -#endif + /* Forward decl of struct grpc_server */ /* This is not typedef'ed to avoid a typedef-redefinition error */ @@ -77,8 +75,6 @@ int grpc_udp_server_add_port(grpc_udp_server* s, void grpc_udp_server_destroy(grpc_exec_ctx* exec_ctx, grpc_udp_server* server, grpc_closure* on_done); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_UDP_SERVER_H */ diff --git a/src/core/lib/iomgr/unix_sockets_posix.h b/src/core/lib/iomgr/unix_sockets_posix.h index be3c33d9c29..a0d90723701 100644 --- a/src/core/lib/iomgr/unix_sockets_posix.h +++ b/src/core/lib/iomgr/unix_sockets_posix.h @@ -25,9 +25,7 @@ #include "src/core/lib/iomgr/resolve_address.h" -#ifdef __cplusplus -extern "C" { -#endif + void grpc_create_socketpair_if_unix(int sv[2]); @@ -42,8 +40,6 @@ void grpc_unlink_if_unix_domain_socket( char* grpc_sockaddr_to_uri_unix_if_possible( const grpc_resolved_address* resolved_addr); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_UNIX_SOCKETS_POSIX_H */ diff --git a/src/core/lib/iomgr/wakeup_fd_cv.h b/src/core/lib/iomgr/wakeup_fd_cv.h index dcd7bdb560f..94473318e57 100644 --- a/src/core/lib/iomgr/wakeup_fd_cv.h +++ b/src/core/lib/iomgr/wakeup_fd_cv.h @@ -40,9 +40,7 @@ #define GRPC_FD_TO_IDX(fd) (-(fd)-1) #define GRPC_IDX_TO_FD(idx) (-(idx)-1) -#ifdef __cplusplus -extern "C" { -#endif + typedef struct cv_node { gpr_cv* cv; @@ -68,8 +66,6 @@ typedef struct cv_fd_table { extern const grpc_wakeup_fd_vtable grpc_cv_wakeup_fd_vtable; -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_WAKEUP_FD_CV_H */ diff --git a/src/core/lib/iomgr/wakeup_fd_pipe.h b/src/core/lib/iomgr/wakeup_fd_pipe.h index 9bbb5e2ff7b..bb1dfd7a263 100644 --- a/src/core/lib/iomgr/wakeup_fd_pipe.h +++ b/src/core/lib/iomgr/wakeup_fd_pipe.h @@ -21,14 +21,10 @@ #include "src/core/lib/iomgr/wakeup_fd_posix.h" -#ifdef __cplusplus -extern "C" { -#endif + extern const grpc_wakeup_fd_vtable grpc_pipe_wakeup_fd_vtable; -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_WAKEUP_FD_PIPE_H */ diff --git a/src/core/lib/iomgr/wakeup_fd_posix.h b/src/core/lib/iomgr/wakeup_fd_posix.h index ae7849f98ce..65a80d44f41 100644 --- a/src/core/lib/iomgr/wakeup_fd_posix.h +++ b/src/core/lib/iomgr/wakeup_fd_posix.h @@ -49,9 +49,7 @@ #include "src/core/lib/iomgr/error.h" -#ifdef __cplusplus -extern "C" { -#endif + void grpc_wakeup_fd_global_init(void); void grpc_wakeup_fd_global_destroy(void); @@ -95,8 +93,6 @@ void grpc_wakeup_fd_destroy(grpc_wakeup_fd* fd_info); * wakeup_fd_nospecial.c if no such implementation exists. */ extern const grpc_wakeup_fd_vtable grpc_specialized_wakeup_fd_vtable; -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_IOMGR_WAKEUP_FD_POSIX_H */ diff --git a/src/core/lib/json/json.h b/src/core/lib/json/json.h index c9fdec4ecb7..0e841e0726c 100644 --- a/src/core/lib/json/json.h +++ b/src/core/lib/json/json.h @@ -23,9 +23,7 @@ #include "src/core/lib/json/json_common.h" -#ifdef __cplusplus -extern "C" { -#endif + /* A tree-like structure to hold json values. The key and value pointers * are not owned by it. @@ -74,8 +72,6 @@ char* grpc_json_dump_to_string(grpc_json* json, int indent); grpc_json* grpc_json_create(grpc_json_type type); void grpc_json_destroy(grpc_json* json); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_JSON_JSON_H */ diff --git a/src/core/lib/json/json_reader.h b/src/core/lib/json/json_reader.h index 2636d2b1d9f..62718bbcdc3 100644 --- a/src/core/lib/json/json_reader.h +++ b/src/core/lib/json/json_reader.h @@ -22,9 +22,7 @@ #include #include "src/core/lib/json/json_common.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef enum { GRPC_JSON_STATE_OBJECT_KEY_BEGIN, @@ -146,8 +144,6 @@ void grpc_json_reader_init(grpc_json_reader* reader, */ int grpc_json_reader_is_complete(grpc_json_reader* reader); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_JSON_JSON_READER_H */ diff --git a/src/core/lib/json/json_writer.h b/src/core/lib/json/json_writer.h index 93eeb2031b2..ead8426d03b 100644 --- a/src/core/lib/json/json_writer.h +++ b/src/core/lib/json/json_writer.h @@ -35,9 +35,7 @@ #include "src/core/lib/json/json_common.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef struct grpc_json_writer_vtable { /* Adds a character to the output stream. */ @@ -83,8 +81,6 @@ void grpc_json_writer_value_raw_with_len(grpc_json_writer* writer, void grpc_json_writer_value_string(grpc_json_writer* writer, const char* string); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_JSON_JSON_WRITER_H */ diff --git a/src/core/lib/profiling/timers.h b/src/core/lib/profiling/timers.h index 8b6c254c219..a0a0a4fff1f 100644 --- a/src/core/lib/profiling/timers.h +++ b/src/core/lib/profiling/timers.h @@ -19,9 +19,7 @@ #ifndef GRPC_CORE_LIB_PROFILING_TIMERS_H #define GRPC_CORE_LIB_PROFILING_TIMERS_H -#ifdef __cplusplus -extern "C" { -#endif + void gpr_timers_global_init(void); void gpr_timers_global_destroy(void); @@ -84,9 +82,6 @@ void gpr_timer_set_enabled(int enabled); #endif /* at least one profiler requested. */ -#ifdef __cplusplus -} - #if (defined(GRPC_STAP_PROFILER) + defined(GRPC_BASIC_PROFILER) + \ defined(GRPC_CUSTOM_PROFILER)) namespace grpc { @@ -111,6 +106,5 @@ class ProfileScope { do { \ } while (false) #endif -#endif #endif /* GRPC_CORE_LIB_PROFILING_TIMERS_H */ diff --git a/src/core/lib/security/context/security_context.h b/src/core/lib/security/context/security_context.h index 4f049c4a3b3..261bc167f56 100644 --- a/src/core/lib/security/context/security_context.h +++ b/src/core/lib/security/context/security_context.h @@ -26,9 +26,7 @@ extern grpc_tracer_flag grpc_trace_auth_context_refcount; #endif -#ifdef __cplusplus -extern "C" { -#endif + /* --- grpc_auth_context --- @@ -116,8 +114,6 @@ grpc_auth_context* grpc_auth_context_from_arg(const grpc_arg* arg); grpc_auth_context* grpc_find_auth_context_in_args( const grpc_channel_args* args); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SECURITY_CONTEXT_SECURITY_CONTEXT_H */ diff --git a/src/core/lib/security/credentials/composite/composite_credentials.h b/src/core/lib/security/credentials/composite/composite_credentials.h index efb5f4f0c44..e3438dd3d11 100644 --- a/src/core/lib/security/credentials/composite/composite_credentials.h +++ b/src/core/lib/security/credentials/composite/composite_credentials.h @@ -21,9 +21,7 @@ #include "src/core/lib/security/credentials/credentials.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef struct { grpc_call_credentials** creds_array; @@ -57,9 +55,7 @@ typedef struct { grpc_call_credentials_array inner; } grpc_composite_call_credentials; -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_COMPOSITE_COMPOSITE_CREDENTIALS_H \ */ diff --git a/src/core/lib/security/credentials/credentials.h b/src/core/lib/security/credentials/credentials.h index c65b9660ea7..f74b047edc7 100644 --- a/src/core/lib/security/credentials/credentials.h +++ b/src/core/lib/security/credentials/credentials.h @@ -29,9 +29,7 @@ #include "src/core/lib/iomgr/polling_entity.h" #include "src/core/lib/security/transport/security_connector.h" -#ifdef __cplusplus -extern "C" { -#endif + struct grpc_http_response; @@ -256,8 +254,6 @@ grpc_credentials_metadata_request* grpc_credentials_metadata_request_create( void grpc_credentials_metadata_request_destroy( grpc_exec_ctx* exec_ctx, grpc_credentials_metadata_request* r); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_CREDENTIALS_H */ diff --git a/src/core/lib/security/credentials/fake/fake_credentials.h b/src/core/lib/security/credentials/fake/fake_credentials.h index b8b58cc8fd1..7645671cee9 100644 --- a/src/core/lib/security/credentials/fake/fake_credentials.h +++ b/src/core/lib/security/credentials/fake/fake_credentials.h @@ -21,9 +21,7 @@ #include "src/core/lib/security/credentials/credentials.h" -#ifdef __cplusplus -extern "C" { -#endif + /* -- Fake transport security credentials. -- */ @@ -60,8 +58,6 @@ typedef struct { bool is_async; } grpc_md_only_test_credentials; -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_FAKE_FAKE_CREDENTIALS_H */ diff --git a/src/core/lib/security/credentials/google_default/google_default_credentials.h b/src/core/lib/security/credentials/google_default/google_default_credentials.h index a0f8dc954ec..6453480f0fb 100644 --- a/src/core/lib/security/credentials/google_default/google_default_credentials.h +++ b/src/core/lib/security/credentials/google_default/google_default_credentials.h @@ -23,9 +23,7 @@ #include "src/core/lib/security/credentials/credentials.h" -#ifdef __cplusplus -extern "C" { -#endif + #define GRPC_GOOGLE_CLOUD_SDK_CONFIG_DIRECTORY "gcloud" #define GRPC_GOOGLE_WELL_KNOWN_CREDENTIALS_FILE \ @@ -45,9 +43,7 @@ extern "C" { void grpc_flush_cached_google_default_credentials(void); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_GOOGLE_DEFAULT_GOOGLE_DEFAULT_CREDENTIALS_H \ */ diff --git a/src/core/lib/security/credentials/jwt/json_token.h b/src/core/lib/security/credentials/jwt/json_token.h index b2c3c09c25a..038f470a42a 100644 --- a/src/core/lib/security/credentials/jwt/json_token.h +++ b/src/core/lib/security/credentials/jwt/json_token.h @@ -19,9 +19,7 @@ #ifndef GRPC_CORE_LIB_SECURITY_CREDENTIALS_JWT_JSON_TOKEN_H #define GRPC_CORE_LIB_SECURITY_CREDENTIALS_JWT_JSON_TOKEN_H -#ifdef __cplusplus -extern "C" { -#endif + #include #include @@ -74,8 +72,6 @@ typedef char* (*grpc_jwt_encode_and_sign_override)( void grpc_jwt_encode_and_sign_set_override( grpc_jwt_encode_and_sign_override func); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_JWT_JSON_TOKEN_H */ diff --git a/src/core/lib/security/credentials/jwt/jwt_credentials.h b/src/core/lib/security/credentials/jwt/jwt_credentials.h index d554613eed7..cd461d217ec 100644 --- a/src/core/lib/security/credentials/jwt/jwt_credentials.h +++ b/src/core/lib/security/credentials/jwt/jwt_credentials.h @@ -22,9 +22,7 @@ #include "src/core/lib/security/credentials/credentials.h" #include "src/core/lib/security/credentials/jwt/json_token.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef struct { grpc_call_credentials base; @@ -49,8 +47,6 @@ grpc_service_account_jwt_access_credentials_create_from_auth_json_key( grpc_exec_ctx* exec_ctx, grpc_auth_json_key key, gpr_timespec token_lifetime); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_JWT_JWT_CREDENTIALS_H */ diff --git a/src/core/lib/security/credentials/jwt/jwt_verifier.h b/src/core/lib/security/credentials/jwt/jwt_verifier.h index 8083cf9beb9..98db50887b4 100644 --- a/src/core/lib/security/credentials/jwt/jwt_verifier.h +++ b/src/core/lib/security/credentials/jwt/jwt_verifier.h @@ -32,9 +32,7 @@ #define GRPC_GOOGLE_SERVICE_ACCOUNTS_KEY_URL_PREFIX \ "www.googleapis.com/robot/v1/metadata/x509" -#ifdef __cplusplus -extern "C" { -#endif + /* --- grpc_jwt_verifier_status. --- */ @@ -126,8 +124,6 @@ grpc_jwt_verifier_status grpc_jwt_claims_check(const grpc_jwt_claims* claims, const char* audience); const char* grpc_jwt_issuer_email_domain(const char* issuer); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_JWT_JWT_VERIFIER_H */ diff --git a/src/core/lib/security/credentials/oauth2/oauth2_credentials.h b/src/core/lib/security/credentials/oauth2/oauth2_credentials.h index 32d3ff760d3..57332f0a39e 100644 --- a/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +++ b/src/core/lib/security/credentials/oauth2/oauth2_credentials.h @@ -22,9 +22,7 @@ #include "src/core/lib/json/json.h" #include "src/core/lib/security/credentials/credentials.h" -#ifdef __cplusplus -extern "C" { -#endif + // auth_refresh_token parsing. typedef struct { @@ -106,8 +104,6 @@ grpc_oauth2_token_fetcher_credentials_parse_server_response( grpc_exec_ctx* exec_ctx, const struct grpc_http_response* response, grpc_mdelem* token_md, grpc_millis* token_lifetime); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_OAUTH2_OAUTH2_CREDENTIALS_H */ diff --git a/src/core/lib/security/credentials/ssl/ssl_credentials.h b/src/core/lib/security/credentials/ssl/ssl_credentials.h index 82b9ce11f62..5d10de71a37 100644 --- a/src/core/lib/security/credentials/ssl/ssl_credentials.h +++ b/src/core/lib/security/credentials/ssl/ssl_credentials.h @@ -20,9 +20,7 @@ #include "src/core/lib/security/credentials/credentials.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef struct { grpc_channel_credentials base; @@ -53,8 +51,6 @@ tsi_ssl_pem_key_cert_pair* grpc_convert_grpc_to_tsi_cert_pairs( void grpc_tsi_ssl_pem_key_cert_pairs_destroy(tsi_ssl_pem_key_cert_pair* kp, size_t num_key_cert_pairs); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_SSL_SSL_CREDENTIALS_H */ diff --git a/src/core/lib/security/transport/auth_filters.h b/src/core/lib/security/transport/auth_filters.h index 63769298907..add335d74fc 100644 --- a/src/core/lib/security/transport/auth_filters.h +++ b/src/core/lib/security/transport/auth_filters.h @@ -22,9 +22,7 @@ #include #include "src/core/lib/channel/channel_stack.h" -#ifdef __cplusplus -extern "C" { -#endif + extern const grpc_channel_filter grpc_client_auth_filter; extern const grpc_channel_filter grpc_server_auth_filter; @@ -36,8 +34,6 @@ void grpc_auth_metadata_context_build( void grpc_auth_metadata_context_reset(grpc_auth_metadata_context* context); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SECURITY_TRANSPORT_AUTH_FILTERS_H */ diff --git a/src/core/lib/security/transport/lb_targets_info.h b/src/core/lib/security/transport/lb_targets_info.h index b4a0bc91da9..0442d8df0be 100644 --- a/src/core/lib/security/transport/lb_targets_info.h +++ b/src/core/lib/security/transport/lb_targets_info.h @@ -21,9 +21,7 @@ #include "src/core/lib/slice/slice_hash_table.h" -#ifdef __cplusplus -extern "C" { -#endif + /** Return a channel argument containing \a targets_info. */ grpc_arg grpc_lb_targets_info_create_channel_arg( @@ -33,8 +31,6 @@ grpc_arg grpc_lb_targets_info_create_channel_arg( grpc_slice_hash_table* grpc_lb_targets_info_find_in_args( const grpc_channel_args* args); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SECURITY_TRANSPORT_LB_TARGETS_INFO_H */ diff --git a/src/core/lib/security/transport/secure_endpoint.h b/src/core/lib/security/transport/secure_endpoint.h index db8233f6e6f..7f0843f17a4 100644 --- a/src/core/lib/security/transport/secure_endpoint.h +++ b/src/core/lib/security/transport/secure_endpoint.h @@ -22,9 +22,7 @@ #include #include "src/core/lib/iomgr/endpoint.h" -#ifdef __cplusplus -extern "C" { -#endif + struct tsi_frame_protector; struct tsi_zero_copy_grpc_protector; @@ -40,8 +38,6 @@ grpc_endpoint* grpc_secure_endpoint_create( grpc_endpoint* to_wrap, grpc_slice* leftover_slices, size_t leftover_nslices); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SECURITY_TRANSPORT_SECURE_ENDPOINT_H */ diff --git a/src/core/lib/security/transport/security_connector.h b/src/core/lib/security/transport/security_connector.h index 79fdbc1a665..d680db6c8ee 100644 --- a/src/core/lib/security/transport/security_connector.h +++ b/src/core/lib/security/transport/security_connector.h @@ -29,9 +29,7 @@ #include "src/core/tsi/ssl_transport_security.h" #include "src/core/tsi/transport_security_interface.h" -#ifdef __cplusplus -extern "C" { -#endif + #ifndef NDEBUG extern grpc_tracer_flag grpc_trace_security_connector_refcount; @@ -261,8 +259,6 @@ tsi_peer tsi_shallow_peer_from_ssl_auth_context( const grpc_auth_context* auth_context); void tsi_shallow_peer_destruct(tsi_peer* peer); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SECURITY_TRANSPORT_SECURITY_CONNECTOR_H */ diff --git a/src/core/lib/security/transport/security_handshaker.h b/src/core/lib/security/transport/security_handshaker.h index 174f70f0dd0..fd23a784a47 100644 --- a/src/core/lib/security/transport/security_handshaker.h +++ b/src/core/lib/security/transport/security_handshaker.h @@ -23,9 +23,7 @@ #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/security/transport/security_connector.h" -#ifdef __cplusplus -extern "C" { -#endif + /// Creates a security handshaker using \a handshaker. grpc_handshaker* grpc_security_handshaker_create( @@ -35,8 +33,6 @@ grpc_handshaker* grpc_security_handshaker_create( /// Registers security handshaker factories. void grpc_security_register_handshaker_factories(); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SECURITY_TRANSPORT_SECURITY_HANDSHAKER_H */ diff --git a/src/core/lib/security/transport/tsi_error.h b/src/core/lib/security/transport/tsi_error.h index 4e8418f3fd6..9dd7ab4a4ed 100644 --- a/src/core/lib/security/transport/tsi_error.h +++ b/src/core/lib/security/transport/tsi_error.h @@ -22,14 +22,10 @@ #include "src/core/lib/iomgr/error.h" #include "src/core/tsi/transport_security_interface.h" -#ifdef __cplusplus -extern "C" { -#endif + grpc_error* grpc_set_tsi_error_result(grpc_error* error, tsi_result result); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SECURITY_TRANSPORT_TSI_ERROR_H */ diff --git a/src/core/lib/security/util/json_util.h b/src/core/lib/security/util/json_util.h index 7538f76120a..f99edcd153d 100644 --- a/src/core/lib/security/util/json_util.h +++ b/src/core/lib/security/util/json_util.h @@ -28,9 +28,7 @@ #define GRPC_AUTH_JSON_TYPE_SERVICE_ACCOUNT "service_account" #define GRPC_AUTH_JSON_TYPE_AUTHORIZED_USER "authorized_user" -#ifdef __cplusplus -extern "C" { -#endif + // Gets a child property from a json node. const char* grpc_json_get_string_property(const grpc_json* json, @@ -41,8 +39,6 @@ const char* grpc_json_get_string_property(const grpc_json* json, bool grpc_copy_json_string_property(const grpc_json* json, const char* prop_name, char** copied_value); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SECURITY_UTIL_JSON_UTIL_H */ diff --git a/src/core/lib/slice/b64.h b/src/core/lib/slice/b64.h index 467f5d848a0..09a8418fd5b 100644 --- a/src/core/lib/slice/b64.h +++ b/src/core/lib/slice/b64.h @@ -21,9 +21,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + /* Encodes data using base64. It is the caller's responsability to free the returned char * using gpr_free. Returns NULL on NULL input. @@ -51,8 +49,6 @@ grpc_slice grpc_base64_decode(grpc_exec_ctx* exec_ctx, const char* b64, grpc_slice grpc_base64_decode_with_len(grpc_exec_ctx* exec_ctx, const char* b64, size_t b64_len, int url_safe); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SLICE_B64_H */ diff --git a/src/core/lib/slice/percent_encoding.h b/src/core/lib/slice/percent_encoding.h index 22b5e8df316..e7cd0cd2c91 100644 --- a/src/core/lib/slice/percent_encoding.h +++ b/src/core/lib/slice/percent_encoding.h @@ -30,9 +30,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + /* URL percent encoding spec bitfield (usabel as 'unreserved_bytes' in grpc_percent_encode_slice, grpc_strict_percent_decode_slice). @@ -64,8 +62,6 @@ bool grpc_strict_percent_decode_slice(grpc_slice slice_in, This cannot fail. */ grpc_slice grpc_permissive_percent_decode_slice(grpc_slice slice_in); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SLICE_PERCENT_ENCODING_H */ diff --git a/src/core/lib/slice/slice_hash_table.h b/src/core/lib/slice/slice_hash_table.h index f86f25ea7c1..99a3928eeb6 100644 --- a/src/core/lib/slice/slice_hash_table.h +++ b/src/core/lib/slice/slice_hash_table.h @@ -19,9 +19,7 @@ #include "src/core/lib/transport/metadata.h" -#ifdef __cplusplus -extern "C" { -#endif + /** Hash table implementation. * @@ -71,8 +69,6 @@ void* grpc_slice_hash_table_get(const grpc_slice_hash_table* table, int grpc_slice_hash_table_cmp(const grpc_slice_hash_table* a, const grpc_slice_hash_table* b); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SLICE_SLICE_HASH_TABLE_H */ diff --git a/src/core/lib/slice/slice_internal.h b/src/core/lib/slice/slice_internal.h index 2439fc08267..01c0dee87f8 100644 --- a/src/core/lib/slice/slice_internal.h +++ b/src/core/lib/slice/slice_internal.h @@ -24,9 +24,7 @@ #include "src/core/lib/iomgr/exec_ctx.h" -#ifdef __cplusplus -extern "C" { -#endif + grpc_slice grpc_slice_ref_internal(grpc_slice slice); void grpc_slice_unref_internal(grpc_exec_ctx* exec_ctx, grpc_slice slice); @@ -50,8 +48,6 @@ grpc_slice grpc_slice_maybe_static_intern(grpc_slice slice, uint32_t grpc_static_slice_hash(grpc_slice s); int grpc_static_slice_eq(grpc_slice a, grpc_slice b); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SLICE_SLICE_INTERNAL_H */ diff --git a/src/core/lib/slice/slice_string_helpers.h b/src/core/lib/slice/slice_string_helpers.h index acbc41e711c..afbd90331e1 100644 --- a/src/core/lib/slice/slice_string_helpers.h +++ b/src/core/lib/slice/slice_string_helpers.h @@ -28,9 +28,7 @@ #include "src/core/lib/support/string.h" -#ifdef __cplusplus -extern "C" { -#endif + /* Calls gpr_dump on a slice. */ char* grpc_dump_slice(grpc_slice slice, uint32_t flags); @@ -41,8 +39,6 @@ void grpc_slice_split(grpc_slice str, const char* sep, grpc_slice_buffer* dst); bool grpc_parse_slice_to_uint32(grpc_slice str, uint32_t* result); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SLICE_SLICE_STRING_HELPERS_H */ diff --git a/src/core/lib/slice/slice_traits.h b/src/core/lib/slice/slice_traits.h index 7fdb6752cb4..6e314a363bd 100644 --- a/src/core/lib/slice/slice_traits.h +++ b/src/core/lib/slice/slice_traits.h @@ -22,16 +22,12 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif + bool grpc_slice_is_legal_header(grpc_slice s); bool grpc_slice_is_legal_nonbin_header(grpc_slice s); bool grpc_slice_is_bin_suffixed(grpc_slice s); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SLICE_SLICE_TRAITS_H */ diff --git a/src/core/lib/support/arena.h b/src/core/lib/support/arena.h index 4d43c56bb91..9984c53feab 100644 --- a/src/core/lib/support/arena.h +++ b/src/core/lib/support/arena.h @@ -27,9 +27,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + typedef struct gpr_arena gpr_arena; @@ -40,8 +38,6 @@ void* gpr_arena_alloc(gpr_arena* arena, size_t size); // Destroy an arena, returning the total number of bytes allocated size_t gpr_arena_destroy(gpr_arena* arena); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SUPPORT_ARENA_H */ diff --git a/src/core/lib/support/env.h b/src/core/lib/support/env.h index f50d7bcb7a3..fe51b708351 100644 --- a/src/core/lib/support/env.h +++ b/src/core/lib/support/env.h @@ -21,9 +21,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + /* Env utility functions */ @@ -42,8 +40,6 @@ void gpr_setenv(const char* name, const char* value); level of logging. So DO NOT USE THIS. */ const char* gpr_getenv_silent(const char* name, char** dst); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SUPPORT_ENV_H */ diff --git a/src/core/lib/support/log.cc b/src/core/lib/support/log.cc index e9adc6c3490..2a40745e97d 100644 --- a/src/core/lib/support/log.cc +++ b/src/core/lib/support/log.cc @@ -27,7 +27,7 @@ #include #include -extern "C" void gpr_default_log(gpr_log_func_args* args); +void gpr_default_log(gpr_log_func_args* args); static gpr_atm g_log_func = (gpr_atm)gpr_default_log; static gpr_atm g_min_severity_to_print = GPR_LOG_VERBOSITY_UNSET; diff --git a/src/core/lib/support/log_android.cc b/src/core/lib/support/log_android.cc index 73d24cd84d0..648a016b50b 100644 --- a/src/core/lib/support/log_android.cc +++ b/src/core/lib/support/log_android.cc @@ -39,7 +39,7 @@ static android_LogPriority severity_to_log_priority(gpr_log_severity severity) { return ANDROID_LOG_DEFAULT; } -extern "C" void gpr_log(const char* file, int line, gpr_log_severity severity, +void gpr_log(const char* file, int line, gpr_log_severity severity, const char* format, ...) { char* message = NULL; va_list args; @@ -50,7 +50,7 @@ extern "C" void gpr_log(const char* file, int line, gpr_log_severity severity, free(message); } -extern "C" void gpr_default_log(gpr_log_func_args* args) { +void gpr_default_log(gpr_log_func_args* args) { const char* final_slash; const char* display_file; char* output = NULL; diff --git a/src/core/lib/support/log_linux.cc b/src/core/lib/support/log_linux.cc index e0e277fe87a..6b1f1c71e44 100644 --- a/src/core/lib/support/log_linux.cc +++ b/src/core/lib/support/log_linux.cc @@ -56,7 +56,7 @@ void gpr_log(const char* file, int line, gpr_log_severity severity, free(message); } -extern "C" void gpr_default_log(gpr_log_func_args* args) { +void gpr_default_log(gpr_log_func_args* args) { const char* final_slash; char* prefix; const char* display_file; diff --git a/src/core/lib/support/log_posix.cc b/src/core/lib/support/log_posix.cc index e765f913907..9fab480a8d4 100644 --- a/src/core/lib/support/log_posix.cc +++ b/src/core/lib/support/log_posix.cc @@ -56,7 +56,7 @@ void gpr_log(const char* file, int line, gpr_log_severity severity, gpr_free(allocated); } -extern "C" void gpr_default_log(gpr_log_func_args* args) { +void gpr_default_log(gpr_log_func_args* args) { const char* final_slash; const char* display_file; char time_buffer[64]; diff --git a/src/core/lib/support/log_windows.cc b/src/core/lib/support/log_windows.cc index d4481791e20..0013bf448fd 100644 --- a/src/core/lib/support/log_windows.cc +++ b/src/core/lib/support/log_windows.cc @@ -65,7 +65,7 @@ void gpr_log(const char* file, int line, gpr_log_severity severity, } /* Simple starter implementation */ -extern "C" void gpr_default_log(gpr_log_func_args* args) { +void gpr_default_log(gpr_log_func_args* args) { const char* final_slash; const char* display_file; char time_buffer[64]; diff --git a/src/core/lib/support/mpscq.h b/src/core/lib/support/mpscq.h index fb22742050e..743a62b325b 100644 --- a/src/core/lib/support/mpscq.h +++ b/src/core/lib/support/mpscq.h @@ -24,9 +24,7 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif + // Multiple-producer single-consumer lock free queue, based upon the // implementation from Dmitry Vyukov here: @@ -84,8 +82,6 @@ gpr_mpscq_node* gpr_locked_mpscq_try_pop(gpr_locked_mpscq* q); // Pop a node. Returns NULL only if the queue was empty at some point after // calling this function gpr_mpscq_node* gpr_locked_mpscq_pop(gpr_locked_mpscq* q); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SUPPORT_MPSCQ_H */ diff --git a/src/core/lib/support/murmur_hash.h b/src/core/lib/support/murmur_hash.h index d02bba6962f..c28e58af27b 100644 --- a/src/core/lib/support/murmur_hash.h +++ b/src/core/lib/support/murmur_hash.h @@ -23,15 +23,11 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + /* compute the hash of key (length len) */ uint32_t gpr_murmur_hash3(const void* key, size_t len, uint32_t seed); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SUPPORT_MURMUR_HASH_H */ diff --git a/src/core/lib/support/stack_lockfree.h b/src/core/lib/support/stack_lockfree.h index 337ecc2b17a..ebefc7560ce 100644 --- a/src/core/lib/support/stack_lockfree.h +++ b/src/core/lib/support/stack_lockfree.h @@ -21,9 +21,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + typedef struct gpr_stack_lockfree gpr_stack_lockfree; @@ -39,8 +37,6 @@ int gpr_stack_lockfree_push(gpr_stack_lockfree*, int entry); /* Returns -1 on empty or the actual entry number */ int gpr_stack_lockfree_pop(gpr_stack_lockfree* stack); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SUPPORT_STACK_LOCKFREE_H */ diff --git a/src/core/lib/support/string.h b/src/core/lib/support/string.h index 0b18ffcec18..8f95f899ce7 100644 --- a/src/core/lib/support/string.h +++ b/src/core/lib/support/string.h @@ -24,9 +24,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + /* String utility functions */ @@ -109,8 +107,6 @@ void* gpr_memrchr(const void* s, int c, size_t n); /** Return true if lower(s) equals "true", "yes" or "1", otherwise false. */ bool gpr_is_true(const char* s); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SUPPORT_STRING_H */ diff --git a/src/core/lib/support/string_windows.h b/src/core/lib/support/string_windows.h index 67716475813..18932e20a7c 100644 --- a/src/core/lib/support/string_windows.h +++ b/src/core/lib/support/string_windows.h @@ -21,9 +21,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + #ifdef GPR_WINDOWS @@ -33,8 +31,6 @@ LPSTR gpr_tchar_to_char(LPCTSTR input); #endif /* GPR_WINDOWS */ -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SUPPORT_STRING_WINDOWS_H */ diff --git a/src/core/lib/support/time_posix.cc b/src/core/lib/support/time_posix.cc index 7f652058003..47a849480f5 100644 --- a/src/core/lib/support/time_posix.cc +++ b/src/core/lib/support/time_posix.cc @@ -127,9 +127,7 @@ static gpr_timespec now_impl(gpr_clock_type clock) { } #endif -extern "C" { gpr_timespec (*gpr_now_impl)(gpr_clock_type clock_type) = now_impl; -} #ifdef GPR_LOW_LEVEL_COUNTERS gpr_atm gpr_now_call_count; diff --git a/src/core/lib/support/time_precise.h b/src/core/lib/support/time_precise.h index 3befda3d863..650df6ce67b 100644 --- a/src/core/lib/support/time_precise.h +++ b/src/core/lib/support/time_precise.h @@ -21,15 +21,11 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + void gpr_precise_clock_init(void); void gpr_precise_clock_now(gpr_timespec* clk); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SUPPORT_TIME_PRECISE_H */ diff --git a/src/core/lib/support/time_windows.cc b/src/core/lib/support/time_windows.cc index 08c1b22964a..fb17e5c079f 100644 --- a/src/core/lib/support/time_windows.cc +++ b/src/core/lib/support/time_windows.cc @@ -68,9 +68,7 @@ static gpr_timespec now_impl(gpr_clock_type clock) { return now_tv; } -extern "C" { gpr_timespec (*gpr_now_impl)(gpr_clock_type clock_type) = now_impl; -} gpr_timespec gpr_now(gpr_clock_type clock_type) { return gpr_now_impl(clock_type); diff --git a/src/core/lib/support/tmpfile.h b/src/core/lib/support/tmpfile.h index 437d871786c..e28f4cb11f3 100644 --- a/src/core/lib/support/tmpfile.h +++ b/src/core/lib/support/tmpfile.h @@ -21,9 +21,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + /* Creates a temporary file from a prefix. If tmp_filename is not NULL, *tmp_filename is assigned the name of the @@ -31,8 +29,6 @@ extern "C" { unless an error occurs in which case it will be set to NULL. */ FILE* gpr_tmpfile(const char* prefix, char** tmp_filename); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SUPPORT_TMPFILE_H */ diff --git a/src/core/lib/surface/alarm_internal.h b/src/core/lib/surface/alarm_internal.h index 136b60547fa..e4b9f34408f 100644 --- a/src/core/lib/surface/alarm_internal.h +++ b/src/core/lib/surface/alarm_internal.h @@ -22,9 +22,7 @@ #include #include "src/core/lib/debug/trace.h" -#ifdef __cplusplus -extern "C" { -#endif + #ifndef NDEBUG @@ -41,8 +39,6 @@ extern grpc_tracer_flag grpc_trace_alarm_refcount; #endif /* defined(NDEBUG) */ -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SURFACE_ALARM_INTERNAL_H */ diff --git a/src/core/lib/surface/api_trace.h b/src/core/lib/surface/api_trace.h index 105abdf629d..a72d80eaaee 100644 --- a/src/core/lib/surface/api_trace.h +++ b/src/core/lib/surface/api_trace.h @@ -22,9 +22,7 @@ #include #include "src/core/lib/debug/trace.h" -#ifdef __cplusplus -extern "C" { -#endif + extern grpc_tracer_flag grpc_api_trace; @@ -51,8 +49,6 @@ extern grpc_tracer_flag grpc_api_trace; gpr_log(GPR_INFO, fmt GRPC_API_TRACE_UNWRAP##nargs args); \ } -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SURFACE_API_TRACE_H */ diff --git a/src/core/lib/surface/call.h b/src/core/lib/surface/call.h index d4e596f84bd..b30650781c5 100644 --- a/src/core/lib/surface/call.h +++ b/src/core/lib/surface/call.h @@ -19,9 +19,7 @@ #ifndef GRPC_CORE_LIB_SURFACE_CALL_H #define GRPC_CORE_LIB_SURFACE_CALL_H -#ifdef __cplusplus -extern "C" { -#endif + #include "src/core/lib/channel/channel_stack.h" #include "src/core/lib/channel/context.h" @@ -115,8 +113,6 @@ grpc_compression_algorithm grpc_call_compression_for_level( extern grpc_tracer_flag grpc_call_error_trace; extern grpc_tracer_flag grpc_compression_trace; -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SURFACE_CALL_H */ diff --git a/src/core/lib/surface/call_test_only.h b/src/core/lib/surface/call_test_only.h index 2ff4a487d5d..c0815dc0f19 100644 --- a/src/core/lib/surface/call_test_only.h +++ b/src/core/lib/surface/call_test_only.h @@ -21,9 +21,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + /** Return the compression algorithm from \a call. * @@ -54,8 +52,6 @@ uint32_t grpc_call_test_only_get_stream_encodings_accepted_by_peer( grpc_stream_compression_algorithm grpc_call_test_only_get_incoming_stream_encodings(grpc_call* call); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SURFACE_CALL_TEST_ONLY_H */ diff --git a/src/core/lib/surface/channel.h b/src/core/lib/surface/channel.h index 063e685f6b6..c2786b50a2b 100644 --- a/src/core/lib/surface/channel.h +++ b/src/core/lib/surface/channel.h @@ -23,9 +23,7 @@ #include "src/core/lib/channel/channel_stack_builder.h" #include "src/core/lib/surface/channel_stack_type.h" -#ifdef __cplusplus -extern "C" { -#endif + grpc_channel* grpc_channel_create(grpc_exec_ctx* exec_ctx, const char* target, const grpc_channel_args* args, @@ -85,8 +83,6 @@ void grpc_channel_internal_unref(grpc_exec_ctx* exec_ctx, grpc_compression_options grpc_channel_compression_options( const grpc_channel* channel); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SURFACE_CHANNEL_H */ diff --git a/src/core/lib/surface/channel_init.h b/src/core/lib/surface/channel_init.h index 9932781081c..e09fe1fdb82 100644 --- a/src/core/lib/surface/channel_init.h +++ b/src/core/lib/surface/channel_init.h @@ -25,9 +25,7 @@ #define GRPC_CHANNEL_INIT_BUILTIN_PRIORITY 10000 -#ifdef __cplusplus -extern "C" { -#endif + /// This module provides a way for plugins (and the grpc core library itself) /// to register mutators for channel stacks. @@ -74,8 +72,6 @@ bool grpc_channel_init_create_stack(grpc_exec_ctx* exec_ctx, grpc_channel_stack_builder* builder, grpc_channel_stack_type type); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SURFACE_CHANNEL_INIT_H */ diff --git a/src/core/lib/surface/channel_stack_type.h b/src/core/lib/surface/channel_stack_type.h index feecd3aa449..5a26248dfeb 100644 --- a/src/core/lib/surface/channel_stack_type.h +++ b/src/core/lib/surface/channel_stack_type.h @@ -21,9 +21,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + typedef enum { // normal top-half client channel with load-balancing, connection management @@ -46,8 +44,6 @@ bool grpc_channel_stack_type_is_client(grpc_channel_stack_type type); const char* grpc_channel_stack_type_string(grpc_channel_stack_type type); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SURFACE_CHANNEL_STACK_TYPE_H */ diff --git a/src/core/lib/surface/completion_queue.h b/src/core/lib/surface/completion_queue.h index 0ed9875f58e..f4fa9a17f45 100644 --- a/src/core/lib/surface/completion_queue.h +++ b/src/core/lib/surface/completion_queue.h @@ -36,9 +36,7 @@ extern grpc_tracer_flag grpc_trace_pending_tags; extern grpc_tracer_flag grpc_trace_cq_refcount; #endif -#ifdef __cplusplus -extern "C" { -#endif + typedef struct grpc_cq_completion { gpr_mpscq_node node; @@ -98,8 +96,6 @@ int grpc_get_cq_poll_num(grpc_completion_queue* cc); grpc_completion_queue* grpc_completion_queue_create_internal( grpc_cq_completion_type completion_type, grpc_cq_polling_type polling_type); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SURFACE_COMPLETION_QUEUE_H */ diff --git a/src/core/lib/surface/completion_queue_factory.h b/src/core/lib/surface/completion_queue_factory.h index af8f3d60c38..74c1c18b24d 100644 --- a/src/core/lib/surface/completion_queue_factory.h +++ b/src/core/lib/surface/completion_queue_factory.h @@ -22,9 +22,7 @@ #include #include "src/core/lib/surface/completion_queue.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef struct grpc_completion_queue_factory_vtable { grpc_completion_queue* (*create)(const grpc_completion_queue_factory*, @@ -37,8 +35,6 @@ struct grpc_completion_queue_factory { grpc_completion_queue_factory_vtable* vtable; }; -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SURFACE_COMPLETION_QUEUE_FACTORY_H */ diff --git a/src/core/lib/surface/event_string.h b/src/core/lib/surface/event_string.h index 4bdb11f35e8..a7633278629 100644 --- a/src/core/lib/surface/event_string.h +++ b/src/core/lib/surface/event_string.h @@ -21,15 +21,11 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + /* Returns a string describing an event. Must be later freed with gpr_free() */ char* grpc_event_string(grpc_event* ev); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SURFACE_EVENT_STRING_H */ diff --git a/src/core/lib/surface/init.h b/src/core/lib/surface/init.h index d429026327f..c2969f972d1 100644 --- a/src/core/lib/surface/init.h +++ b/src/core/lib/surface/init.h @@ -19,17 +19,13 @@ #ifndef GRPC_CORE_LIB_SURFACE_INIT_H #define GRPC_CORE_LIB_SURFACE_INIT_H -#ifdef __cplusplus -extern "C" { -#endif + void grpc_register_security_filters(void); void grpc_security_pre_init(void); void grpc_security_init(void); int grpc_is_initialized(void); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SURFACE_INIT_H */ diff --git a/src/core/lib/surface/lame_client.cc b/src/core/lib/surface/lame_client.cc index 7114a9f5452..c32c9af50e5 100644 --- a/src/core/lib/surface/lame_client.cc +++ b/src/core/lib/surface/lame_client.cc @@ -25,7 +25,6 @@ #include "src/core/lib/support/atomic.h" -extern "C" { #include "src/core/lib/channel/channel_stack.h" #include "src/core/lib/support/string.h" #include "src/core/lib/surface/api_trace.h" @@ -33,7 +32,6 @@ extern "C" { #include "src/core/lib/surface/channel.h" #include "src/core/lib/surface/lame_client.h" #include "src/core/lib/transport/static_metadata.h" -} namespace grpc_core { @@ -146,7 +144,7 @@ static void destroy_channel_elem(grpc_exec_ctx* exec_ctx, } // namespace grpc_core -extern "C" const grpc_channel_filter grpc_lame_filter = { +const grpc_channel_filter grpc_lame_filter = { grpc_core::lame_start_transport_stream_op_batch, grpc_core::lame_start_transport_op, sizeof(grpc_core::CallData), diff --git a/src/core/lib/surface/lame_client.h b/src/core/lib/surface/lame_client.h index 2f6f9cd046e..964e625f288 100644 --- a/src/core/lib/surface/lame_client.h +++ b/src/core/lib/surface/lame_client.h @@ -21,14 +21,10 @@ #include "src/core/lib/channel/channel_stack.h" -#ifdef __cplusplus -extern "C" { -#endif + extern const grpc_channel_filter grpc_lame_filter; -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SURFACE_LAME_CLIENT_H */ diff --git a/src/core/lib/surface/server.h b/src/core/lib/surface/server.h index e3c43f957d4..e515e3099de 100644 --- a/src/core/lib/surface/server.h +++ b/src/core/lib/surface/server.h @@ -24,9 +24,7 @@ #include "src/core/lib/debug/trace.h" #include "src/core/lib/transport/transport.h" -#ifdef __cplusplus -extern "C" { -#endif + extern const grpc_channel_filter grpc_server_top_filter; @@ -58,8 +56,6 @@ int grpc_server_has_open_connections(grpc_server* server); void grpc_server_get_pollsets(grpc_server* server, grpc_pollset*** pollsets, size_t* pollset_count); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SURFACE_SERVER_H */ diff --git a/src/core/lib/surface/validate_metadata.h b/src/core/lib/surface/validate_metadata.h index 9ca20692b58..30941b5f831 100644 --- a/src/core/lib/surface/validate_metadata.h +++ b/src/core/lib/surface/validate_metadata.h @@ -22,15 +22,11 @@ #include #include "src/core/lib/iomgr/error.h" -#ifdef __cplusplus -extern "C" { -#endif + grpc_error* grpc_validate_header_key_is_legal(grpc_slice slice); grpc_error* grpc_validate_header_nonbin_value_is_legal(grpc_slice slice); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_SURFACE_VALIDATE_METADATA_H */ diff --git a/src/core/lib/transport/byte_stream.h b/src/core/lib/transport/byte_stream.h index 54ad4b97961..8b660b3287b 100644 --- a/src/core/lib/transport/byte_stream.h +++ b/src/core/lib/transport/byte_stream.h @@ -28,9 +28,7 @@ /** Mask of all valid internal flags. */ #define GRPC_WRITE_INTERNAL_USED_MASK (GRPC_WRITE_INTERNAL_COMPRESS) -#ifdef __cplusplus -extern "C" { -#endif + typedef struct grpc_byte_stream grpc_byte_stream; @@ -139,8 +137,6 @@ void grpc_caching_byte_stream_init(grpc_caching_byte_stream* stream, // Resets the byte stream to the start of the underlying stream. void grpc_caching_byte_stream_reset(grpc_caching_byte_stream* stream); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_TRANSPORT_BYTE_STREAM_H */ diff --git a/src/core/lib/transport/connectivity_state.h b/src/core/lib/transport/connectivity_state.h index 792e27c43df..2d8dd148810 100644 --- a/src/core/lib/transport/connectivity_state.h +++ b/src/core/lib/transport/connectivity_state.h @@ -23,9 +23,7 @@ #include "src/core/lib/debug/trace.h" #include "src/core/lib/iomgr/exec_ctx.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef struct grpc_connectivity_state_watcher { /** we keep watchers in a linked list */ @@ -88,8 +86,6 @@ bool grpc_connectivity_state_notify_on_state_change( grpc_exec_ctx* exec_ctx, grpc_connectivity_state_tracker* tracker, grpc_connectivity_state* current, grpc_closure* notify); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_TRANSPORT_CONNECTIVITY_STATE_H */ diff --git a/src/core/lib/transport/error_utils.h b/src/core/lib/transport/error_utils.h index 690e42058af..9cd1bc57d25 100644 --- a/src/core/lib/transport/error_utils.h +++ b/src/core/lib/transport/error_utils.h @@ -23,9 +23,7 @@ #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/transport/http2_errors.h" -#ifdef __cplusplus -extern "C" { -#endif + /// A utility function to get the status code and message to be returned /// to the application. If not set in the top-level message, looks @@ -44,8 +42,6 @@ void grpc_error_get_status(grpc_exec_ctx* exec_ctx, grpc_error* error, /// GRPC_ERROR_CANCELLED bool grpc_error_has_clear_grpc_status(grpc_error* error); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_TRANSPORT_ERROR_UTILS_H */ diff --git a/src/core/lib/transport/metadata.h b/src/core/lib/transport/metadata.h index 7e7e7b4c14a..077b4ce0c51 100644 --- a/src/core/lib/transport/metadata.h +++ b/src/core/lib/transport/metadata.h @@ -29,9 +29,7 @@ extern grpc_tracer_flag grpc_trace_metadata; #endif -#ifdef __cplusplus -extern "C" { -#endif + /* This file provides a mechanism for tracking metadata through the grpc stack. It's not intended for consumption outside of the library. @@ -170,8 +168,6 @@ void grpc_mdelem_unref(grpc_exec_ctx* exec_ctx, grpc_mdelem md); void grpc_mdctx_global_init(void); void grpc_mdctx_global_shutdown(grpc_exec_ctx* exec_ctx); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_TRANSPORT_METADATA_H */ diff --git a/src/core/lib/transport/metadata_batch.h b/src/core/lib/transport/metadata_batch.h index 7d173932497..cae79bf6944 100644 --- a/src/core/lib/transport/metadata_batch.h +++ b/src/core/lib/transport/metadata_batch.h @@ -28,9 +28,7 @@ #include "src/core/lib/transport/metadata.h" #include "src/core/lib/transport/static_metadata.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef struct grpc_linked_mdelem { grpc_mdelem md; @@ -146,8 +144,6 @@ void grpc_metadata_batch_assert_ok(grpc_metadata_batch* comd); } while (0) #endif -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_TRANSPORT_METADATA_BATCH_H */ diff --git a/src/core/lib/transport/service_config.h b/src/core/lib/transport/service_config.h index 405d0f5b41f..7abd278c192 100644 --- a/src/core/lib/transport/service_config.h +++ b/src/core/lib/transport/service_config.h @@ -22,9 +22,7 @@ #include "src/core/lib/json/json.h" #include "src/core/lib/slice/slice_hash_table.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef struct grpc_service_config grpc_service_config; @@ -64,8 +62,6 @@ void* grpc_method_config_table_get(grpc_exec_ctx* exec_ctx, const grpc_slice_hash_table* table, grpc_slice path); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_TRANSPORT_SERVICE_CONFIG_H */ diff --git a/src/core/lib/transport/static_metadata.h b/src/core/lib/transport/static_metadata.h index 8e73d5f2789..d1a962461f4 100644 --- a/src/core/lib/transport/static_metadata.h +++ b/src/core/lib/transport/static_metadata.h @@ -27,9 +27,7 @@ #ifndef GRPC_CORE_LIB_TRANSPORT_STATIC_METADATA_H #define GRPC_CORE_LIB_TRANSPORT_STATIC_METADATA_H -#ifdef __cplusplus -extern "C" { -#endif + #include "src/core/lib/transport/metadata.h" @@ -588,7 +586,5 @@ extern const uint8_t grpc_static_accept_stream_encoding_metadata[4]; (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table \ [grpc_static_accept_stream_encoding_metadata[(algs)]], \ GRPC_MDELEM_STORAGE_STATIC)) -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_TRANSPORT_STATIC_METADATA_H */ diff --git a/src/core/lib/transport/status_conversion.h b/src/core/lib/transport/status_conversion.h index b6fcebd4fa9..70387539c55 100644 --- a/src/core/lib/transport/status_conversion.h +++ b/src/core/lib/transport/status_conversion.h @@ -23,9 +23,7 @@ #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/transport/http2_errors.h" -#ifdef __cplusplus -extern "C" { -#endif + /* Conversion of grpc status codes to http2 error codes (for RST_STREAM) */ grpc_http2_error_code grpc_status_to_http2_error(grpc_status_code status); @@ -37,8 +35,6 @@ grpc_status_code grpc_http2_error_to_grpc_status(grpc_exec_ctx* exec_ctx, grpc_status_code grpc_http2_status_to_grpc_status(int status); int grpc_status_to_http2_status(grpc_status_code status); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_TRANSPORT_STATUS_CONVERSION_H */ diff --git a/src/core/lib/transport/timeout_encoding.h b/src/core/lib/transport/timeout_encoding.h index 9c3c4599c96..4e5034ff15b 100644 --- a/src/core/lib/transport/timeout_encoding.h +++ b/src/core/lib/transport/timeout_encoding.h @@ -27,17 +27,13 @@ #define GRPC_HTTP2_TIMEOUT_ENCODE_MIN_BUFSIZE (GPR_LTOA_MIN_BUFSIZE + 1) -#ifdef __cplusplus -extern "C" { -#endif + /* Encode/decode timeouts to the GRPC over HTTP/2 format; encoding may round up arbitrarily */ void grpc_http2_encode_timeout(grpc_millis timeout, char* buffer); int grpc_http2_decode_timeout(grpc_slice text, grpc_millis* timeout); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_TRANSPORT_TIMEOUT_ENCODING_H */ diff --git a/src/core/lib/transport/transport.h b/src/core/lib/transport/transport.h index 973018e5a52..01f03121b6c 100644 --- a/src/core/lib/transport/transport.h +++ b/src/core/lib/transport/transport.h @@ -31,9 +31,7 @@ #include "src/core/lib/transport/byte_stream.h" #include "src/core/lib/transport/metadata_batch.h" -#ifdef __cplusplus -extern "C" { -#endif + /* forward declarations */ typedef struct grpc_transport grpc_transport; @@ -352,8 +350,6 @@ grpc_transport_op* grpc_make_transport_op(grpc_closure* on_consumed); grpc_transport_stream_op_batch* grpc_make_transport_stream_op( grpc_closure* on_consumed); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_TRANSPORT_TRANSPORT_H */ diff --git a/src/core/lib/transport/transport_impl.h b/src/core/lib/transport/transport_impl.h index 22ad599e2e2..5dedc257073 100644 --- a/src/core/lib/transport/transport_impl.h +++ b/src/core/lib/transport/transport_impl.h @@ -21,9 +21,7 @@ #include "src/core/lib/transport/transport.h" -#ifdef __cplusplus -extern "C" { -#endif + typedef struct grpc_transport_vtable { /* Memory required for a single stream element - this is allocated by upper @@ -73,8 +71,6 @@ struct grpc_transport { const grpc_transport_vtable* vtable; }; -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_LIB_TRANSPORT_TRANSPORT_IMPL_H */ diff --git a/src/core/plugin_registry/grpc_cronet_plugin_registry.cc b/src/core/plugin_registry/grpc_cronet_plugin_registry.cc index e0422f67503..101e29c4819 100644 --- a/src/core/plugin_registry/grpc_cronet_plugin_registry.cc +++ b/src/core/plugin_registry/grpc_cronet_plugin_registry.cc @@ -18,18 +18,18 @@ #include -extern "C" void grpc_http_filters_init(void); -extern "C" void grpc_http_filters_shutdown(void); -extern "C" void grpc_chttp2_plugin_init(void); -extern "C" void grpc_chttp2_plugin_shutdown(void); -extern "C" void grpc_deadline_filter_init(void); -extern "C" void grpc_deadline_filter_shutdown(void); -extern "C" void grpc_client_channel_init(void); -extern "C" void grpc_client_channel_shutdown(void); -extern "C" void grpc_tsi_gts_init(void); -extern "C" void grpc_tsi_gts_shutdown(void); -extern "C" void grpc_server_load_reporting_plugin_init(void); -extern "C" void grpc_server_load_reporting_plugin_shutdown(void); +void grpc_http_filters_init(void); +void grpc_http_filters_shutdown(void); +void grpc_chttp2_plugin_init(void); +void grpc_chttp2_plugin_shutdown(void); +void grpc_deadline_filter_init(void); +void grpc_deadline_filter_shutdown(void); +void grpc_client_channel_init(void); +void grpc_client_channel_shutdown(void); +void grpc_tsi_gts_init(void); +void grpc_tsi_gts_shutdown(void); +void grpc_server_load_reporting_plugin_init(void); +void grpc_server_load_reporting_plugin_shutdown(void); void grpc_register_built_in_plugins(void) { grpc_register_plugin(grpc_http_filters_init, diff --git a/src/core/plugin_registry/grpc_plugin_registry.cc b/src/core/plugin_registry/grpc_plugin_registry.cc index 339c9bb3670..89be3517857 100644 --- a/src/core/plugin_registry/grpc_plugin_registry.cc +++ b/src/core/plugin_registry/grpc_plugin_registry.cc @@ -18,40 +18,40 @@ #include -extern "C" void grpc_http_filters_init(void); -extern "C" void grpc_http_filters_shutdown(void); -extern "C" void grpc_chttp2_plugin_init(void); -extern "C" void grpc_chttp2_plugin_shutdown(void); -extern "C" void grpc_tsi_gts_init(void); -extern "C" void grpc_tsi_gts_shutdown(void); -extern "C" void grpc_deadline_filter_init(void); -extern "C" void grpc_deadline_filter_shutdown(void); -extern "C" void grpc_client_channel_init(void); -extern "C" void grpc_client_channel_shutdown(void); -extern "C" void grpc_inproc_plugin_init(void); -extern "C" void grpc_inproc_plugin_shutdown(void); -extern "C" void grpc_resolver_fake_init(void); -extern "C" void grpc_resolver_fake_shutdown(void); -extern "C" void grpc_lb_policy_grpclb_init(void); -extern "C" void grpc_lb_policy_grpclb_shutdown(void); -extern "C" void grpc_lb_policy_pick_first_init(void); -extern "C" void grpc_lb_policy_pick_first_shutdown(void); -extern "C" void grpc_lb_policy_round_robin_init(void); -extern "C" void grpc_lb_policy_round_robin_shutdown(void); -extern "C" void grpc_resolver_dns_ares_init(void); -extern "C" void grpc_resolver_dns_ares_shutdown(void); -extern "C" void grpc_resolver_dns_native_init(void); -extern "C" void grpc_resolver_dns_native_shutdown(void); -extern "C" void grpc_resolver_sockaddr_init(void); -extern "C" void grpc_resolver_sockaddr_shutdown(void); -extern "C" void grpc_server_load_reporting_plugin_init(void); -extern "C" void grpc_server_load_reporting_plugin_shutdown(void); -extern "C" void grpc_max_age_filter_init(void); -extern "C" void grpc_max_age_filter_shutdown(void); -extern "C" void grpc_message_size_filter_init(void); -extern "C" void grpc_message_size_filter_shutdown(void); -extern "C" void grpc_workaround_cronet_compression_filter_init(void); -extern "C" void grpc_workaround_cronet_compression_filter_shutdown(void); +void grpc_http_filters_init(void); +void grpc_http_filters_shutdown(void); +void grpc_chttp2_plugin_init(void); +void grpc_chttp2_plugin_shutdown(void); +void grpc_tsi_gts_init(void); +void grpc_tsi_gts_shutdown(void); +void grpc_deadline_filter_init(void); +void grpc_deadline_filter_shutdown(void); +void grpc_client_channel_init(void); +void grpc_client_channel_shutdown(void); +void grpc_inproc_plugin_init(void); +void grpc_inproc_plugin_shutdown(void); +void grpc_resolver_fake_init(void); +void grpc_resolver_fake_shutdown(void); +void grpc_lb_policy_grpclb_init(void); +void grpc_lb_policy_grpclb_shutdown(void); +void grpc_lb_policy_pick_first_init(void); +void grpc_lb_policy_pick_first_shutdown(void); +void grpc_lb_policy_round_robin_init(void); +void grpc_lb_policy_round_robin_shutdown(void); +void grpc_resolver_dns_ares_init(void); +void grpc_resolver_dns_ares_shutdown(void); +void grpc_resolver_dns_native_init(void); +void grpc_resolver_dns_native_shutdown(void); +void grpc_resolver_sockaddr_init(void); +void grpc_resolver_sockaddr_shutdown(void); +void grpc_server_load_reporting_plugin_init(void); +void grpc_server_load_reporting_plugin_shutdown(void); +void grpc_max_age_filter_init(void); +void grpc_max_age_filter_shutdown(void); +void grpc_message_size_filter_init(void); +void grpc_message_size_filter_shutdown(void); +void grpc_workaround_cronet_compression_filter_init(void); +void grpc_workaround_cronet_compression_filter_shutdown(void); void grpc_register_built_in_plugins(void) { grpc_register_plugin(grpc_http_filters_init, diff --git a/src/core/plugin_registry/grpc_unsecure_plugin_registry.cc b/src/core/plugin_registry/grpc_unsecure_plugin_registry.cc index c9fc17d34d3..d73f946241e 100644 --- a/src/core/plugin_registry/grpc_unsecure_plugin_registry.cc +++ b/src/core/plugin_registry/grpc_unsecure_plugin_registry.cc @@ -18,38 +18,38 @@ #include -extern "C" void grpc_http_filters_init(void); -extern "C" void grpc_http_filters_shutdown(void); -extern "C" void grpc_chttp2_plugin_init(void); -extern "C" void grpc_chttp2_plugin_shutdown(void); -extern "C" void grpc_deadline_filter_init(void); -extern "C" void grpc_deadline_filter_shutdown(void); -extern "C" void grpc_client_channel_init(void); -extern "C" void grpc_client_channel_shutdown(void); -extern "C" void grpc_inproc_plugin_init(void); -extern "C" void grpc_inproc_plugin_shutdown(void); -extern "C" void grpc_resolver_dns_ares_init(void); -extern "C" void grpc_resolver_dns_ares_shutdown(void); -extern "C" void grpc_resolver_dns_native_init(void); -extern "C" void grpc_resolver_dns_native_shutdown(void); -extern "C" void grpc_resolver_sockaddr_init(void); -extern "C" void grpc_resolver_sockaddr_shutdown(void); -extern "C" void grpc_resolver_fake_init(void); -extern "C" void grpc_resolver_fake_shutdown(void); -extern "C" void grpc_server_load_reporting_plugin_init(void); -extern "C" void grpc_server_load_reporting_plugin_shutdown(void); -extern "C" void grpc_lb_policy_grpclb_init(void); -extern "C" void grpc_lb_policy_grpclb_shutdown(void); -extern "C" void grpc_lb_policy_pick_first_init(void); -extern "C" void grpc_lb_policy_pick_first_shutdown(void); -extern "C" void grpc_lb_policy_round_robin_init(void); -extern "C" void grpc_lb_policy_round_robin_shutdown(void); -extern "C" void grpc_max_age_filter_init(void); -extern "C" void grpc_max_age_filter_shutdown(void); -extern "C" void grpc_message_size_filter_init(void); -extern "C" void grpc_message_size_filter_shutdown(void); -extern "C" void grpc_workaround_cronet_compression_filter_init(void); -extern "C" void grpc_workaround_cronet_compression_filter_shutdown(void); +void grpc_http_filters_init(void); +void grpc_http_filters_shutdown(void); +void grpc_chttp2_plugin_init(void); +void grpc_chttp2_plugin_shutdown(void); +void grpc_deadline_filter_init(void); +void grpc_deadline_filter_shutdown(void); +void grpc_client_channel_init(void); +void grpc_client_channel_shutdown(void); +void grpc_inproc_plugin_init(void); +void grpc_inproc_plugin_shutdown(void); +void grpc_resolver_dns_ares_init(void); +void grpc_resolver_dns_ares_shutdown(void); +void grpc_resolver_dns_native_init(void); +void grpc_resolver_dns_native_shutdown(void); +void grpc_resolver_sockaddr_init(void); +void grpc_resolver_sockaddr_shutdown(void); +void grpc_resolver_fake_init(void); +void grpc_resolver_fake_shutdown(void); +void grpc_server_load_reporting_plugin_init(void); +void grpc_server_load_reporting_plugin_shutdown(void); +void grpc_lb_policy_grpclb_init(void); +void grpc_lb_policy_grpclb_shutdown(void); +void grpc_lb_policy_pick_first_init(void); +void grpc_lb_policy_pick_first_shutdown(void); +void grpc_lb_policy_round_robin_init(void); +void grpc_lb_policy_round_robin_shutdown(void); +void grpc_max_age_filter_init(void); +void grpc_max_age_filter_shutdown(void); +void grpc_message_size_filter_init(void); +void grpc_message_size_filter_shutdown(void); +void grpc_workaround_cronet_compression_filter_init(void); +void grpc_workaround_cronet_compression_filter_shutdown(void); void grpc_register_built_in_plugins(void) { grpc_register_plugin(grpc_http_filters_init, diff --git a/src/core/tsi/fake_transport_security.h b/src/core/tsi/fake_transport_security.h index b90b9962f74..2a6edba0037 100644 --- a/src/core/tsi/fake_transport_security.h +++ b/src/core/tsi/fake_transport_security.h @@ -21,9 +21,7 @@ #include "src/core/tsi/transport_security_interface.h" -#ifdef __cplusplus -extern "C" { -#endif + /* Value for the TSI_CERTIFICATE_TYPE_PEER_PROPERTY property for FAKE certs. */ #define TSI_FAKE_CERTIFICATE_TYPE "FAKE" @@ -44,8 +42,6 @@ tsi_frame_protector* tsi_create_fake_frame_protector( tsi_zero_copy_grpc_protector* tsi_create_fake_zero_copy_grpc_protector( size_t* max_protected_frame_size); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_TSI_FAKE_TRANSPORT_SECURITY_H */ diff --git a/src/core/tsi/gts_transport_security.cc b/src/core/tsi/gts_transport_security.cc index d5948c9516e..2b099773c48 100644 --- a/src/core/tsi/gts_transport_security.cc +++ b/src/core/tsi/gts_transport_security.cc @@ -24,12 +24,12 @@ static gts_shared_resource g_gts_resource; gts_shared_resource* gts_get_shared_resource(void) { return &g_gts_resource; } -extern "C" void grpc_tsi_gts_init() { +void grpc_tsi_gts_init() { memset(&g_gts_resource, 0, sizeof(gts_shared_resource)); gpr_mu_init(&g_gts_resource.mu); } -extern "C" void grpc_tsi_gts_shutdown() { +void grpc_tsi_gts_shutdown() { gpr_mu_destroy(&g_gts_resource.mu); if (g_gts_resource.cq == nullptr) { return; diff --git a/src/core/tsi/gts_transport_security.h b/src/core/tsi/gts_transport_security.h index 8bc21072705..aca03b0d27c 100644 --- a/src/core/tsi/gts_transport_security.h +++ b/src/core/tsi/gts_transport_security.h @@ -23,9 +23,7 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif + typedef struct gts_shared_resource { gpr_thd_id thread_id; @@ -38,8 +36,6 @@ typedef struct gts_shared_resource { * TSI handshakes. */ gts_shared_resource* gts_get_shared_resource(void); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_TSI_GTS_TRANSPORT_SECURITY_H */ diff --git a/src/core/tsi/ssl_transport_security.h b/src/core/tsi/ssl_transport_security.h index 595c4ccaec5..e6011f71a47 100644 --- a/src/core/tsi/ssl_transport_security.h +++ b/src/core/tsi/ssl_transport_security.h @@ -21,9 +21,7 @@ #include "src/core/tsi/transport_security_interface.h" -#ifdef __cplusplus -extern "C" { -#endif + /* Value for the TSI_CERTIFICATE_TYPE_PEER_PROPERTY property for X509 certs. */ #define TSI_X509_CERTIFICATE_TYPE "X509" @@ -193,8 +191,6 @@ const tsi_ssl_handshaker_factory_vtable* tsi_ssl_handshaker_factory_swap_vtable( tsi_ssl_handshaker_factory* factory, tsi_ssl_handshaker_factory_vtable* new_vtable); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_TSI_SSL_TRANSPORT_SECURITY_H */ diff --git a/src/core/tsi/ssl_types.h b/src/core/tsi/ssl_types.h index e0e967034b2..06e6b44da94 100644 --- a/src/core/tsi/ssl_types.h +++ b/src/core/tsi/ssl_types.h @@ -19,9 +19,7 @@ #ifndef GRPC_CORE_TSI_SSL_TYPES_H #define GRPC_CORE_TSI_SSL_TYPES_H -#ifdef __cplusplus -extern "C" { -#endif + /* A collection of macros to cast between various integer types that are * used differently between BoringSSL and OpenSSL: @@ -41,8 +39,6 @@ extern "C" { #define TSI_SIZE_AS_SIZE(x) ((int)(x)) #endif -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_TSI_SSL_TYPES_H */ diff --git a/src/core/tsi/transport_security.h b/src/core/tsi/transport_security.h index d639f857fe9..9292e038130 100644 --- a/src/core/tsi/transport_security.h +++ b/src/core/tsi/transport_security.h @@ -24,9 +24,7 @@ #include "src/core/lib/debug/trace.h" #include "src/core/tsi/transport_security_interface.h" -#ifdef __cplusplus -extern "C" { -#endif + extern grpc_tracer_flag tsi_tracing_enabled; @@ -126,8 +124,6 @@ tsi_result tsi_construct_string_peer_property_from_cstring( /* Utils. */ char* tsi_strdup(const char* src); /* Sadly, no strdup in C89. */ -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_TSI_TRANSPORT_SECURITY_H */ diff --git a/src/core/tsi/transport_security_adapter.h b/src/core/tsi/transport_security_adapter.h index 232705f02ca..d999af28212 100644 --- a/src/core/tsi/transport_security_adapter.h +++ b/src/core/tsi/transport_security_adapter.h @@ -21,9 +21,7 @@ #include "src/core/tsi/transport_security_interface.h" -#ifdef __cplusplus -extern "C" { -#endif + /* Create a tsi handshaker that takes an implementation of old interface and converts into an implementation of new interface. In the old interface, @@ -40,8 +38,6 @@ tsi_handshaker* tsi_create_adapter_handshaker(tsi_handshaker* wrapped); the caller. */ tsi_handshaker* tsi_adapter_handshaker_get_wrapped(tsi_handshaker* adapter); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_TSI_TRANSPORT_SECURITY_ADAPTER_H */ diff --git a/src/core/tsi/transport_security_grpc.h b/src/core/tsi/transport_security_grpc.h index 1c54693ec9e..8ebee37b725 100644 --- a/src/core/tsi/transport_security_grpc.h +++ b/src/core/tsi/transport_security_grpc.h @@ -22,9 +22,7 @@ #include #include "src/core/tsi/transport_security.h" -#ifdef __cplusplus -extern "C" { -#endif + /* This method creates a tsi_zero_copy_grpc_protector object. It return TSI_OK assuming there is no fatal error. @@ -77,8 +75,6 @@ struct tsi_zero_copy_grpc_protector { const tsi_zero_copy_grpc_protector_vtable* vtable; }; -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_TSI_TRANSPORT_SECURITY_GRPC_H */ diff --git a/src/core/tsi/transport_security_interface.h b/src/core/tsi/transport_security_interface.h index 54942a6b2a2..fa1924bb625 100644 --- a/src/core/tsi/transport_security_interface.h +++ b/src/core/tsi/transport_security_interface.h @@ -24,9 +24,7 @@ #include "src/core/lib/debug/trace.h" -#ifdef __cplusplus -extern "C" { -#endif + /* --- tsi result --- */ @@ -453,8 +451,6 @@ void tsi_init(); /* This method destroys the shared objects created by tsi_init. */ void tsi_destroy(); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_CORE_TSI_TRANSPORT_SECURITY_INTERFACE_H */ diff --git a/src/cpp/common/channel_arguments.cc b/src/cpp/common/channel_arguments.cc index f89f5f1f03d..cae9ef953ad 100644 --- a/src/cpp/common/channel_arguments.cc +++ b/src/cpp/common/channel_arguments.cc @@ -23,11 +23,10 @@ #include #include #include -extern "C" { #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/socket_mutator.h" -} + namespace grpc { ChannelArguments::ChannelArguments() { diff --git a/src/cpp/common/channel_filter.cc b/src/cpp/common/channel_filter.cc index d1cfd2b48aa..274079f8dd1 100644 --- a/src/cpp/common/channel_filter.cc +++ b/src/cpp/common/channel_filter.cc @@ -18,9 +18,7 @@ #include -extern "C" { #include "src/core/lib/channel/channel_stack.h" -} #include "src/cpp/common/channel_filter.h" #include diff --git a/src/cpp/common/channel_filter.h b/src/cpp/common/channel_filter.h index 4fb81ecb1e8..9fe9cf0aea4 100644 --- a/src/cpp/common/channel_filter.h +++ b/src/cpp/common/channel_filter.h @@ -26,11 +26,9 @@ #include #include -extern "C" { #include "src/core/lib/channel/channel_stack.h" #include "src/core/lib/surface/channel_init.h" #include "src/core/lib/transport/metadata_batch.h" -} /// An interface to define filters. /// diff --git a/src/cpp/common/core_codegen.cc b/src/cpp/common/core_codegen.cc index 3cbf08af9fc..936d6996b26 100644 --- a/src/cpp/common/core_codegen.cc +++ b/src/cpp/common/core_codegen.cc @@ -33,9 +33,7 @@ #include "src/core/lib/profiling/timers.h" -extern "C" { struct grpc_byte_buffer; -} namespace grpc { diff --git a/templates/src/core/plugin_registry.template b/templates/src/core/plugin_registry.template index 8d7617129f8..805ae9049f0 100644 --- a/templates/src/core/plugin_registry.template +++ b/templates/src/core/plugin_registry.template @@ -25,8 +25,8 @@ template: | #include %for plugin in selected.plugins: - extern "C" void ${plugin}_init(void); - extern "C" void ${plugin}_shutdown(void); + void ${plugin}_init(void); + void ${plugin}_shutdown(void); %endfor void grpc_register_built_in_plugins(void) { diff --git a/test/core/end2end/cq_verifier.h b/test/core/end2end/cq_verifier.h index 0b3b3fb3495..90c93f11f11 100644 --- a/test/core/end2end/cq_verifier.h +++ b/test/core/end2end/cq_verifier.h @@ -24,9 +24,7 @@ #include #include "test/core/util/test_config.h" -#ifdef __cplusplus -extern "C" { -#endif + /* A cq_verifier can verify that expected events arrive in a timely fashion on a single completion queue */ @@ -63,8 +61,6 @@ int contains_metadata(grpc_metadata_array* array, const char* key, int contains_metadata_slices(grpc_metadata_array* array, grpc_slice key, grpc_slice value); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_TEST_CORE_END2END_CQ_VERIFIER_H */ diff --git a/test/core/end2end/data/ssl_test_data.h b/test/core/end2end/data/ssl_test_data.h index e9c7dbceb2c..558e6cfe976 100644 --- a/test/core/end2end/data/ssl_test_data.h +++ b/test/core/end2end/data/ssl_test_data.h @@ -19,9 +19,7 @@ #ifndef GRPC_TEST_CORE_END2END_DATA_SSL_TEST_DATA_H #define GRPC_TEST_CORE_END2END_DATA_SSL_TEST_DATA_H -#ifdef __cplusplus -extern "C" { -#endif + extern const char test_root_cert[]; extern const char test_server1_cert[]; @@ -31,8 +29,6 @@ extern const char test_self_signed_client_key[]; extern const char test_signed_client_cert[]; extern const char test_signed_client_key[]; -#ifdef __cplusplus -} -#endif + #endif /* GRPC_TEST_CORE_END2END_DATA_SSL_TEST_DATA_H */ diff --git a/test/core/end2end/end2end_tests.h b/test/core/end2end/end2end_tests.h index 33943a72718..a56c955d1b9 100644 --- a/test/core/end2end/end2end_tests.h +++ b/test/core/end2end/end2end_tests.h @@ -21,9 +21,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + typedef struct grpc_end2end_test_fixture grpc_end2end_test_fixture; typedef struct grpc_end2end_test_config grpc_end2end_test_config; @@ -78,8 +76,6 @@ const grpc_slice* get_host_override_slice(const char* str, void validate_host_override_string(const char* pattern, grpc_slice str, grpc_end2end_test_config config); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_TEST_CORE_END2END_END2END_TESTS_H */ diff --git a/test/core/end2end/fuzzers/api_fuzzer.cc b/test/core/end2end/fuzzers/api_fuzzer.cc index b8ec12586ee..f169a7dbed5 100644 --- a/test/core/end2end/fuzzers/api_fuzzer.cc +++ b/test/core/end2end/fuzzers/api_fuzzer.cc @@ -441,7 +441,7 @@ grpc_ares_request* my_dns_lookup_ares( // client connection // defined in tcp_client_posix.c -extern "C" void (*grpc_tcp_client_connect_impl)( +void (*grpc_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* addr, grpc_millis deadline); diff --git a/test/core/end2end/tests/no_logging.cc b/test/core/end2end/tests/no_logging.cc index 55d211c44a2..bf8651221a6 100644 --- a/test/core/end2end/tests/no_logging.cc +++ b/test/core/end2end/tests/no_logging.cc @@ -36,7 +36,7 @@ enum { TIMEOUT = 200000 }; static void* tag(intptr_t t) { return (void*)t; } -extern "C" void gpr_default_log(gpr_log_func_args* args); +void gpr_default_log(gpr_log_func_args* args); static void test_no_log(gpr_log_func_args* args) { char* message = nullptr; diff --git a/test/core/util/port.h b/test/core/util/port.h index 602099dea6d..bb4fd91fee6 100644 --- a/test/core/util/port.h +++ b/test/core/util/port.h @@ -19,9 +19,7 @@ #ifndef GRPC_TEST_CORE_UTIL_PORT_H #define GRPC_TEST_CORE_UTIL_PORT_H -#ifdef __cplusplus -extern "C" { -#endif + typedef struct grpc_pick_port_functions { int (*pick_unused_port_fn)(void); @@ -45,8 +43,6 @@ void grpc_recycle_unused_port(int port); /** Request the family of pick_port functions in \a functions be used. */ void grpc_set_pick_port_functions(grpc_pick_port_functions functions); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_TEST_CORE_UTIL_PORT_H */ diff --git a/test/core/util/test_config.h b/test/core/util/test_config.h index 4383fbfce89..adfec486627 100644 --- a/test/core/util/test_config.h +++ b/test/core/util/test_config.h @@ -21,9 +21,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif + extern int64_t g_fixture_slowdown_factor; extern int64_t g_poller_slowdown_factor; @@ -43,8 +41,6 @@ gpr_timespec grpc_timeout_milliseconds_to_deadline(int64_t time_ms); void grpc_test_init(int argc, char** argv); -#ifdef __cplusplus -} -#endif + #endif /* GRPC_TEST_CORE_UTIL_TEST_CONFIG_H */ diff --git a/test/cpp/client/client_channel_stress_test.cc b/test/cpp/client/client_channel_stress_test.cc index 8940f6ff9e8..0954b28df01 100644 --- a/test/cpp/client/client_channel_stress_test.cc +++ b/test/cpp/client/client_channel_stress_test.cc @@ -34,10 +34,8 @@ #include #include -extern "C" { #include "src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h" #include "src/core/lib/iomgr/sockaddr.h" -} #include "test/core/util/port.h" #include "test/core/util/test_config.h" diff --git a/test/cpp/interop/stress_test.cc b/test/cpp/interop/stress_test.cc index 028ff11b209..4b39dc3211f 100644 --- a/test/cpp/interop/stress_test.cc +++ b/test/cpp/interop/stress_test.cc @@ -36,9 +36,7 @@ #include "test/cpp/util/metrics_server.h" #include "test/cpp/util/test_config.h" -extern "C" { extern void gpr_default_log(gpr_log_func_args* args); -} DEFINE_int32(metrics_port, 8081, "The metrics server port."); From 01a7547a3f409e004b9f6df4314c1f42e53a9448 Mon Sep 17 00:00:00 2001 From: ncteisen Date: Thu, 16 Nov 2017 16:04:42 -0800 Subject: [PATCH 32/86] Re 89 the public headers --- include/grpc/census.h | 8 ++++++-- include/grpc/compression.h | 8 ++++++-- include/grpc/grpc.h | 8 ++++++-- include/grpc/grpc_cronet.h | 8 ++++++-- include/grpc/grpc_posix.h | 8 ++++++-- include/grpc/grpc_security.h | 8 ++++++-- include/grpc/grpc_security_constants.h | 8 ++++++-- include/grpc/impl/codegen/atm.h | 8 ++++++-- include/grpc/impl/codegen/atm_gcc_atomic.h | 8 ++++++-- include/grpc/impl/codegen/byte_buffer.h | 8 ++++++-- include/grpc/impl/codegen/byte_buffer_reader.h | 8 ++++++-- include/grpc/impl/codegen/compression_types.h | 8 ++++++-- include/grpc/impl/codegen/connectivity_state.h | 8 ++++++-- include/grpc/impl/codegen/gpr_types.h | 8 ++++++-- include/grpc/impl/codegen/grpc_types.h | 8 ++++++-- include/grpc/impl/codegen/propagation_bits.h | 8 ++++++-- include/grpc/impl/codegen/status.h | 8 ++++++-- include/grpc/impl/codegen/sync.h | 8 ++++++-- include/grpc/load_reporting.h | 8 ++++++-- include/grpc/slice.h | 8 ++++++-- include/grpc/slice_buffer.h | 8 ++++++-- include/grpc/support/alloc.h | 8 ++++++-- include/grpc/support/avl.h | 8 ++++++-- include/grpc/support/cmdline.h | 8 ++++++-- include/grpc/support/cpu.h | 8 ++++++-- include/grpc/support/histogram.h | 8 ++++++-- include/grpc/support/host_port.h | 8 ++++++-- include/grpc/support/log.h | 8 ++++++-- include/grpc/support/log_windows.h | 8 ++++++-- include/grpc/support/string_util.h | 8 ++++++-- include/grpc/support/subprocess.h | 8 ++++++-- include/grpc/support/sync.h | 8 +++++++- include/grpc/support/thd.h | 8 ++++++-- include/grpc/support/time.h | 8 ++++++-- include/grpc/support/tls_pthread.h | 8 ++++++-- 35 files changed, 211 insertions(+), 69 deletions(-) diff --git a/include/grpc/census.h b/include/grpc/census.h index d7f2fab50b5..2258af88989 100644 --- a/include/grpc/census.h +++ b/include/grpc/census.h @@ -21,7 +21,9 @@ #include - +#ifdef __cplusplus +extern "C" { +#endif /** A Census Context is a handle used by Census to represent the current tracing @@ -29,6 +31,8 @@ (this is the responsibility of the local RPC system). */ typedef struct census_context census_context; - +#ifdef __cplusplus +} +#endif #endif /* GRPC_CENSUS_H */ diff --git a/include/grpc/compression.h b/include/grpc/compression.h index c0db8c2bfa6..b42f428d7de 100644 --- a/include/grpc/compression.h +++ b/include/grpc/compression.h @@ -26,7 +26,9 @@ #include #include - +#ifdef __cplusplus +extern "C" { +#endif /** Parses the \a slice as a grpc_compression_algorithm instance and updating \a * algorithm. Returns 1 upon success, 0 otherwise. */ @@ -83,6 +85,8 @@ GRPCAPI int grpc_compression_options_is_stream_compression_algorithm_enabled( const grpc_compression_options* opts, grpc_stream_compression_algorithm algorithm); - +#ifdef __cplusplus +} +#endif #endif /* GRPC_COMPRESSION_H */ diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 6d6d56a7b36..f083bc591e6 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -29,7 +29,9 @@ #include #include - +#ifdef __cplusplus +extern "C" { +#endif /*! \mainpage GRPC Core * @@ -464,6 +466,8 @@ GRPCAPI void grpc_resource_quota_resize(grpc_resource_quota* resource_quota, */ GRPCAPI const grpc_arg_pointer_vtable* grpc_resource_quota_arg_vtable(void); - +#ifdef __cplusplus +} +#endif #endif /* GRPC_GRPC_H */ diff --git a/include/grpc/grpc_cronet.h b/include/grpc/grpc_cronet.h index b3e7ec2705d..127d5d038d0 100644 --- a/include/grpc/grpc_cronet.h +++ b/include/grpc/grpc_cronet.h @@ -21,12 +21,16 @@ #include - +#ifdef __cplusplus +extern "C" { +#endif GRPCAPI grpc_channel* grpc_cronet_secure_channel_create( void* engine, const char* target, const grpc_channel_args* args, void* reserved); - +#ifdef __cplusplus +} +#endif #endif /* GRPC_GRPC_CRONET_H */ diff --git a/include/grpc/grpc_posix.h b/include/grpc/grpc_posix.h index f14cbaa81bb..fa7ebced3f3 100644 --- a/include/grpc/grpc_posix.h +++ b/include/grpc/grpc_posix.h @@ -24,7 +24,9 @@ #include - +#ifdef __cplusplus +extern "C" { +#endif /*! \mainpage GRPC Core POSIX * @@ -57,6 +59,8 @@ GRPCAPI void grpc_server_add_insecure_channel_from_fd(grpc_server* server, - This API is optional but if called, it MUST be called before grpc_init() */ GRPCAPI void grpc_use_signal(int signum); - +#ifdef __cplusplus +} +#endif #endif /* GRPC_GRPC_POSIX_H */ diff --git a/include/grpc/grpc_security.h b/include/grpc/grpc_security.h index f2a05074c2d..7e87217de78 100644 --- a/include/grpc/grpc_security.h +++ b/include/grpc/grpc_security.h @@ -23,7 +23,9 @@ #include #include - +#ifdef __cplusplus +extern "C" { +#endif /** --- Authentication Context. --- */ @@ -459,6 +461,8 @@ typedef struct { GRPCAPI void grpc_server_credentials_set_auth_metadata_processor( grpc_server_credentials* creds, grpc_auth_metadata_processor processor); - +#ifdef __cplusplus +} +#endif #endif /* GRPC_GRPC_SECURITY_H */ diff --git a/include/grpc/grpc_security_constants.h b/include/grpc/grpc_security_constants.h index 1923525ea05..60e167eb885 100644 --- a/include/grpc/grpc_security_constants.h +++ b/include/grpc/grpc_security_constants.h @@ -19,7 +19,9 @@ #ifndef GRPC_GRPC_SECURITY_CONSTANTS_H #define GRPC_GRPC_SECURITY_CONSTANTS_H - +#ifdef __cplusplus +extern "C" { +#endif #define GRPC_TRANSPORT_SECURITY_TYPE_PROPERTY_NAME "transport_security_type" #define GRPC_SSL_TRANSPORT_SECURITY_TYPE "ssl" @@ -97,6 +99,8 @@ typedef enum { GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY } grpc_ssl_client_certificate_request_type; - +#ifdef __cplusplus +} +#endif #endif /* GRPC_GRPC_SECURITY_CONSTANTS_H */ diff --git a/include/grpc/impl/codegen/atm.h b/include/grpc/impl/codegen/atm.h index 7bb41c55d2a..00d83f0604f 100644 --- a/include/grpc/impl/codegen/atm.h +++ b/include/grpc/impl/codegen/atm.h @@ -79,13 +79,17 @@ #error could not determine platform for atm #endif - +#ifdef __cplusplus +extern "C" { +#endif /** Adds \a delta to \a *value, clamping the result to the range specified by \a min and \a max. Returns the new value. */ gpr_atm gpr_atm_no_barrier_clamped_add(gpr_atm* value, gpr_atm delta, gpr_atm min, gpr_atm max); - +#ifdef __cplusplus +} +#endif #endif /* GRPC_IMPL_CODEGEN_ATM_H */ diff --git a/include/grpc/impl/codegen/atm_gcc_atomic.h b/include/grpc/impl/codegen/atm_gcc_atomic.h index 52eebb3c728..58797085482 100644 --- a/include/grpc/impl/codegen/atm_gcc_atomic.h +++ b/include/grpc/impl/codegen/atm_gcc_atomic.h @@ -23,7 +23,9 @@ __atomic_* interface. */ #include - +#ifdef __cplusplus +extern "C" { +#endif typedef intptr_t gpr_atm; #define GPR_ATM_MAX INTPTR_MAX @@ -82,6 +84,8 @@ static __inline int gpr_atm_full_cas(gpr_atm* p, gpr_atm o, gpr_atm n) { #define gpr_atm_full_xchg(p, n) \ GPR_ATM_INC_CAS_THEN(__atomic_exchange_n((p), (n), __ATOMIC_ACQ_REL)) - +#ifdef __cplusplus +} +#endif #endif /* GRPC_IMPL_CODEGEN_ATM_GCC_ATOMIC_H */ diff --git a/include/grpc/impl/codegen/byte_buffer.h b/include/grpc/impl/codegen/byte_buffer.h index 082fb9b36fb..f8dfbd1d7dc 100644 --- a/include/grpc/impl/codegen/byte_buffer.h +++ b/include/grpc/impl/codegen/byte_buffer.h @@ -21,7 +21,9 @@ #include - +#ifdef __cplusplus +extern "C" { +#endif /** Returns a RAW byte buffer instance over the given slices (up to \a nslices). * @@ -77,6 +79,8 @@ grpc_byte_buffer_reader_readall(grpc_byte_buffer_reader* reader); GRPCAPI grpc_byte_buffer* grpc_raw_byte_buffer_from_reader( grpc_byte_buffer_reader* reader); - +#ifdef __cplusplus +} +#endif #endif /* GRPC_IMPL_CODEGEN_BYTE_BUFFER_H */ diff --git a/include/grpc/impl/codegen/byte_buffer_reader.h b/include/grpc/impl/codegen/byte_buffer_reader.h index adb64e78316..e06e19558a1 100644 --- a/include/grpc/impl/codegen/byte_buffer_reader.h +++ b/include/grpc/impl/codegen/byte_buffer_reader.h @@ -19,7 +19,9 @@ #ifndef GRPC_IMPL_CODEGEN_BYTE_BUFFER_READER_H #define GRPC_IMPL_CODEGEN_BYTE_BUFFER_READER_H - +#ifdef __cplusplus +extern "C" { +#endif struct grpc_byte_buffer; @@ -33,6 +35,8 @@ struct grpc_byte_buffer_reader { } current; }; - +#ifdef __cplusplus +} +#endif #endif /* GRPC_IMPL_CODEGEN_BYTE_BUFFER_READER_H */ diff --git a/include/grpc/impl/codegen/compression_types.h b/include/grpc/impl/codegen/compression_types.h index ad19ea6b31f..4419e2a4479 100644 --- a/include/grpc/impl/codegen/compression_types.h +++ b/include/grpc/impl/codegen/compression_types.h @@ -21,7 +21,9 @@ #include - +#ifdef __cplusplus +extern "C" { +#endif /** To be used as initial metadata key for the request of a concrete compression * algorithm */ @@ -155,6 +157,8 @@ typedef struct grpc_compression_options { } grpc_compression_options; - +#ifdef __cplusplus +} +#endif #endif /* GRPC_IMPL_CODEGEN_COMPRESSION_TYPES_H */ diff --git a/include/grpc/impl/codegen/connectivity_state.h b/include/grpc/impl/codegen/connectivity_state.h index 713652de24f..b70dbef3564 100644 --- a/include/grpc/impl/codegen/connectivity_state.h +++ b/include/grpc/impl/codegen/connectivity_state.h @@ -19,7 +19,9 @@ #ifndef GRPC_IMPL_CODEGEN_CONNECTIVITY_STATE_H #define GRPC_IMPL_CODEGEN_CONNECTIVITY_STATE_H - +#ifdef __cplusplus +extern "C" { +#endif /** Connectivity state of a channel. */ typedef enum { @@ -35,6 +37,8 @@ typedef enum { GRPC_CHANNEL_SHUTDOWN } grpc_connectivity_state; - +#ifdef __cplusplus +} +#endif #endif /* GRPC_IMPL_CODEGEN_CONNECTIVITY_STATE_H */ diff --git a/include/grpc/impl/codegen/gpr_types.h b/include/grpc/impl/codegen/gpr_types.h index 153d4ec7db0..d7bb54527ec 100644 --- a/include/grpc/impl/codegen/gpr_types.h +++ b/include/grpc/impl/codegen/gpr_types.h @@ -23,7 +23,9 @@ #include - +#ifdef __cplusplus +extern "C" { +#endif /** The clocks we support. */ typedef enum { @@ -50,6 +52,8 @@ typedef struct gpr_timespec { gpr_clock_type clock_type; } gpr_timespec; - +#ifdef __cplusplus +} +#endif #endif /* GRPC_IMPL_CODEGEN_GPR_TYPES_H */ diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h index faa21a4e409..03be610d255 100644 --- a/include/grpc/impl/codegen/grpc_types.h +++ b/include/grpc/impl/codegen/grpc_types.h @@ -29,7 +29,9 @@ #include - +#ifdef __cplusplus +extern "C" { +#endif typedef enum { GRPC_BB_RAW @@ -626,6 +628,8 @@ typedef struct grpc_completion_queue_attributes { /** The completion queue factory structure is opaque to the callers of grpc */ typedef struct grpc_completion_queue_factory grpc_completion_queue_factory; - +#ifdef __cplusplus +} +#endif #endif /* GRPC_IMPL_CODEGEN_GRPC_TYPES_H */ diff --git a/include/grpc/impl/codegen/propagation_bits.h b/include/grpc/impl/codegen/propagation_bits.h index 4eac3806fcd..824bdbd8c9b 100644 --- a/include/grpc/impl/codegen/propagation_bits.h +++ b/include/grpc/impl/codegen/propagation_bits.h @@ -21,7 +21,9 @@ #include - +#ifdef __cplusplus +extern "C" { +#endif /** Propagation bits: this can be bitwise or-ed to form propagation_mask for * grpc_call */ @@ -43,6 +45,8 @@ 0xffff | GRPC_PROPAGATE_DEADLINE | GRPC_PROPAGATE_CENSUS_STATS_CONTEXT | \ GRPC_PROPAGATE_CENSUS_TRACING_CONTEXT | GRPC_PROPAGATE_CANCELLATION))) - +#ifdef __cplusplus +} +#endif #endif /* GRPC_IMPL_CODEGEN_PROPAGATION_BITS_H */ diff --git a/include/grpc/impl/codegen/status.h b/include/grpc/impl/codegen/status.h index 4f1bce3a921..9bc3dc95609 100644 --- a/include/grpc/impl/codegen/status.h +++ b/include/grpc/impl/codegen/status.h @@ -19,7 +19,9 @@ #ifndef GRPC_IMPL_CODEGEN_STATUS_H #define GRPC_IMPL_CODEGEN_STATUS_H - +#ifdef __cplusplus +extern "C" { +#endif typedef enum { /** Not an error; returned on success */ @@ -144,6 +146,8 @@ typedef enum { GRPC_STATUS__DO_NOT_USE = -1 } grpc_status_code; - +#ifdef __cplusplus +} +#endif #endif /* GRPC_IMPL_CODEGEN_STATUS_H */ diff --git a/include/grpc/impl/codegen/sync.h b/include/grpc/impl/codegen/sync.h index b9cd7204c00..6cdb0c5153d 100644 --- a/include/grpc/impl/codegen/sync.h +++ b/include/grpc/impl/codegen/sync.h @@ -37,7 +37,9 @@ provides no memory barriers. */ - +#ifdef __cplusplus +extern "C" { +#endif /* Platform-specific type declarations of gpr_mu and gpr_cv. */ #include @@ -53,6 +55,8 @@ #error Unable to determine platform for sync #endif - +#ifdef __cplusplus +} +#endif #endif /* GRPC_IMPL_CODEGEN_SYNC_H */ diff --git a/include/grpc/load_reporting.h b/include/grpc/load_reporting.h index 23ae315a895..55f50ea85e9 100644 --- a/include/grpc/load_reporting.h +++ b/include/grpc/load_reporting.h @@ -21,7 +21,9 @@ #include - +#ifdef __cplusplus +extern "C" { +#endif /** Metadata key for the gRPC LB load balancer token. * @@ -39,6 +41,8 @@ * call. */ #define GRPC_LB_COST_MD_KEY "lb-cost-bin" - +#ifdef __cplusplus +} +#endif #endif /* GRPC_LOAD_REPORTING_H */ diff --git a/include/grpc/slice.h b/include/grpc/slice.h index dd188d68495..10b6a624b32 100644 --- a/include/grpc/slice.h +++ b/include/grpc/slice.h @@ -22,7 +22,9 @@ #include #include - +#ifdef __cplusplus +extern "C" { +#endif /** Increment the refcount of s. Requires slice is initialized. Returns s. */ @@ -161,6 +163,8 @@ GPRAPI grpc_slice grpc_slice_dup(grpc_slice a); NULL's. Returned string must be freed with gpr_free. */ GPRAPI char* grpc_slice_to_c_string(grpc_slice s); - +#ifdef __cplusplus +} +#endif #endif /* GRPC_SLICE_H */ diff --git a/include/grpc/slice_buffer.h b/include/grpc/slice_buffer.h index 4ba9f600a50..6510c151b3c 100644 --- a/include/grpc/slice_buffer.h +++ b/include/grpc/slice_buffer.h @@ -21,7 +21,9 @@ #include - +#ifdef __cplusplus +extern "C" { +#endif /** initialize a slice buffer */ GPRAPI void grpc_slice_buffer_init(grpc_slice_buffer* sb); @@ -74,6 +76,8 @@ GPRAPI grpc_slice grpc_slice_buffer_take_first(grpc_slice_buffer* src); GPRAPI void grpc_slice_buffer_undo_take_first(grpc_slice_buffer* src, grpc_slice slice); - +#ifdef __cplusplus +} +#endif #endif /* GRPC_SLICE_BUFFER_H */ diff --git a/include/grpc/support/alloc.h b/include/grpc/support/alloc.h index d9398a29026..31cb2256385 100644 --- a/include/grpc/support/alloc.h +++ b/include/grpc/support/alloc.h @@ -23,7 +23,9 @@ #include - +#ifdef __cplusplus +extern "C" { +#endif typedef struct gpr_allocation_functions { void* (*malloc_fn)(size_t size); @@ -58,6 +60,8 @@ GPRAPI void gpr_set_allocation_functions(gpr_allocation_functions functions); /** Return the family of allocation functions currently in effect. */ GPRAPI gpr_allocation_functions gpr_get_allocation_functions(); - +#ifdef __cplusplus +} +#endif #endif /* GRPC_SUPPORT_ALLOC_H */ diff --git a/include/grpc/support/avl.h b/include/grpc/support/avl.h index d43196f99bc..b5a8c0ffa1c 100644 --- a/include/grpc/support/avl.h +++ b/include/grpc/support/avl.h @@ -21,7 +21,9 @@ #include - +#ifdef __cplusplus +extern "C" { +#endif /** internal node of an AVL tree */ typedef struct gpr_avl_node { @@ -93,6 +95,8 @@ GPRAPI int gpr_avl_maybe_get(gpr_avl avl, void* key, void** value, /** Return 1 if avl is empty, 0 otherwise */ GPRAPI int gpr_avl_is_empty(gpr_avl avl); - +#ifdef __cplusplus +} +#endif #endif /* GRPC_SUPPORT_AVL_H */ diff --git a/include/grpc/support/cmdline.h b/include/grpc/support/cmdline.h index e242eb592ba..c34a109fbd9 100644 --- a/include/grpc/support/cmdline.h +++ b/include/grpc/support/cmdline.h @@ -21,7 +21,9 @@ #include - +#ifdef __cplusplus +extern "C" { +#endif /** Simple command line parser. @@ -79,6 +81,8 @@ GPRAPI void gpr_cmdline_destroy(gpr_cmdline* cl); /** Get a string describing usage */ GPRAPI char* gpr_cmdline_usage_string(gpr_cmdline* cl, const char* argv0); - +#ifdef __cplusplus +} +#endif #endif /* GRPC_SUPPORT_CMDLINE_H */ diff --git a/include/grpc/support/cpu.h b/include/grpc/support/cpu.h index dbc7c92993d..f0e898e8596 100644 --- a/include/grpc/support/cpu.h +++ b/include/grpc/support/cpu.h @@ -21,7 +21,9 @@ #include - +#ifdef __cplusplus +extern "C" { +#endif /** Interface providing CPU information for currently running system */ @@ -35,6 +37,8 @@ GPRAPI unsigned gpr_cpu_num_cores(void); [0, gpr_cpu_num_cores() - 1] */ GPRAPI unsigned gpr_cpu_current_cpu(void); - +#ifdef __cplusplus +} // extern "C" +#endif #endif /* GRPC_SUPPORT_CPU_H */ diff --git a/include/grpc/support/histogram.h b/include/grpc/support/histogram.h index cc08cfa6884..d2794d847e8 100644 --- a/include/grpc/support/histogram.h +++ b/include/grpc/support/histogram.h @@ -22,7 +22,9 @@ #include #include - +#ifdef __cplusplus +extern "C" { +#endif typedef struct gpr_histogram gpr_histogram; @@ -55,6 +57,8 @@ GPRAPI void gpr_histogram_merge_contents(gpr_histogram* histogram, double max_seen, double sum, double sum_of_squares, double count); - +#ifdef __cplusplus +} +#endif #endif /* GRPC_SUPPORT_HISTOGRAM_H */ diff --git a/include/grpc/support/host_port.h b/include/grpc/support/host_port.h index 7880b642b55..9805811bfb6 100644 --- a/include/grpc/support/host_port.h +++ b/include/grpc/support/host_port.h @@ -21,7 +21,9 @@ #include - +#ifdef __cplusplus +extern "C" { +#endif /** Given a host and port, creates a newly-allocated string of the form "host:port" or "[ho:st]:port", depending on whether the host contains colons @@ -42,6 +44,8 @@ GPRAPI int gpr_join_host_port(char** out, const char* host, int port); failure. */ GPRAPI int gpr_split_host_port(const char* name, char** host, char** port); - +#ifdef __cplusplus +} +#endif #endif /* GRPC_SUPPORT_HOST_PORT_H */ diff --git a/include/grpc/support/log.h b/include/grpc/support/log.h index af8e6231306..497cca90815 100644 --- a/include/grpc/support/log.h +++ b/include/grpc/support/log.h @@ -25,7 +25,9 @@ #include - +#ifdef __cplusplus +extern "C" { +#endif /** GPR log API. @@ -94,6 +96,8 @@ GPRAPI void gpr_set_log_function(gpr_log_func func); } \ } while (0) - +#ifdef __cplusplus +} +#endif #endif /* GRPC_SUPPORT_LOG_H */ diff --git a/include/grpc/support/log_windows.h b/include/grpc/support/log_windows.h index 93d4fc73c4e..e833f9d9dfd 100644 --- a/include/grpc/support/log_windows.h +++ b/include/grpc/support/log_windows.h @@ -21,7 +21,9 @@ #include - +#ifdef __cplusplus +extern "C" { +#endif /** Returns a string allocated with gpr_malloc that contains a UTF-8 * formatted error message, corresponding to the error messageid. @@ -29,6 +31,8 @@ */ GPRAPI char* gpr_format_message(int messageid); - +#ifdef __cplusplus +} +#endif #endif /* GRPC_SUPPORT_LOG_WINDOWS_H */ diff --git a/include/grpc/support/string_util.h b/include/grpc/support/string_util.h index 5c5b60d67e5..2c7460fa157 100644 --- a/include/grpc/support/string_util.h +++ b/include/grpc/support/string_util.h @@ -21,7 +21,9 @@ #include - +#ifdef __cplusplus +extern "C" { +#endif /** String utility functions */ @@ -40,6 +42,8 @@ GPRAPI char* gpr_strdup(const char* src); GPRAPI int gpr_asprintf(char** strp, const char* format, ...) GPR_PRINT_FORMAT_CHECK(2, 3); - +#ifdef __cplusplus +} +#endif #endif /* GRPC_SUPPORT_STRING_UTIL_H */ diff --git a/include/grpc/support/subprocess.h b/include/grpc/support/subprocess.h index a050c1ba827..175f7b50eba 100644 --- a/include/grpc/support/subprocess.h +++ b/include/grpc/support/subprocess.h @@ -21,7 +21,9 @@ #include - +#ifdef __cplusplus +extern "C" { +#endif typedef struct gpr_subprocess gpr_subprocess; @@ -35,6 +37,8 @@ GPRAPI void gpr_subprocess_destroy(gpr_subprocess* p); GPRAPI int gpr_subprocess_join(gpr_subprocess* p); GPRAPI void gpr_subprocess_interrupt(gpr_subprocess* p); - +#ifdef __cplusplus +} // extern "C" +#endif #endif /* GRPC_SUPPORT_SUBPROCESS_H */ diff --git a/include/grpc/support/sync.h b/include/grpc/support/sync.h index 2953e24944f..75192673a6f 100644 --- a/include/grpc/support/sync.h +++ b/include/grpc/support/sync.h @@ -22,7 +22,9 @@ #include /* for gpr_timespec */ #include - +#ifdef __cplusplus +extern "C" { +#endif /** --- Mutex interface --- @@ -271,6 +273,9 @@ GPRAPI intptr_t gpr_stats_read(const gpr_stats_counter* c); } #endif /* 0 */ +#ifdef __cplusplus +} // extern "C" + namespace grpc_core { class mu_guard { @@ -286,5 +291,6 @@ class mu_guard { }; } // namespace grpc_core +#endif #endif /* GRPC_SUPPORT_SYNC_H */ diff --git a/include/grpc/support/thd.h b/include/grpc/support/thd.h index 6d398931be5..225d9d6c755 100644 --- a/include/grpc/support/thd.h +++ b/include/grpc/support/thd.h @@ -29,7 +29,9 @@ #include - +#ifdef __cplusplus +extern "C" { +#endif typedef uintptr_t gpr_thd_id; @@ -67,6 +69,8 @@ GPRAPI gpr_thd_id gpr_thd_currentid(void); Calling this on a detached thread has unpredictable results. */ GPRAPI void gpr_thd_join(gpr_thd_id t); - +#ifdef __cplusplus +} +#endif #endif /* GRPC_SUPPORT_THD_H */ diff --git a/include/grpc/support/time.h b/include/grpc/support/time.h index 1ed5ee6ae40..62d354aafe8 100644 --- a/include/grpc/support/time.h +++ b/include/grpc/support/time.h @@ -24,7 +24,9 @@ #include #include - +#ifdef __cplusplus +extern "C" { +#endif /** Time constants. */ GPRAPI gpr_timespec @@ -81,6 +83,8 @@ GPRAPI void gpr_sleep_until(gpr_timespec until); GPRAPI double gpr_timespec_to_micros(gpr_timespec t); - +#ifdef __cplusplus +} +#endif #endif /* GRPC_SUPPORT_TIME_H */ diff --git a/include/grpc/support/tls_pthread.h b/include/grpc/support/tls_pthread.h index 5a6ff129e8d..fb0edd8e744 100644 --- a/include/grpc/support/tls_pthread.h +++ b/include/grpc/support/tls_pthread.h @@ -34,8 +34,12 @@ struct gpr_pthread_thread_local { #define gpr_tls_init(tls) GPR_ASSERT(0 == pthread_key_create(&(tls)->key, NULL)) #define gpr_tls_destroy(tls) pthread_key_delete((tls)->key) #define gpr_tls_get(tls) ((intptr_t)pthread_getspecific((tls)->key)) - +#ifdef __cplusplus +extern "C" { +#endif intptr_t gpr_tls_set(struct gpr_pthread_thread_local* tls, intptr_t value); - +#ifdef __cplusplus +} +#endif #endif /* GRPC_SUPPORT_TLS_PTHREAD_H */ From 0e6b5b3ba315e636c38d2057c4d130a516740087 Mon Sep 17 00:00:00 2001 From: ncteisen Date: Thu, 16 Nov 2017 16:09:02 -0800 Subject: [PATCH 33/86] Un extern the fuzzers --- src/core/lib/iomgr/tcp_client_uv.cc | 2 -- test/core/client_channel/uri_fuzzer_test.cc | 2 +- test/core/end2end/fuzzers/api_fuzzer.cc | 4 ++-- test/core/end2end/fuzzers/client_fuzzer.cc | 2 +- test/core/end2end/fuzzers/server_fuzzer.cc | 2 +- test/core/http/request_fuzzer.cc | 2 +- test/core/http/response_fuzzer.cc | 2 +- test/core/json/fuzzer.cc | 2 +- test/core/nanopb/fuzzer_response.cc | 2 +- test/core/nanopb/fuzzer_serverlist.cc | 2 +- test/core/security/ssl_server_fuzzer.cc | 2 +- test/core/slice/percent_decode_fuzzer.cc | 2 +- test/core/slice/percent_encode_fuzzer.cc | 2 +- test/core/transport/chttp2/hpack_parser_fuzzer_test.cc | 2 +- test/core/util/fuzzer_corpus_test.cc | 2 +- test/core/util/one_corpus_entry_fuzzer.cc | 2 +- 16 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/core/lib/iomgr/tcp_client_uv.cc b/src/core/lib/iomgr/tcp_client_uv.cc index 15345c8091d..fc1ebbbefd3 100644 --- a/src/core/lib/iomgr/tcp_client_uv.cc +++ b/src/core/lib/iomgr/tcp_client_uv.cc @@ -161,13 +161,11 @@ static void tcp_client_connect_impl(grpc_exec_ctx* exec_ctx, } // overridden by api_fuzzer.c -extern "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_channel_args* channel_args, const grpc_resolved_address* addr, grpc_millis deadline) = tcp_client_connect_impl; -} void grpc_tcp_client_connect(grpc_exec_ctx* exec_ctx, grpc_closure* closure, grpc_endpoint** ep, diff --git a/test/core/client_channel/uri_fuzzer_test.cc b/test/core/client_channel/uri_fuzzer_test.cc index ba31793ff3b..f76c41d4372 100644 --- a/test/core/client_channel/uri_fuzzer_test.cc +++ b/test/core/client_channel/uri_fuzzer_test.cc @@ -28,7 +28,7 @@ bool squelch = true; bool leak_check = true; -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { +int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { char* s = static_cast(gpr_malloc(size + 1)); memcpy(s, data, size); s[size] = 0; diff --git a/test/core/end2end/fuzzers/api_fuzzer.cc b/test/core/end2end/fuzzers/api_fuzzer.cc index f169a7dbed5..9fab1a9382c 100644 --- a/test/core/end2end/fuzzers/api_fuzzer.cc +++ b/test/core/end2end/fuzzers/api_fuzzer.cc @@ -441,7 +441,7 @@ grpc_ares_request* my_dns_lookup_ares( // client connection // defined in tcp_client_posix.c -void (*grpc_tcp_client_connect_impl)( +extern void (*grpc_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* addr, grpc_millis deadline); @@ -740,7 +740,7 @@ static validator* make_finished_batch_validator(call_state* cs, return create_validator(finished_batch, bi); } -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { +int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_test_only_set_slice_hash_seed(0); char* grpc_trace_fuzzer = gpr_getenv("GRPC_TRACE_FUZZER"); if (squelch && grpc_trace_fuzzer == nullptr) gpr_set_log_function(dont_log); diff --git a/test/core/end2end/fuzzers/client_fuzzer.cc b/test/core/end2end/fuzzers/client_fuzzer.cc index ebc8c2780d2..89edaa5ec0f 100644 --- a/test/core/end2end/fuzzers/client_fuzzer.cc +++ b/test/core/end2end/fuzzers/client_fuzzer.cc @@ -37,7 +37,7 @@ static void* tag(int n) { return (void*)(uintptr_t)n; } static void dont_log(gpr_log_func_args* args) {} -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { +int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_test_only_set_slice_hash_seed(0); struct grpc_memory_counters counters; if (squelch) gpr_set_log_function(dont_log); diff --git a/test/core/end2end/fuzzers/server_fuzzer.cc b/test/core/end2end/fuzzers/server_fuzzer.cc index fb6477b5798..b0221294dd4 100644 --- a/test/core/end2end/fuzzers/server_fuzzer.cc +++ b/test/core/end2end/fuzzers/server_fuzzer.cc @@ -35,7 +35,7 @@ static int detag(void* p) { return (int)(uintptr_t)p; } static void dont_log(gpr_log_func_args* args) {} -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { +int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_test_only_set_slice_hash_seed(0); struct grpc_memory_counters counters; if (squelch) gpr_set_log_function(dont_log); diff --git a/test/core/http/request_fuzzer.cc b/test/core/http/request_fuzzer.cc index 368ac1b49db..73f366cd9aa 100644 --- a/test/core/http/request_fuzzer.cc +++ b/test/core/http/request_fuzzer.cc @@ -27,7 +27,7 @@ bool squelch = true; bool leak_check = true; -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { +int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_http_parser parser; grpc_http_request request; memset(&request, 0, sizeof(request)); diff --git a/test/core/http/response_fuzzer.cc b/test/core/http/response_fuzzer.cc index 2a793fddd4b..6c1fea50ae8 100644 --- a/test/core/http/response_fuzzer.cc +++ b/test/core/http/response_fuzzer.cc @@ -26,7 +26,7 @@ bool squelch = true; bool leak_check = true; -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { +int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_http_parser parser; grpc_http_response response; memset(&response, 0, sizeof(response)); diff --git a/test/core/json/fuzzer.cc b/test/core/json/fuzzer.cc index 6dafabb95b3..fd9172ffba6 100644 --- a/test/core/json/fuzzer.cc +++ b/test/core/json/fuzzer.cc @@ -29,7 +29,7 @@ bool squelch = true; bool leak_check = true; -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { +int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { char* s; struct grpc_memory_counters counters; grpc_memory_counters_init(); diff --git a/test/core/nanopb/fuzzer_response.cc b/test/core/nanopb/fuzzer_response.cc index 7039c801cb9..42826c18f3c 100644 --- a/test/core/nanopb/fuzzer_response.cc +++ b/test/core/nanopb/fuzzer_response.cc @@ -28,7 +28,7 @@ bool leak_check = true; static void dont_log(gpr_log_func_args* args) {} -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { +int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { if (squelch) gpr_set_log_function(dont_log); grpc_slice slice = grpc_slice_from_copied_buffer((const char*)data, size); grpc_grpclb_initial_response* response; diff --git a/test/core/nanopb/fuzzer_serverlist.cc b/test/core/nanopb/fuzzer_serverlist.cc index 0a6b1767a1a..059e33d584b 100644 --- a/test/core/nanopb/fuzzer_serverlist.cc +++ b/test/core/nanopb/fuzzer_serverlist.cc @@ -28,7 +28,7 @@ bool leak_check = true; static void dont_log(gpr_log_func_args* args) {} -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { +int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { if (squelch) gpr_set_log_function(dont_log); grpc_slice slice = grpc_slice_from_copied_buffer((const char*)data, size); grpc_grpclb_serverlist* serverlist; diff --git a/test/core/security/ssl_server_fuzzer.cc b/test/core/security/ssl_server_fuzzer.cc index bbb2f6013ee..a2d0f14de05 100644 --- a/test/core/security/ssl_server_fuzzer.cc +++ b/test/core/security/ssl_server_fuzzer.cc @@ -51,7 +51,7 @@ static void on_handshake_done(grpc_exec_ctx* exec_ctx, void* arg, GPR_ASSERT(error != GRPC_ERROR_NONE); } -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { +int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { struct grpc_memory_counters counters; if (squelch) gpr_set_log_function(dont_log); if (leak_check) grpc_memory_counters_init(); diff --git a/test/core/slice/percent_decode_fuzzer.cc b/test/core/slice/percent_decode_fuzzer.cc index 3603177c47f..e6458736d39 100644 --- a/test/core/slice/percent_decode_fuzzer.cc +++ b/test/core/slice/percent_decode_fuzzer.cc @@ -29,7 +29,7 @@ bool squelch = true; bool leak_check = true; -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { +int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { struct grpc_memory_counters counters; grpc_memory_counters_init(); grpc_slice input = grpc_slice_from_copied_buffer((const char*)data, size); diff --git a/test/core/slice/percent_encode_fuzzer.cc b/test/core/slice/percent_encode_fuzzer.cc index c8e3849fc8e..776a998e51c 100644 --- a/test/core/slice/percent_encode_fuzzer.cc +++ b/test/core/slice/percent_encode_fuzzer.cc @@ -51,7 +51,7 @@ static void test(const uint8_t* data, size_t size, const uint8_t* dict) { GPR_ASSERT(counters.total_size_relative == 0); } -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { +int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { test(data, size, grpc_url_percent_encoding_unreserved_bytes); test(data, size, grpc_compatible_percent_encoding_unreserved_bytes); return 0; diff --git a/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc b/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc index 942f25e0b75..01230eb6759 100644 --- a/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc +++ b/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc @@ -34,7 +34,7 @@ static void onhdr(grpc_exec_ctx* exec_ctx, void* ud, grpc_mdelem md) { } static void dont_log(gpr_log_func_args* args) {} -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { +int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_test_only_set_slice_hash_seed(0); if (squelch) gpr_set_log_function(dont_log); grpc_init(); diff --git a/test/core/util/fuzzer_corpus_test.cc b/test/core/util/fuzzer_corpus_test.cc index d7aea54262d..4094fb85484 100644 --- a/test/core/util/fuzzer_corpus_test.cc +++ b/test/core/util/fuzzer_corpus_test.cc @@ -28,7 +28,7 @@ #include "src/core/lib/iomgr/load_file.h" #include "test/core/util/test_config.h" -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size); +int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size); extern "C" bool squelch; extern "C" bool leak_check; diff --git a/test/core/util/one_corpus_entry_fuzzer.cc b/test/core/util/one_corpus_entry_fuzzer.cc index c0b67da1e26..a5512636f72 100644 --- a/test/core/util/one_corpus_entry_fuzzer.cc +++ b/test/core/util/one_corpus_entry_fuzzer.cc @@ -21,7 +21,7 @@ #include #include "src/core/lib/iomgr/load_file.h" -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size); +int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size); extern bool squelch; extern bool leak_check; From 61c4d6b64833822e2db6f90ee0f74e76539c4c10 Mon Sep 17 00:00:00 2001 From: ncteisen Date: Thu, 16 Nov 2017 16:15:32 -0800 Subject: [PATCH 34/86] Fix stats --- src/cpp/util/core_stats.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/cpp/util/core_stats.h b/src/cpp/util/core_stats.h index 00e38bf2660..6366d7d06e7 100644 --- a/src/cpp/util/core_stats.h +++ b/src/cpp/util/core_stats.h @@ -21,9 +21,7 @@ #include "src/proto/grpc/core/stats.pb.h" -extern "C" { #include "src/core/lib/debug/stats.h" -} namespace grpc { From 66dfcf59190f5e2116edf972196c5107c9d563be Mon Sep 17 00:00:00 2001 From: ncteisen Date: Thu, 16 Nov 2017 16:18:51 -0800 Subject: [PATCH 35/86] clang fmt --- src/core/ext/filters/client_channel/client_channel.h | 4 ---- src/core/ext/filters/client_channel/client_channel_factory.h | 4 ---- src/core/ext/filters/client_channel/connector.h | 4 ---- src/core/ext/filters/client_channel/http_connect_handshaker.h | 4 ---- src/core/ext/filters/client_channel/http_proxy.h | 4 ---- src/core/ext/filters/client_channel/lb_policy.h | 4 ---- .../lb_policy/grpclb/client_load_reporting_filter.h | 4 ---- src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h | 4 ---- .../filters/client_channel/lb_policy/grpclb/grpclb_channel.h | 4 ---- .../client_channel/lb_policy/grpclb/grpclb_client_stats.h | 4 ---- .../client_channel/lb_policy/grpclb/load_balancer_api.h | 4 ---- .../ext/filters/client_channel/lb_policy/subchannel_list.h | 4 ---- src/core/ext/filters/client_channel/lb_policy_factory.h | 4 ---- src/core/ext/filters/client_channel/lb_policy_registry.h | 4 ---- src/core/ext/filters/client_channel/parse_address.h | 4 ---- src/core/ext/filters/client_channel/proxy_mapper.h | 4 ---- src/core/ext/filters/client_channel/proxy_mapper_registry.h | 4 ---- src/core/ext/filters/client_channel/resolver.h | 4 ---- .../client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h | 4 ---- .../client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h | 4 ---- .../ext/filters/client_channel/resolver/fake/fake_resolver.h | 4 ---- src/core/ext/filters/client_channel/resolver_factory.h | 4 ---- src/core/ext/filters/client_channel/resolver_registry.h | 4 ---- src/core/ext/filters/client_channel/retry_throttle.h | 4 ---- src/core/ext/filters/client_channel/subchannel.h | 4 ---- src/core/ext/filters/client_channel/subchannel_index.h | 4 ---- src/core/ext/filters/client_channel/uri_parser.h | 4 ---- src/core/ext/filters/deadline/deadline_filter.h | 4 ---- src/core/ext/filters/http/client/http_client_filter.h | 4 ---- .../filters/http/message_compress/message_compress_filter.h | 4 ---- src/core/ext/filters/http/server/http_server_filter.h | 4 ---- .../ext/filters/load_reporting/server_load_reporting_filter.h | 4 ---- .../ext/filters/load_reporting/server_load_reporting_plugin.h | 4 ---- src/core/ext/filters/max_age/max_age_filter.h | 4 ---- src/core/ext/filters/message_size/message_size_filter.h | 4 ---- .../workarounds/workaround_cronet_compression_filter.h | 4 ---- src/core/ext/filters/workarounds/workaround_utils.h | 4 ---- src/core/ext/transport/chttp2/alpn/alpn.h | 4 ---- src/core/ext/transport/chttp2/client/chttp2_connector.h | 4 ---- src/core/ext/transport/chttp2/server/chttp2_server.h | 4 ---- src/core/ext/transport/chttp2/transport/bin_decoder.h | 4 ---- src/core/ext/transport/chttp2/transport/bin_encoder.h | 4 ---- src/core/ext/transport/chttp2/transport/chttp2_transport.h | 4 ---- src/core/ext/transport/chttp2/transport/frame.h | 4 ---- src/core/ext/transport/chttp2/transport/frame_data.h | 4 ---- src/core/ext/transport/chttp2/transport/frame_goaway.h | 4 ---- src/core/ext/transport/chttp2/transport/frame_ping.h | 4 ---- src/core/ext/transport/chttp2/transport/frame_rst_stream.h | 4 ---- src/core/ext/transport/chttp2/transport/frame_settings.h | 4 ---- src/core/ext/transport/chttp2/transport/frame_window_update.h | 4 ---- src/core/ext/transport/chttp2/transport/hpack_encoder.h | 4 ---- src/core/ext/transport/chttp2/transport/hpack_parser.h | 4 ---- src/core/ext/transport/chttp2/transport/hpack_table.h | 4 ---- src/core/ext/transport/chttp2/transport/http2_settings.h | 3 --- src/core/ext/transport/chttp2/transport/huffsyms.h | 4 ---- src/core/ext/transport/chttp2/transport/incoming_metadata.h | 4 ---- src/core/ext/transport/chttp2/transport/internal.h | 4 ---- src/core/ext/transport/chttp2/transport/stream_map.h | 4 ---- src/core/ext/transport/chttp2/transport/varint.h | 4 ---- src/core/ext/transport/cronet/transport/cronet_transport.h | 4 ---- src/core/ext/transport/inproc/inproc_plugin.cc | 4 +--- src/core/ext/transport/inproc/inproc_transport.h | 4 ---- src/core/lib/backoff/backoff.h | 4 ---- src/core/lib/channel/channel_args.h | 4 ---- src/core/lib/channel/channel_stack.h | 4 ---- src/core/lib/channel/channel_stack_builder.h | 4 ---- src/core/lib/channel/connected_channel.h | 4 ---- src/core/lib/channel/handshaker.h | 4 ---- src/core/lib/channel/handshaker_factory.h | 4 ---- src/core/lib/channel/handshaker_registry.h | 4 ---- src/core/lib/compression/algorithm_metadata.h | 4 ---- src/core/lib/compression/message_compress.h | 4 ---- src/core/lib/compression/stream_compression.h | 4 ---- src/core/lib/compression/stream_compression_gzip.h | 4 ---- src/core/lib/compression/stream_compression_identity.h | 4 ---- src/core/lib/debug/stats.h | 4 ---- src/core/lib/debug/stats_data.h | 4 ---- src/core/lib/debug/trace.h | 4 ---- src/core/lib/http/format_request.h | 4 ---- src/core/lib/http/httpcli.h | 4 ---- src/core/lib/http/parser.h | 4 ---- src/core/lib/iomgr/block_annotate.h | 4 ---- src/core/lib/iomgr/call_combiner.h | 4 ---- src/core/lib/iomgr/combiner.h | 4 ---- src/core/lib/iomgr/endpoint.h | 4 ---- src/core/lib/iomgr/endpoint_pair.h | 4 ---- src/core/lib/iomgr/error.h | 4 ---- src/core/lib/iomgr/error_internal.h | 4 ---- src/core/lib/iomgr/ev_epoll1_linux.h | 4 ---- src/core/lib/iomgr/ev_epollex_linux.h | 4 ---- src/core/lib/iomgr/ev_epollsig_linux.h | 4 ---- src/core/lib/iomgr/ev_poll_posix.h | 4 ---- src/core/lib/iomgr/ev_posix.h | 4 ---- src/core/lib/iomgr/exec_ctx.h | 2 -- src/core/lib/iomgr/executor.h | 4 ---- src/core/lib/iomgr/gethostname.h | 4 ---- src/core/lib/iomgr/iocp_windows.h | 4 ---- src/core/lib/iomgr/iomgr.h | 4 ---- src/core/lib/iomgr/iomgr_internal.h | 4 ---- src/core/lib/iomgr/iomgr_uv.h | 4 ---- src/core/lib/iomgr/is_epollexclusive_available.h | 4 ---- src/core/lib/iomgr/load_file.h | 4 ---- src/core/lib/iomgr/polling_entity.h | 3 --- src/core/lib/iomgr/pollset.h | 4 ---- src/core/lib/iomgr/pollset_set.h | 4 ---- src/core/lib/iomgr/pollset_uv.h | 4 ---- src/core/lib/iomgr/pollset_windows.h | 4 ---- src/core/lib/iomgr/resolve_address.h | 4 ---- src/core/lib/iomgr/resource_quota.h | 4 ---- src/core/lib/iomgr/sockaddr_utils.h | 4 ---- src/core/lib/iomgr/socket_factory_posix.h | 4 ---- src/core/lib/iomgr/socket_mutator.h | 4 ---- src/core/lib/iomgr/socket_utils.h | 4 ---- src/core/lib/iomgr/socket_utils_posix.h | 4 ---- src/core/lib/iomgr/socket_windows.h | 4 ---- src/core/lib/iomgr/tcp_client.h | 4 ---- src/core/lib/iomgr/tcp_client_posix.h | 4 ---- src/core/lib/iomgr/tcp_posix.h | 4 ---- src/core/lib/iomgr/tcp_server.h | 4 ---- src/core/lib/iomgr/tcp_server_utils_posix.h | 4 ---- src/core/lib/iomgr/tcp_uv.h | 4 ---- src/core/lib/iomgr/tcp_windows.h | 4 ---- src/core/lib/iomgr/time_averaged_stats.h | 4 ---- src/core/lib/iomgr/timer.h | 4 ---- src/core/lib/iomgr/timer_heap.h | 4 ---- src/core/lib/iomgr/timer_manager.h | 4 ---- src/core/lib/iomgr/udp_server.h | 4 ---- src/core/lib/iomgr/unix_sockets_posix.h | 4 ---- src/core/lib/iomgr/wakeup_fd_cv.h | 4 ---- src/core/lib/iomgr/wakeup_fd_pipe.h | 4 ---- src/core/lib/iomgr/wakeup_fd_posix.h | 4 ---- src/core/lib/json/json.h | 4 ---- src/core/lib/json/json_reader.h | 4 ---- src/core/lib/json/json_writer.h | 4 ---- src/core/lib/profiling/timers.h | 2 -- src/core/lib/security/context/security_context.h | 4 ---- .../security/credentials/composite/composite_credentials.h | 4 ---- src/core/lib/security/credentials/credentials.h | 4 ---- src/core/lib/security/credentials/fake/fake_credentials.h | 4 ---- .../credentials/google_default/google_default_credentials.h | 4 ---- src/core/lib/security/credentials/jwt/json_token.h | 4 ---- src/core/lib/security/credentials/jwt/jwt_credentials.h | 4 ---- src/core/lib/security/credentials/jwt/jwt_verifier.h | 4 ---- src/core/lib/security/credentials/oauth2/oauth2_credentials.h | 4 ---- src/core/lib/security/credentials/ssl/ssl_credentials.h | 4 ---- src/core/lib/security/transport/auth_filters.h | 4 ---- src/core/lib/security/transport/lb_targets_info.h | 4 ---- src/core/lib/security/transport/secure_endpoint.h | 4 ---- src/core/lib/security/transport/security_connector.h | 4 ---- src/core/lib/security/transport/security_handshaker.h | 4 ---- src/core/lib/security/transport/tsi_error.h | 4 ---- src/core/lib/security/util/json_util.h | 4 ---- src/core/lib/slice/b64.h | 4 ---- src/core/lib/slice/percent_encoding.h | 4 ---- src/core/lib/slice/slice_hash_table.h | 4 ---- src/core/lib/slice/slice_internal.h | 4 ---- src/core/lib/slice/slice_string_helpers.h | 4 ---- src/core/lib/slice/slice_traits.h | 4 ---- src/core/lib/support/arena.h | 4 ---- src/core/lib/support/env.h | 4 ---- src/core/lib/support/log_android.cc | 2 +- src/core/lib/support/mpscq.h | 3 --- src/core/lib/support/murmur_hash.h | 4 ---- src/core/lib/support/stack_lockfree.h | 4 ---- src/core/lib/support/string.h | 3 --- src/core/lib/support/string_windows.h | 4 ---- src/core/lib/support/time_precise.h | 4 ---- src/core/lib/support/tmpfile.h | 4 ---- src/core/lib/surface/alarm_internal.h | 4 ---- src/core/lib/surface/api_trace.h | 4 ---- src/core/lib/surface/call.h | 4 ---- src/core/lib/surface/call_test_only.h | 4 ---- src/core/lib/surface/channel.h | 4 ---- src/core/lib/surface/channel_init.h | 4 ---- src/core/lib/surface/channel_stack_type.h | 4 ---- src/core/lib/surface/completion_queue.h | 4 ---- src/core/lib/surface/completion_queue_factory.h | 4 ---- src/core/lib/surface/event_string.h | 4 ---- src/core/lib/surface/init.h | 4 ---- src/core/lib/surface/lame_client.h | 4 ---- src/core/lib/surface/server.h | 4 ---- src/core/lib/surface/validate_metadata.h | 4 ---- src/core/lib/transport/byte_stream.h | 4 ---- src/core/lib/transport/connectivity_state.h | 4 ---- src/core/lib/transport/error_utils.h | 4 ---- src/core/lib/transport/metadata.h | 4 ---- src/core/lib/transport/metadata_batch.h | 4 ---- src/core/lib/transport/service_config.h | 4 ---- src/core/lib/transport/static_metadata.h | 2 -- src/core/lib/transport/status_conversion.h | 4 ---- src/core/lib/transport/timeout_encoding.h | 4 ---- src/core/lib/transport/transport.h | 4 ---- src/core/lib/transport/transport_impl.h | 4 ---- src/core/tsi/fake_transport_security.h | 4 ---- src/core/tsi/gts_transport_security.h | 4 ---- src/core/tsi/ssl_transport_security.h | 4 ---- src/core/tsi/ssl_types.h | 4 ---- src/core/tsi/transport_security.h | 4 ---- src/core/tsi/transport_security_adapter.h | 4 ---- src/core/tsi/transport_security_grpc.h | 4 ---- src/core/tsi/transport_security_interface.h | 4 ---- test/core/end2end/cq_verifier.h | 4 ---- test/core/end2end/data/ssl_test_data.h | 4 ---- test/core/end2end/end2end_tests.h | 4 ---- test/core/util/port.h | 4 ---- test/core/util/test_config.h | 4 ---- 206 files changed, 2 insertions(+), 810 deletions(-) diff --git a/src/core/ext/filters/client_channel/client_channel.h b/src/core/ext/filters/client_channel/client_channel.h index 36165172a2f..9307842b5cf 100644 --- a/src/core/ext/filters/client_channel/client_channel.h +++ b/src/core/ext/filters/client_channel/client_channel.h @@ -28,8 +28,6 @@ extern grpc_tracer_flag grpc_client_channel_trace; // Channel arg key for server URI string. #define GRPC_ARG_SERVER_URI "grpc.server_uri" - - /* A client channel is a channel that begins disconnected, and can connect to some endpoint on demand. If that endpoint disconnects, it will be connected to again later. @@ -54,6 +52,4 @@ void grpc_client_channel_watch_connectivity_state( grpc_subchannel_call* grpc_client_channel_get_subchannel_call( grpc_call_element* elem); - - #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_CLIENT_CHANNEL_H */ diff --git a/src/core/ext/filters/client_channel/client_channel_factory.h b/src/core/ext/filters/client_channel/client_channel_factory.h index 9616e9fad01..db82b733cee 100644 --- a/src/core/ext/filters/client_channel/client_channel_factory.h +++ b/src/core/ext/filters/client_channel/client_channel_factory.h @@ -27,8 +27,6 @@ // Channel arg key for client channel factory. #define GRPC_ARG_CLIENT_CHANNEL_FACTORY "grpc.client_channel_factory" - - typedef struct grpc_client_channel_factory grpc_client_channel_factory; typedef struct grpc_client_channel_factory_vtable grpc_client_channel_factory_vtable; @@ -76,6 +74,4 @@ grpc_channel* grpc_client_channel_factory_create_channel( grpc_arg grpc_client_channel_factory_create_channel_arg( grpc_client_channel_factory* factory); - - #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_CLIENT_CHANNEL_FACTORY_H */ diff --git a/src/core/ext/filters/client_channel/connector.h b/src/core/ext/filters/client_channel/connector.h index 62b943852fe..239ed8a8bd1 100644 --- a/src/core/ext/filters/client_channel/connector.h +++ b/src/core/ext/filters/client_channel/connector.h @@ -23,8 +23,6 @@ #include "src/core/lib/iomgr/resolve_address.h" #include "src/core/lib/transport/transport.h" - - typedef struct grpc_connector grpc_connector; typedef struct grpc_connector_vtable grpc_connector_vtable; @@ -72,6 +70,4 @@ void grpc_connector_connect(grpc_exec_ctx* exec_ctx, grpc_connector* connector, void grpc_connector_shutdown(grpc_exec_ctx* exec_ctx, grpc_connector* connector, grpc_error* why); - - #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_CONNECTOR_H */ diff --git a/src/core/ext/filters/client_channel/http_connect_handshaker.h b/src/core/ext/filters/client_channel/http_connect_handshaker.h index c676c2ad550..928a23dc936 100644 --- a/src/core/ext/filters/client_channel/http_connect_handshaker.h +++ b/src/core/ext/filters/client_channel/http_connect_handshaker.h @@ -28,11 +28,7 @@ /// seperated by colons. #define GRPC_ARG_HTTP_CONNECT_HEADERS "grpc.http_connect_headers" - - /// Registers handshaker factory. void grpc_http_connect_register_handshaker_factory(); - - #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_HTTP_CONNECT_HANDSHAKER_H */ diff --git a/src/core/ext/filters/client_channel/http_proxy.h b/src/core/ext/filters/client_channel/http_proxy.h index 894f5482736..34694931d04 100644 --- a/src/core/ext/filters/client_channel/http_proxy.h +++ b/src/core/ext/filters/client_channel/http_proxy.h @@ -19,10 +19,6 @@ #ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_HTTP_PROXY_H #define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_HTTP_PROXY_H - - void grpc_register_http_proxy_mapper(); - - #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_HTTP_PROXY_H */ diff --git a/src/core/ext/filters/client_channel/lb_policy.h b/src/core/ext/filters/client_channel/lb_policy.h index 7c1f1942efd..ef42758f4cd 100644 --- a/src/core/ext/filters/client_channel/lb_policy.h +++ b/src/core/ext/filters/client_channel/lb_policy.h @@ -23,8 +23,6 @@ #include "src/core/lib/iomgr/polling_entity.h" #include "src/core/lib/transport/connectivity_state.h" - - /** A load balancing policy: specified by a vtable and a struct (which is expected to be extended to contain some parameters) */ typedef struct grpc_lb_policy grpc_lb_policy; @@ -206,6 +204,4 @@ void grpc_lb_policy_update_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy, const grpc_lb_policy_args* lb_policy_args); - - #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_H */ diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h b/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h index b6cbd1b3c44..04de7a04df6 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h @@ -21,11 +21,7 @@ #include "src/core/lib/channel/channel_stack.h" - - extern const grpc_channel_filter grpc_client_load_reporting_filter; - - #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_CLIENT_LOAD_REPORTING_FILTER_H \ */ diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h index 14895945169..0a2edb0e3da 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h @@ -21,13 +21,9 @@ #include "src/core/ext/filters/client_channel/lb_policy_factory.h" - - /** Returns a load balancing factory for the glb policy, which tries to connect * to a load balancing server to decide the next successfully connected * subchannel to pick. */ grpc_lb_policy_factory* grpc_glb_lb_factory_create(); - - #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_GRPCLB_H */ diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h index 4bc8d71a390..70b1c28b0da 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h @@ -23,8 +23,6 @@ #include "src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h" #include "src/core/lib/slice/slice_hash_table.h" - - /** Create the channel used for communicating with an LB service. * Note that an LB *service* may be comprised of several LB *servers*. * @@ -42,7 +40,5 @@ grpc_channel_args* grpc_lb_policy_grpclb_build_lb_channel_args( grpc_fake_resolver_response_generator* response_generator, const grpc_channel_args* args); - - #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_GRPCLB_CHANNEL_H \ */ diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h index 54eaa3e5c7c..d4b9d068488 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h @@ -23,8 +23,6 @@ #include - - typedef struct grpc_grpclb_client_stats grpc_grpclb_client_stats; typedef struct { @@ -63,7 +61,5 @@ void grpc_grpclb_client_stats_get_locked( void grpc_grpclb_dropped_call_counts_destroy( grpc_grpclb_dropped_call_counts* drop_entries); - - #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_GRPCLB_CLIENT_STATS_H \ */ diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h b/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h index d0e632b10ee..017c40ec1a3 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h @@ -25,8 +25,6 @@ #include "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h" #include "src/core/ext/filters/client_channel/lb_policy_factory.h" - - #define GRPC_GRPCLB_SERVICE_NAME_MAX_LENGTH 128 typedef grpc_lb_v1_Server_ip_address_t grpc_grpclb_ip_address; @@ -85,7 +83,5 @@ grpc_millis grpc_grpclb_duration_to_millis(grpc_grpclb_duration* duration_pb); void grpc_grpclb_initial_response_destroy( grpc_grpclb_initial_response* response); - - #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_LOAD_BALANCER_API_H \ */ diff --git a/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h b/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h index f3db9b15fcf..ef3102934cd 100644 --- a/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +++ b/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h @@ -36,8 +36,6 @@ // round_robin that could be refactored and moved here. In a future PR, // need to clean this up. - - typedef struct grpc_lb_subchannel_list grpc_lb_subchannel_list; typedef struct { @@ -144,6 +142,4 @@ void grpc_lb_subchannel_list_shutdown_and_unref( grpc_exec_ctx* exec_ctx, grpc_lb_subchannel_list* subchannel_list, const char* reason); - - #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_SUBCHANNEL_LIST_H */ diff --git a/src/core/ext/filters/client_channel/lb_policy_factory.h b/src/core/ext/filters/client_channel/lb_policy_factory.h index 79c771221d8..8f6d8c1b082 100644 --- a/src/core/ext/filters/client_channel/lb_policy_factory.h +++ b/src/core/ext/filters/client_channel/lb_policy_factory.h @@ -29,8 +29,6 @@ // Channel arg key for grpc_lb_addresses. #define GRPC_ARG_LB_ADDRESSES "grpc.lb_addresses" - - typedef struct grpc_lb_policy_factory grpc_lb_policy_factory; typedef struct grpc_lb_policy_factory_vtable grpc_lb_policy_factory_vtable; @@ -132,6 +130,4 @@ grpc_lb_policy* grpc_lb_policy_factory_create_lb_policy( grpc_exec_ctx* exec_ctx, grpc_lb_policy_factory* factory, grpc_lb_policy_args* args); - - #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_FACTORY_H */ diff --git a/src/core/ext/filters/client_channel/lb_policy_registry.h b/src/core/ext/filters/client_channel/lb_policy_registry.h index de089a8fc8c..acddc90fddc 100644 --- a/src/core/ext/filters/client_channel/lb_policy_registry.h +++ b/src/core/ext/filters/client_channel/lb_policy_registry.h @@ -22,8 +22,6 @@ #include "src/core/ext/filters/client_channel/lb_policy_factory.h" #include "src/core/lib/iomgr/exec_ctx.h" - - /** Initialize the registry and set \a default_factory as the factory to be * returned when no name is provided in a lookup */ void grpc_lb_policy_registry_init(void); @@ -39,6 +37,4 @@ void grpc_register_lb_policy(grpc_lb_policy_factory* factory); grpc_lb_policy* grpc_lb_policy_create(grpc_exec_ctx* exec_ctx, const char* name, grpc_lb_policy_args* args); - - #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_REGISTRY_H */ diff --git a/src/core/ext/filters/client_channel/parse_address.h b/src/core/ext/filters/client_channel/parse_address.h index 825cd123933..ca0a0d18f03 100644 --- a/src/core/ext/filters/client_channel/parse_address.h +++ b/src/core/ext/filters/client_channel/parse_address.h @@ -24,8 +24,6 @@ #include "src/core/ext/filters/client_channel/uri_parser.h" #include "src/core/lib/iomgr/resolve_address.h" - - /** Populate \a resolved_addr from \a uri, whose path is expected to contain a * unix socket path. Returns true upon success. */ bool grpc_parse_unix(const grpc_uri* uri, grpc_resolved_address* resolved_addr); @@ -47,6 +45,4 @@ bool grpc_parse_ipv4_hostport(const char* hostport, grpc_resolved_address* addr, bool grpc_parse_ipv6_hostport(const char* hostport, grpc_resolved_address* addr, bool log_errors); - - #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_PARSE_ADDRESS_H */ diff --git a/src/core/ext/filters/client_channel/proxy_mapper.h b/src/core/ext/filters/client_channel/proxy_mapper.h index 81ecfb71bb5..a13861ccaf9 100644 --- a/src/core/ext/filters/client_channel/proxy_mapper.h +++ b/src/core/ext/filters/client_channel/proxy_mapper.h @@ -25,8 +25,6 @@ #include "src/core/lib/iomgr/resolve_address.h" - - typedef struct grpc_proxy_mapper grpc_proxy_mapper; typedef struct { @@ -73,6 +71,4 @@ bool grpc_proxy_mapper_map_address(grpc_exec_ctx* exec_ctx, void grpc_proxy_mapper_destroy(grpc_proxy_mapper* mapper); - - #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_PROXY_MAPPER_H */ diff --git a/src/core/ext/filters/client_channel/proxy_mapper_registry.h b/src/core/ext/filters/client_channel/proxy_mapper_registry.h index f17fdd89df9..99e54d1a78b 100644 --- a/src/core/ext/filters/client_channel/proxy_mapper_registry.h +++ b/src/core/ext/filters/client_channel/proxy_mapper_registry.h @@ -21,8 +21,6 @@ #include "src/core/ext/filters/client_channel/proxy_mapper.h" - - void grpc_proxy_mapper_registry_init(); void grpc_proxy_mapper_registry_shutdown(); @@ -43,6 +41,4 @@ bool grpc_proxy_mappers_map_address(grpc_exec_ctx* exec_ctx, grpc_resolved_address** new_address, grpc_channel_args** new_args); - - #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_PROXY_MAPPER_REGISTRY_H */ diff --git a/src/core/ext/filters/client_channel/resolver.h b/src/core/ext/filters/client_channel/resolver.h index ac956662407..c0901f02259 100644 --- a/src/core/ext/filters/client_channel/resolver.h +++ b/src/core/ext/filters/client_channel/resolver.h @@ -22,8 +22,6 @@ #include "src/core/ext/filters/client_channel/subchannel.h" #include "src/core/lib/iomgr/iomgr.h" - - typedef struct grpc_resolver grpc_resolver; typedef struct grpc_resolver_vtable grpc_resolver_vtable; @@ -89,6 +87,4 @@ void grpc_resolver_next_locked(grpc_exec_ctx* exec_ctx, grpc_resolver* resolver, grpc_channel_args** result, grpc_closure* on_complete); - - #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_H */ diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h index 54e04f7aeb8..03ea36bfcc4 100644 --- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h @@ -23,8 +23,6 @@ #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/pollset_set.h" - - typedef struct grpc_ares_ev_driver grpc_ares_ev_driver; /* Start \a ev_driver. It will keep working until all IO on its ares_channel is @@ -52,7 +50,5 @@ void grpc_ares_ev_driver_destroy(grpc_ares_ev_driver* ev_driver); void grpc_ares_ev_driver_shutdown(grpc_exec_ctx* exec_ctx, grpc_ares_ev_driver* ev_driver); - - #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_DNS_C_ARES_GRPC_ARES_EV_DRIVER_H \ */ diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h index 8c6499f8f86..72db6229544 100644 --- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h @@ -25,8 +25,6 @@ #include "src/core/lib/iomgr/polling_entity.h" #include "src/core/lib/iomgr/resolve_address.h" - - typedef struct grpc_ares_request grpc_ares_request; /* Asynchronously resolve \a name. Use \a default_port if a port isn't @@ -67,7 +65,5 @@ grpc_error* grpc_ares_init(void); it has been called the same number of times as grpc_ares_init(). */ void grpc_ares_cleanup(void); - - #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_DNS_C_ARES_GRPC_ARES_WRAPPER_H \ */ diff --git a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h index c56c34b59c2..7035cdda019 100644 --- a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +++ b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h @@ -21,8 +21,6 @@ #include "src/core/ext/filters/client_channel/uri_parser.h" #include "src/core/lib/channel/channel_args.h" - - #define GRPC_ARG_FAKE_RESOLVER_RESPONSE_GENERATOR \ "grpc.fake_resolver.response_generator" @@ -58,7 +56,5 @@ grpc_fake_resolver_response_generator_ref( void grpc_fake_resolver_response_generator_unref( grpc_fake_resolver_response_generator* generator); - - #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_FAKE_FAKE_RESOLVER_H \ */ diff --git a/src/core/ext/filters/client_channel/resolver_factory.h b/src/core/ext/filters/client_channel/resolver_factory.h index 8bba90d0ace..fcf8ec425ec 100644 --- a/src/core/ext/filters/client_channel/resolver_factory.h +++ b/src/core/ext/filters/client_channel/resolver_factory.h @@ -24,8 +24,6 @@ #include "src/core/ext/filters/client_channel/uri_parser.h" #include "src/core/lib/iomgr/pollset_set.h" - - typedef struct grpc_resolver_factory grpc_resolver_factory; typedef struct grpc_resolver_factory_vtable grpc_resolver_factory_vtable; @@ -69,6 +67,4 @@ grpc_resolver* grpc_resolver_factory_create_resolver( char* grpc_resolver_factory_get_default_authority( grpc_resolver_factory* factory, grpc_uri* uri); - - #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_FACTORY_H */ diff --git a/src/core/ext/filters/client_channel/resolver_registry.h b/src/core/ext/filters/client_channel/resolver_registry.h index 6f7f8945c31..ecc9f824e8b 100644 --- a/src/core/ext/filters/client_channel/resolver_registry.h +++ b/src/core/ext/filters/client_channel/resolver_registry.h @@ -22,8 +22,6 @@ #include "src/core/ext/filters/client_channel/resolver_factory.h" #include "src/core/lib/iomgr/pollset_set.h" - - void grpc_resolver_registry_init(); void grpc_resolver_registry_shutdown(void); @@ -68,6 +66,4 @@ char* grpc_get_default_authority(grpc_exec_ctx* exec_ctx, const char* target); char* grpc_resolver_factory_add_default_prefix_if_needed( grpc_exec_ctx* exec_ctx, const char* target); - - #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_REGISTRY_H */ diff --git a/src/core/ext/filters/client_channel/retry_throttle.h b/src/core/ext/filters/client_channel/retry_throttle.h index 305dd1ca5de..bf99297e988 100644 --- a/src/core/ext/filters/client_channel/retry_throttle.h +++ b/src/core/ext/filters/client_channel/retry_throttle.h @@ -21,8 +21,6 @@ #include - - /// Tracks retry throttling data for an individual server name. typedef struct grpc_server_retry_throttle_data grpc_server_retry_throttle_data; @@ -49,6 +47,4 @@ void grpc_retry_throttle_map_shutdown(); grpc_server_retry_throttle_data* grpc_retry_throttle_map_get_data_for_server( const char* server_name, int max_milli_tokens, int milli_token_ratio); - - #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RETRY_THROTTLE_H */ diff --git a/src/core/ext/filters/client_channel/subchannel.h b/src/core/ext/filters/client_channel/subchannel.h index 44491c3cded..1f326fc1d20 100644 --- a/src/core/ext/filters/client_channel/subchannel.h +++ b/src/core/ext/filters/client_channel/subchannel.h @@ -26,8 +26,6 @@ #include "src/core/lib/transport/connectivity_state.h" #include "src/core/lib/transport/metadata.h" - - // Channel arg containing a grpc_resolved_address to connect to. #define GRPC_ARG_SUBCHANNEL_ADDRESS "grpc.subchannel_address" @@ -190,6 +188,4 @@ const char* grpc_get_subchannel_address_uri_arg(const grpc_channel_args* args); /// Caller is responsible for freeing the string. grpc_arg grpc_create_subchannel_address_arg(const grpc_resolved_address* addr); - - #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_SUBCHANNEL_H */ diff --git a/src/core/ext/filters/client_channel/subchannel_index.h b/src/core/ext/filters/client_channel/subchannel_index.h index 23ba7e210fd..6a4d06ef8ff 100644 --- a/src/core/ext/filters/client_channel/subchannel_index.h +++ b/src/core/ext/filters/client_channel/subchannel_index.h @@ -21,8 +21,6 @@ #include "src/core/ext/filters/client_channel/subchannel.h" - - /** \file Provides an index of active subchannels so that they can be shared amongst channels */ @@ -80,6 +78,4 @@ void grpc_subchannel_index_unref(void); * force_creation set. */ void grpc_subchannel_index_test_only_set_force_creation(bool force_creation); - - #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_SUBCHANNEL_INDEX_H */ diff --git a/src/core/ext/filters/client_channel/uri_parser.h b/src/core/ext/filters/client_channel/uri_parser.h index 3bf4c196548..84752905e8f 100644 --- a/src/core/ext/filters/client_channel/uri_parser.h +++ b/src/core/ext/filters/client_channel/uri_parser.h @@ -22,8 +22,6 @@ #include #include "src/core/lib/iomgr/exec_ctx.h" - - typedef struct { char* scheme; char* authority; @@ -49,6 +47,4 @@ const char* grpc_uri_get_query_arg(const grpc_uri* uri, const char* key); /** destroy a uri */ void grpc_uri_destroy(grpc_uri* uri); - - #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_URI_PARSER_H */ diff --git a/src/core/ext/filters/deadline/deadline_filter.h b/src/core/ext/filters/deadline/deadline_filter.h index 6be9015ab9e..8d835d03820 100644 --- a/src/core/ext/filters/deadline/deadline_filter.h +++ b/src/core/ext/filters/deadline/deadline_filter.h @@ -20,8 +20,6 @@ #include "src/core/lib/channel/channel_stack.h" #include "src/core/lib/iomgr/timer.h" - - typedef enum grpc_deadline_timer_state { GRPC_DEADLINE_STATE_INITIAL, GRPC_DEADLINE_STATE_PENDING, @@ -92,6 +90,4 @@ bool grpc_deadline_checking_enabled(const grpc_channel_args* args); extern const grpc_channel_filter grpc_client_deadline_filter; extern const grpc_channel_filter grpc_server_deadline_filter; - - #endif /* GRPC_CORE_EXT_FILTERS_DEADLINE_DEADLINE_FILTER_H */ diff --git a/src/core/ext/filters/http/client/http_client_filter.h b/src/core/ext/filters/http/client/http_client_filter.h index 1237c0a3de1..ec8177c4367 100644 --- a/src/core/ext/filters/http/client/http_client_filter.h +++ b/src/core/ext/filters/http/client/http_client_filter.h @@ -20,14 +20,10 @@ #include "src/core/lib/channel/channel_stack.h" - - /* Processes metadata on the client side for HTTP2 transports */ extern const grpc_channel_filter grpc_http_client_filter; /* Channel arg to determine maximum size of payload eligable for GET request */ #define GRPC_ARG_MAX_PAYLOAD_SIZE_FOR_GET "grpc.max_payload_size_for_get" - - #endif /* GRPC_CORE_EXT_FILTERS_HTTP_CLIENT_HTTP_CLIENT_FILTER_H */ diff --git a/src/core/ext/filters/http/message_compress/message_compress_filter.h b/src/core/ext/filters/http/message_compress/message_compress_filter.h index c76682f5b5b..62207911c70 100644 --- a/src/core/ext/filters/http/message_compress/message_compress_filter.h +++ b/src/core/ext/filters/http/message_compress/message_compress_filter.h @@ -23,8 +23,6 @@ #include "src/core/lib/channel/channel_stack.h" - - /** Compression filter for outgoing data. * * See for the available compression settings. @@ -49,7 +47,5 @@ extern const grpc_channel_filter grpc_message_compress_filter; - - #endif /* GRPC_CORE_EXT_FILTERS_HTTP_MESSAGE_COMPRESS_MESSAGE_COMPRESS_FILTER_H \ */ diff --git a/src/core/ext/filters/http/server/http_server_filter.h b/src/core/ext/filters/http/server/http_server_filter.h index 2d724def18c..c0f678a3299 100644 --- a/src/core/ext/filters/http/server/http_server_filter.h +++ b/src/core/ext/filters/http/server/http_server_filter.h @@ -21,11 +21,7 @@ #include "src/core/lib/channel/channel_stack.h" - - /* Processes metadata on the client side for HTTP2 transports */ extern const grpc_channel_filter grpc_http_server_filter; - - #endif /* GRPC_CORE_EXT_FILTERS_HTTP_SERVER_HTTP_SERVER_FILTER_H */ diff --git a/src/core/ext/filters/load_reporting/server_load_reporting_filter.h b/src/core/ext/filters/load_reporting/server_load_reporting_filter.h index 00e8e4c37f9..1baee5e7cd6 100644 --- a/src/core/ext/filters/load_reporting/server_load_reporting_filter.h +++ b/src/core/ext/filters/load_reporting/server_load_reporting_filter.h @@ -22,11 +22,7 @@ #include "src/core/ext/filters/load_reporting/server_load_reporting_plugin.h" #include "src/core/lib/channel/channel_stack.h" - - extern const grpc_channel_filter grpc_server_load_reporting_filter; - - #endif /* GRPC_CORE_EXT_FILTERS_LOAD_REPORTING_SERVER_LOAD_REPORTING_FILTER_H \ */ diff --git a/src/core/ext/filters/load_reporting/server_load_reporting_plugin.h b/src/core/ext/filters/load_reporting/server_load_reporting_plugin.h index af2bbfcc093..4b694d336de 100644 --- a/src/core/ext/filters/load_reporting/server_load_reporting_plugin.h +++ b/src/core/ext/filters/load_reporting/server_load_reporting_plugin.h @@ -23,8 +23,6 @@ #include "src/core/lib/channel/channel_stack.h" - - /** Identifiers for the invocation point of the users LR callback */ typedef enum grpc_load_reporting_source { GRPC_LR_POINT_UNKNOWN = 0, @@ -57,7 +55,5 @@ typedef struct grpc_load_reporting_call_data { /** Return a \a grpc_arg enabling load reporting */ grpc_arg grpc_load_reporting_enable_arg(); - - #endif /* GRPC_CORE_EXT_FILTERS_LOAD_REPORTING_SERVER_LOAD_REPORTING_PLUGIN_H \ */ diff --git a/src/core/ext/filters/max_age/max_age_filter.h b/src/core/ext/filters/max_age/max_age_filter.h index e0885982773..68fb4a4ca57 100644 --- a/src/core/ext/filters/max_age/max_age_filter.h +++ b/src/core/ext/filters/max_age/max_age_filter.h @@ -19,10 +19,6 @@ #include "src/core/lib/channel/channel_stack.h" - - extern const grpc_channel_filter grpc_max_age_filter; - - #endif /* GRPC_CORE_EXT_FILTERS_MAX_AGE_MAX_AGE_FILTER_H */ diff --git a/src/core/ext/filters/message_size/message_size_filter.h b/src/core/ext/filters/message_size/message_size_filter.h index 7c170fa7e1b..d3667f70037 100644 --- a/src/core/ext/filters/message_size/message_size_filter.h +++ b/src/core/ext/filters/message_size/message_size_filter.h @@ -19,10 +19,6 @@ #include "src/core/lib/channel/channel_stack.h" - - extern const grpc_channel_filter grpc_message_size_filter; - - #endif /* GRPC_CORE_EXT_FILTERS_MESSAGE_SIZE_MESSAGE_SIZE_FILTER_H */ diff --git a/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h b/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h index 38a88cb6318..9dae4f07342 100644 --- a/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h +++ b/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h @@ -19,11 +19,7 @@ #include "src/core/lib/channel/channel_stack.h" - - extern const grpc_channel_filter grpc_workaround_cronet_compression_filter; - - #endif /* GRPC_CORE_EXT_FILTERS_WORKAROUNDS_WORKAROUND_CRONET_COMPRESSION_FILTER_H \ */ diff --git a/src/core/ext/filters/workarounds/workaround_utils.h b/src/core/ext/filters/workarounds/workaround_utils.h index 4267b486c1c..d6ef5e84fa5 100644 --- a/src/core/ext/filters/workarounds/workaround_utils.h +++ b/src/core/ext/filters/workarounds/workaround_utils.h @@ -24,8 +24,6 @@ #define GRPC_WORKAROUND_PRIORITY_HIGH 10001 #define GRPC_WORKAROUND_PROIRITY_LOW 9999 - - typedef struct grpc_workaround_user_agent_md { bool workaround_active[GRPC_MAX_WORKAROUND_ID]; } grpc_workaround_user_agent_md; @@ -36,6 +34,4 @@ typedef bool (*user_agent_parser)(grpc_mdelem); void grpc_register_workaround(uint32_t id, user_agent_parser parser); - - #endif /* GRPC_CORE_EXT_FILTERS_WORKAROUNDS_WORKAROUND_UTILS_H */ diff --git a/src/core/ext/transport/chttp2/alpn/alpn.h b/src/core/ext/transport/chttp2/alpn/alpn.h index 8f13ebdfc22..fd7513c6654 100644 --- a/src/core/ext/transport/chttp2/alpn/alpn.h +++ b/src/core/ext/transport/chttp2/alpn/alpn.h @@ -21,8 +21,6 @@ #include - - /* Retuns 1 if the version is supported, 0 otherwise. */ int grpc_chttp2_is_alpn_version_supported(const char* version, size_t size); @@ -33,6 +31,4 @@ size_t grpc_chttp2_num_alpn_versions(void); * grpc_chttp2_num_alpn_versions()) */ const char* grpc_chttp2_get_alpn_version_index(size_t i); - - #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_ALPN_ALPN_H */ diff --git a/src/core/ext/transport/chttp2/client/chttp2_connector.h b/src/core/ext/transport/chttp2/client/chttp2_connector.h index dc8f26cc0a0..e258892cfc7 100644 --- a/src/core/ext/transport/chttp2/client/chttp2_connector.h +++ b/src/core/ext/transport/chttp2/client/chttp2_connector.h @@ -19,12 +19,8 @@ #ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_CLIENT_CHTTP2_CONNECTOR_H #define GRPC_CORE_EXT_TRANSPORT_CHTTP2_CLIENT_CHTTP2_CONNECTOR_H - - #include "src/core/ext/filters/client_channel/connector.h" grpc_connector* grpc_chttp2_connector_create(); - - #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_CLIENT_CHTTP2_CONNECTOR_H */ diff --git a/src/core/ext/transport/chttp2/server/chttp2_server.h b/src/core/ext/transport/chttp2/server/chttp2_server.h index ed798d243d3..68304fd4f7e 100644 --- a/src/core/ext/transport/chttp2/server/chttp2_server.h +++ b/src/core/ext/transport/chttp2/server/chttp2_server.h @@ -23,14 +23,10 @@ #include "src/core/lib/iomgr/exec_ctx.h" - - /// Adds a port to \a server. Sets \a port_num to the port number. /// Takes ownership of \a args. grpc_error* grpc_chttp2_server_add_port(grpc_exec_ctx* exec_ctx, grpc_server* server, const char* addr, grpc_channel_args* args, int* port_num); - - #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_SERVER_CHTTP2_SERVER_H */ diff --git a/src/core/ext/transport/chttp2/transport/bin_decoder.h b/src/core/ext/transport/chttp2/transport/bin_decoder.h index 33cff858357..a78c305766e 100644 --- a/src/core/ext/transport/chttp2/transport/bin_decoder.h +++ b/src/core/ext/transport/chttp2/transport/bin_decoder.h @@ -22,8 +22,6 @@ #include #include - - struct grpc_base64_decode_context { /* input/output: */ uint8_t* input_cur; @@ -51,6 +49,4 @@ grpc_slice grpc_chttp2_base64_decode_with_length(grpc_exec_ctx* exec_ctx, grpc_slice input, size_t output_length); - - #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_DECODER_H */ diff --git a/src/core/ext/transport/chttp2/transport/bin_encoder.h b/src/core/ext/transport/chttp2/transport/bin_encoder.h index 620a6e50d81..a8f36a345ad 100644 --- a/src/core/ext/transport/chttp2/transport/bin_encoder.h +++ b/src/core/ext/transport/chttp2/transport/bin_encoder.h @@ -21,8 +21,6 @@ #include - - /* base64 encode a slice. Returns a new slice, does not take ownership of the input */ grpc_slice grpc_chttp2_base64_encode(grpc_slice input); @@ -38,6 +36,4 @@ grpc_slice grpc_chttp2_huffman_compress(grpc_slice input); return y; */ grpc_slice grpc_chttp2_base64_encode_and_huffman_compress(grpc_slice input); - - #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_ENCODER_H */ diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.h b/src/core/ext/transport/chttp2/transport/chttp2_transport.h index 2b2c82af4d4..e068987040b 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.h +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.h @@ -23,8 +23,6 @@ #include "src/core/lib/iomgr/endpoint.h" #include "src/core/lib/transport/transport.h" - - extern grpc_tracer_flag grpc_http_trace; extern grpc_tracer_flag grpc_flowctl_trace; extern grpc_tracer_flag grpc_trace_http2_stream_state; @@ -43,6 +41,4 @@ void grpc_chttp2_transport_start_reading(grpc_exec_ctx* exec_ctx, grpc_transport* transport, grpc_slice_buffer* read_buffer); - - #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_CHTTP2_TRANSPORT_H */ diff --git a/src/core/ext/transport/chttp2/transport/frame.h b/src/core/ext/transport/chttp2/transport/frame.h index 404ee2fee45..dba4c004eca 100644 --- a/src/core/ext/transport/chttp2/transport/frame.h +++ b/src/core/ext/transport/chttp2/transport/frame.h @@ -24,8 +24,6 @@ #include "src/core/lib/iomgr/error.h" - - /* defined in internal.h */ typedef struct grpc_chttp2_stream grpc_chttp2_stream; typedef struct grpc_chttp2_transport grpc_chttp2_transport; @@ -45,6 +43,4 @@ typedef struct grpc_chttp2_transport grpc_chttp2_transport; #define GRPC_CHTTP2_DATA_FLAG_PADDED 8 #define GRPC_CHTTP2_FLAG_HAS_PRIORITY 0x20 - - #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_H */ diff --git a/src/core/ext/transport/chttp2/transport/frame_data.h b/src/core/ext/transport/chttp2/transport/frame_data.h index 217927799ac..4de553ea426 100644 --- a/src/core/ext/transport/chttp2/transport/frame_data.h +++ b/src/core/ext/transport/chttp2/transport/frame_data.h @@ -28,8 +28,6 @@ #include "src/core/lib/transport/byte_stream.h" #include "src/core/lib/transport/transport.h" - - typedef enum { GRPC_CHTTP2_DATA_FH_0, GRPC_CHTTP2_DATA_FH_1, @@ -82,6 +80,4 @@ grpc_error* grpc_deframe_unprocessed_incoming_frames( grpc_slice_buffer* slices, grpc_slice* slice_out, grpc_byte_stream** stream_out); - - #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_DATA_H */ diff --git a/src/core/ext/transport/chttp2/transport/frame_goaway.h b/src/core/ext/transport/chttp2/transport/frame_goaway.h index b3c910f5ea9..743e763342d 100644 --- a/src/core/ext/transport/chttp2/transport/frame_goaway.h +++ b/src/core/ext/transport/chttp2/transport/frame_goaway.h @@ -25,8 +25,6 @@ #include "src/core/ext/transport/chttp2/transport/frame.h" #include "src/core/lib/iomgr/exec_ctx.h" - - typedef enum { GRPC_CHTTP2_GOAWAY_LSI0, GRPC_CHTTP2_GOAWAY_LSI1, @@ -62,6 +60,4 @@ void grpc_chttp2_goaway_append(uint32_t last_stream_id, uint32_t error_code, grpc_slice debug_data, grpc_slice_buffer* slice_buffer); - - #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_GOAWAY_H */ diff --git a/src/core/ext/transport/chttp2/transport/frame_ping.h b/src/core/ext/transport/chttp2/transport/frame_ping.h index 0767182e09f..76ca3977091 100644 --- a/src/core/ext/transport/chttp2/transport/frame_ping.h +++ b/src/core/ext/transport/chttp2/transport/frame_ping.h @@ -23,8 +23,6 @@ #include "src/core/ext/transport/chttp2/transport/frame.h" #include "src/core/lib/iomgr/exec_ctx.h" - - typedef struct { uint8_t byte; uint8_t is_ack; @@ -43,6 +41,4 @@ grpc_error* grpc_chttp2_ping_parser_parse(grpc_exec_ctx* exec_ctx, void* parser, /* Test-only function for disabling ping ack */ void grpc_set_disable_ping_ack(bool disable_ping_ack); - - #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_PING_H */ diff --git a/src/core/ext/transport/chttp2/transport/frame_rst_stream.h b/src/core/ext/transport/chttp2/transport/frame_rst_stream.h index dd98c04b6af..7dfc5d4578b 100644 --- a/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +++ b/src/core/ext/transport/chttp2/transport/frame_rst_stream.h @@ -24,8 +24,6 @@ #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/transport/transport.h" - - typedef struct { uint8_t byte; uint8_t reason_bytes[4]; @@ -42,6 +40,4 @@ grpc_error* grpc_chttp2_rst_stream_parser_parse(grpc_exec_ctx* exec_ctx, grpc_chttp2_stream* s, grpc_slice slice, int is_last); - - #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_RST_STREAM_H */ diff --git a/src/core/ext/transport/chttp2/transport/frame_settings.h b/src/core/ext/transport/chttp2/transport/frame_settings.h index 52b4ef1924a..36e2ca83a0f 100644 --- a/src/core/ext/transport/chttp2/transport/frame_settings.h +++ b/src/core/ext/transport/chttp2/transport/frame_settings.h @@ -25,8 +25,6 @@ #include "src/core/ext/transport/chttp2/transport/http2_settings.h" #include "src/core/lib/iomgr/exec_ctx.h" - - typedef enum { GRPC_CHTTP2_SPS_ID0, GRPC_CHTTP2_SPS_ID1, @@ -60,6 +58,4 @@ grpc_error* grpc_chttp2_settings_parser_parse(grpc_exec_ctx* exec_ctx, grpc_chttp2_stream* s, grpc_slice slice, int is_last); - - #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_SETTINGS_H */ diff --git a/src/core/ext/transport/chttp2/transport/frame_window_update.h b/src/core/ext/transport/chttp2/transport/frame_window_update.h index 1b7e061c8b4..e031b585faa 100644 --- a/src/core/ext/transport/chttp2/transport/frame_window_update.h +++ b/src/core/ext/transport/chttp2/transport/frame_window_update.h @@ -24,8 +24,6 @@ #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/transport/transport.h" - - typedef struct { uint8_t byte; uint8_t is_connection_update; @@ -41,6 +39,4 @@ grpc_error* grpc_chttp2_window_update_parser_parse( grpc_exec_ctx* exec_ctx, void* parser, grpc_chttp2_transport* t, grpc_chttp2_stream* s, grpc_slice slice, int is_last); - - #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_WINDOW_UPDATE_H */ diff --git a/src/core/ext/transport/chttp2/transport/hpack_encoder.h b/src/core/ext/transport/chttp2/transport/hpack_encoder.h index 0e11f99fd02..046e0b81cd7 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_encoder.h +++ b/src/core/ext/transport/chttp2/transport/hpack_encoder.h @@ -34,8 +34,6 @@ /* maximum table size we'll actually use */ #define GRPC_CHTTP2_HPACKC_MAX_TABLE_SIZE (1024 * 1024) - - typedef struct { uint32_t filter_elems_sum; uint32_t max_table_size; @@ -93,6 +91,4 @@ void grpc_chttp2_encode_header(grpc_exec_ctx* exec_ctx, const grpc_encode_header_options* options, grpc_slice_buffer* outbuf); - - #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_ENCODER_H */ diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser.h b/src/core/ext/transport/chttp2/transport/hpack_parser.h index 452165e8d00..b4a2b14bdb7 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_parser.h +++ b/src/core/ext/transport/chttp2/transport/hpack_parser.h @@ -27,8 +27,6 @@ #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/transport/metadata.h" - - typedef struct grpc_chttp2_hpack_parser grpc_chttp2_hpack_parser; typedef grpc_error* (*grpc_chttp2_hpack_parser_state)( @@ -113,6 +111,4 @@ grpc_error* grpc_chttp2_header_parser_parse(grpc_exec_ctx* exec_ctx, grpc_chttp2_stream* s, grpc_slice slice, int is_last); - - #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_PARSER_H */ diff --git a/src/core/ext/transport/chttp2/transport/hpack_table.h b/src/core/ext/transport/chttp2/transport/hpack_table.h index 0e41dbeea5d..aed7b13f0be 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_table.h +++ b/src/core/ext/transport/chttp2/transport/hpack_table.h @@ -24,8 +24,6 @@ #include "src/core/lib/iomgr/error.h" #include "src/core/lib/transport/metadata.h" - - /* HPACK header table */ /* last index in the static table */ @@ -96,6 +94,4 @@ typedef struct { grpc_chttp2_hptbl_find_result grpc_chttp2_hptbl_find( const grpc_chttp2_hptbl* tbl, grpc_mdelem md); - - #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_TABLE_H */ diff --git a/src/core/ext/transport/chttp2/transport/http2_settings.h b/src/core/ext/transport/chttp2/transport/http2_settings.h index baac528c9a0..fd15b6977b9 100644 --- a/src/core/ext/transport/chttp2/transport/http2_settings.h +++ b/src/core/ext/transport/chttp2/transport/http2_settings.h @@ -36,7 +36,6 @@ typedef enum { #define GRPC_CHTTP2_NUM_SETTINGS 7 - extern const uint16_t grpc_setting_id_to_wire_id[]; bool grpc_wire_id_to_setting_id(uint32_t wire_id, grpc_chttp2_setting_id* out); @@ -58,6 +57,4 @@ typedef struct { extern const grpc_chttp2_setting_parameters grpc_chttp2_settings_parameters[GRPC_CHTTP2_NUM_SETTINGS]; - - #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HTTP2_SETTINGS_H */ diff --git a/src/core/ext/transport/chttp2/transport/huffsyms.h b/src/core/ext/transport/chttp2/transport/huffsyms.h index 7014fb60c46..2e2a5dacaed 100644 --- a/src/core/ext/transport/chttp2/transport/huffsyms.h +++ b/src/core/ext/transport/chttp2/transport/huffsyms.h @@ -19,8 +19,6 @@ #ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HUFFSYMS_H #define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HUFFSYMS_H - - /* HPACK static huffman table */ #define GRPC_CHTTP2_NUM_HUFFSYMS 257 @@ -32,6 +30,4 @@ typedef struct { extern const grpc_chttp2_huffsym grpc_chttp2_huffsyms[GRPC_CHTTP2_NUM_HUFFSYMS]; - - #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HUFFSYMS_H */ diff --git a/src/core/ext/transport/chttp2/transport/incoming_metadata.h b/src/core/ext/transport/chttp2/transport/incoming_metadata.h index 9dbf8987d16..6f2b81ef6ce 100644 --- a/src/core/ext/transport/chttp2/transport/incoming_metadata.h +++ b/src/core/ext/transport/chttp2/transport/incoming_metadata.h @@ -21,8 +21,6 @@ #include "src/core/lib/transport/transport.h" - - typedef struct { gpr_arena* arena; grpc_metadata_batch batch; @@ -47,6 +45,4 @@ grpc_error* grpc_chttp2_incoming_metadata_buffer_replace_or_add( void grpc_chttp2_incoming_metadata_buffer_set_deadline( grpc_chttp2_incoming_metadata_buffer* buffer, grpc_millis deadline); - - #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_INCOMING_METADATA_H */ diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index c579b6be6bb..eec98b78ef4 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -42,8 +42,6 @@ #include "src/core/lib/transport/connectivity_state.h" #include "src/core/lib/transport/transport_impl.h" - - /* streams are kept in various linked lists depending on what things need to happen to them... this enum labels each list */ typedef enum { @@ -776,6 +774,4 @@ void grpc_chttp2_fail_pending_writes(grpc_exec_ctx* exec_ctx, void grpc_chttp2_config_default_keepalive_args(grpc_channel_args* args, bool is_client); - - #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_INTERNAL_H */ diff --git a/src/core/ext/transport/chttp2/transport/stream_map.h b/src/core/ext/transport/chttp2/transport/stream_map.h index 37b71a30435..9fb8826e8e6 100644 --- a/src/core/ext/transport/chttp2/transport/stream_map.h +++ b/src/core/ext/transport/chttp2/transport/stream_map.h @@ -23,8 +23,6 @@ #include - - /* Data structure to map a uint32_t to a data object (represented by a void*) Represented as a sorted array of keys, and a corresponding array of values. @@ -67,6 +65,4 @@ void grpc_chttp2_stream_map_for_each(grpc_chttp2_stream_map* map, void* value), void* user_data); - - #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_STREAM_MAP_H */ diff --git a/src/core/ext/transport/chttp2/transport/varint.h b/src/core/ext/transport/chttp2/transport/varint.h index 4da8aa5bd96..5a2b670f065 100644 --- a/src/core/ext/transport/chttp2/transport/varint.h +++ b/src/core/ext/transport/chttp2/transport/varint.h @@ -21,8 +21,6 @@ #include - - /* Helpers for hpack varint encoding */ /* length of a value that needs varint tail encoding (it's bigger than can be @@ -59,6 +57,4 @@ void grpc_chttp2_hpack_write_varint_tail(uint32_t tail_value, uint8_t* target, } \ } while (0) - - #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_VARINT_H */ diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.h b/src/core/ext/transport/cronet/transport/cronet_transport.h index 699818904e9..d9ff913326a 100644 --- a/src/core/ext/transport/cronet/transport/cronet_transport.h +++ b/src/core/ext/transport/cronet/transport/cronet_transport.h @@ -21,12 +21,8 @@ #include "src/core/lib/transport/transport.h" - - grpc_transport* grpc_create_cronet_transport(void* engine, const char* target, const grpc_channel_args* args, void* reserved); - - #endif /* GRPC_CORE_EXT_TRANSPORT_CRONET_TRANSPORT_CRONET_TRANSPORT_H */ diff --git a/src/core/ext/transport/inproc/inproc_plugin.cc b/src/core/ext/transport/inproc/inproc_plugin.cc index 74451b32345..6a796a0b19f 100644 --- a/src/core/ext/transport/inproc/inproc_plugin.cc +++ b/src/core/ext/transport/inproc/inproc_plugin.cc @@ -26,6 +26,4 @@ void grpc_inproc_plugin_init(void) { grpc_inproc_transport_init(); } -void grpc_inproc_plugin_shutdown(void) { - grpc_inproc_transport_shutdown(); -} +void grpc_inproc_plugin_shutdown(void) { grpc_inproc_transport_shutdown(); } diff --git a/src/core/ext/transport/inproc/inproc_transport.h b/src/core/ext/transport/inproc/inproc_transport.h index 74cba41afd1..b532b8a234d 100644 --- a/src/core/ext/transport/inproc/inproc_transport.h +++ b/src/core/ext/transport/inproc/inproc_transport.h @@ -21,8 +21,6 @@ #include "src/core/lib/transport/transport_impl.h" - - grpc_channel* grpc_inproc_channel_create(grpc_server* server, grpc_channel_args* args, void* reserved); @@ -32,6 +30,4 @@ extern grpc_tracer_flag grpc_inproc_trace; void grpc_inproc_transport_init(void); void grpc_inproc_transport_shutdown(void); - - #endif /* GRPC_CORE_EXT_TRANSPORT_INPROC_INPROC_TRANSPORT_H */ diff --git a/src/core/lib/backoff/backoff.h b/src/core/lib/backoff/backoff.h index e59c343d599..0da9082e702 100644 --- a/src/core/lib/backoff/backoff.h +++ b/src/core/lib/backoff/backoff.h @@ -21,8 +21,6 @@ #include "src/core/lib/iomgr/exec_ctx.h" - - typedef struct { /// const: how long to wait after the first failure before retrying grpc_millis initial_backoff; @@ -74,6 +72,4 @@ grpc_backoff_result grpc_backoff_step(grpc_exec_ctx* exec_ctx, /// grpc_backoff_begin. void grpc_backoff_reset(grpc_backoff* backoff); - - #endif /* GRPC_CORE_LIB_BACKOFF_BACKOFF_H */ diff --git a/src/core/lib/channel/channel_args.h b/src/core/lib/channel/channel_args.h index 7f8305dae3b..f6cb7fa73db 100644 --- a/src/core/lib/channel/channel_args.h +++ b/src/core/lib/channel/channel_args.h @@ -23,8 +23,6 @@ #include #include "src/core/lib/iomgr/socket_mutator.h" - - // Channel args are intentionally immutable, to avoid the need for locking. /** Copy the arguments in \a src into a new instance */ @@ -151,6 +149,4 @@ grpc_arg grpc_channel_arg_integer_create(char* name, int value); grpc_arg grpc_channel_arg_pointer_create(char* name, void* value, const grpc_arg_pointer_vtable* vtable); - - #endif /* GRPC_CORE_LIB_CHANNEL_CHANNEL_ARGS_H */ diff --git a/src/core/lib/channel/channel_stack.h b/src/core/lib/channel/channel_stack.h index 478a03ee732..8af18a0d39d 100644 --- a/src/core/lib/channel/channel_stack.h +++ b/src/core/lib/channel/channel_stack.h @@ -45,8 +45,6 @@ #include "src/core/lib/support/arena.h" #include "src/core/lib/transport/transport.h" - - typedef struct grpc_channel_element grpc_channel_element; typedef struct grpc_call_element grpc_call_element; @@ -288,6 +286,4 @@ extern grpc_tracer_flag grpc_trace_channel; #define GRPC_CALL_LOG_OP(sev, elem, op) \ if (GRPC_TRACER_ON(grpc_trace_channel)) grpc_call_log_op(sev, elem, op) - - #endif /* GRPC_CORE_LIB_CHANNEL_CHANNEL_STACK_H */ diff --git a/src/core/lib/channel/channel_stack_builder.h b/src/core/lib/channel/channel_stack_builder.h index 4f5e1dc7d51..51a56130e34 100644 --- a/src/core/lib/channel/channel_stack_builder.h +++ b/src/core/lib/channel/channel_stack_builder.h @@ -24,8 +24,6 @@ #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_stack.h" - - /// grpc_channel_stack_builder offers a programmatic interface to selected /// and order channel filters typedef struct grpc_channel_stack_builder grpc_channel_stack_builder; @@ -160,6 +158,4 @@ void grpc_channel_stack_builder_destroy(grpc_exec_ctx* exec_ctx, extern grpc_tracer_flag grpc_trace_channel_stack_builder; - - #endif /* GRPC_CORE_LIB_CHANNEL_CHANNEL_STACK_BUILDER_H */ diff --git a/src/core/lib/channel/connected_channel.h b/src/core/lib/channel/connected_channel.h index 6807049ea39..cab8aad1543 100644 --- a/src/core/lib/channel/connected_channel.h +++ b/src/core/lib/channel/connected_channel.h @@ -21,8 +21,6 @@ #include "src/core/lib/channel/channel_stack_builder.h" - - extern const grpc_channel_filter grpc_connected_filter; bool grpc_add_connected_filter(grpc_exec_ctx* exec_ctx, @@ -32,6 +30,4 @@ bool grpc_add_connected_filter(grpc_exec_ctx* exec_ctx, /* Debug helper to dig the transport stream out of a call element */ grpc_stream* grpc_connected_channel_get_stream(grpc_call_element* elem); - - #endif /* GRPC_CORE_LIB_CHANNEL_CONNECTED_CHANNEL_H */ diff --git a/src/core/lib/channel/handshaker.h b/src/core/lib/channel/handshaker.h index 6f7b01bc5dc..09b4a27c1ce 100644 --- a/src/core/lib/channel/handshaker.h +++ b/src/core/lib/channel/handshaker.h @@ -26,8 +26,6 @@ #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/tcp_server.h" - - /// Handshakers are used to perform initial handshakes on a connection /// before the client sends the initial request. Some examples of what /// a handshaker can be used for includes support for HTTP CONNECT on @@ -166,6 +164,4 @@ void grpc_handshake_manager_pending_list_remove(grpc_handshake_manager** head, void grpc_handshake_manager_pending_list_shutdown_all( grpc_exec_ctx* exec_ctx, grpc_handshake_manager* head, grpc_error* why); - - #endif /* GRPC_CORE_LIB_CHANNEL_HANDSHAKER_H */ diff --git a/src/core/lib/channel/handshaker_factory.h b/src/core/lib/channel/handshaker_factory.h index 79e22c59b21..ca7c26b50a2 100644 --- a/src/core/lib/channel/handshaker_factory.h +++ b/src/core/lib/channel/handshaker_factory.h @@ -24,8 +24,6 @@ #include "src/core/lib/channel/handshaker.h" #include "src/core/lib/iomgr/exec_ctx.h" - - // A handshaker factory is used to create handshakers. typedef struct grpc_handshaker_factory grpc_handshaker_factory; @@ -50,6 +48,4 @@ void grpc_handshaker_factory_add_handshakers( void grpc_handshaker_factory_destroy( grpc_exec_ctx* exec_ctx, grpc_handshaker_factory* handshaker_factory); - - #endif /* GRPC_CORE_LIB_CHANNEL_HANDSHAKER_FACTORY_H */ diff --git a/src/core/lib/channel/handshaker_registry.h b/src/core/lib/channel/handshaker_registry.h index 5c503ec8834..a3b2ac1dc73 100644 --- a/src/core/lib/channel/handshaker_registry.h +++ b/src/core/lib/channel/handshaker_registry.h @@ -24,8 +24,6 @@ #include "src/core/lib/channel/handshaker_factory.h" #include "src/core/lib/iomgr/exec_ctx.h" - - typedef enum { HANDSHAKER_CLIENT = 0, HANDSHAKER_SERVER, @@ -47,6 +45,4 @@ void grpc_handshakers_add(grpc_exec_ctx* exec_ctx, const grpc_channel_args* args, grpc_handshake_manager* handshake_mgr); - - #endif /* GRPC_CORE_LIB_CHANNEL_HANDSHAKER_REGISTRY_H */ diff --git a/src/core/lib/compression/algorithm_metadata.h b/src/core/lib/compression/algorithm_metadata.h index 7e32fe14372..08feafc1bbe 100644 --- a/src/core/lib/compression/algorithm_metadata.h +++ b/src/core/lib/compression/algorithm_metadata.h @@ -22,8 +22,6 @@ #include #include "src/core/lib/transport/metadata.h" - - /** Return compression algorithm based metadata value */ grpc_slice grpc_compression_algorithm_slice( grpc_compression_algorithm algorithm); @@ -51,6 +49,4 @@ grpc_compression_algorithm grpc_compression_algorithm_from_slice( grpc_stream_compression_algorithm grpc_stream_compression_algorithm_from_slice( grpc_slice str); - - #endif /* GRPC_CORE_LIB_COMPRESSION_ALGORITHM_METADATA_H */ diff --git a/src/core/lib/compression/message_compress.h b/src/core/lib/compression/message_compress.h index 137e45431c8..ca8ca37f8e3 100644 --- a/src/core/lib/compression/message_compress.h +++ b/src/core/lib/compression/message_compress.h @@ -22,8 +22,6 @@ #include #include - - /* compress 'input' to 'output' using 'algorithm'. On success, appends compressed slices to output and returns 1. On failure, appends uncompressed slices to output and returns 0. */ @@ -38,6 +36,4 @@ int grpc_msg_decompress(grpc_exec_ctx* exec_ctx, grpc_compression_algorithm algorithm, grpc_slice_buffer* input, grpc_slice_buffer* output); - - #endif /* GRPC_CORE_LIB_COMPRESSION_MESSAGE_COMPRESS_H */ diff --git a/src/core/lib/compression/stream_compression.h b/src/core/lib/compression/stream_compression.h index 8d4f0e725d4..8322835c4fd 100644 --- a/src/core/lib/compression/stream_compression.h +++ b/src/core/lib/compression/stream_compression.h @@ -26,8 +26,6 @@ #include "src/core/lib/transport/static_metadata.h" - - typedef struct grpc_stream_compression_vtable grpc_stream_compression_vtable; /* Stream compression/decompression context */ @@ -113,6 +111,4 @@ void grpc_stream_compression_context_destroy( int grpc_stream_compression_method_parse( grpc_slice value, bool is_compress, grpc_stream_compression_method* method); - - #endif diff --git a/src/core/lib/compression/stream_compression_gzip.h b/src/core/lib/compression/stream_compression_gzip.h index 735543f3f99..7cf49a0de93 100644 --- a/src/core/lib/compression/stream_compression_gzip.h +++ b/src/core/lib/compression/stream_compression_gzip.h @@ -21,10 +21,6 @@ #include "src/core/lib/compression/stream_compression.h" - - extern const grpc_stream_compression_vtable grpc_stream_compression_gzip_vtable; - - #endif diff --git a/src/core/lib/compression/stream_compression_identity.h b/src/core/lib/compression/stream_compression_identity.h index 9f1166724b6..41926e949e5 100644 --- a/src/core/lib/compression/stream_compression_identity.h +++ b/src/core/lib/compression/stream_compression_identity.h @@ -21,11 +21,7 @@ #include "src/core/lib/compression/stream_compression.h" - - extern const grpc_stream_compression_vtable grpc_stream_compression_identity_vtable; - - #endif diff --git a/src/core/lib/debug/stats.h b/src/core/lib/debug/stats.h index 1a3a9c5384c..55db44e0c28 100644 --- a/src/core/lib/debug/stats.h +++ b/src/core/lib/debug/stats.h @@ -23,8 +23,6 @@ #include "src/core/lib/debug/stats_data.h" #include "src/core/lib/iomgr/exec_ctx.h" - - typedef struct grpc_stats_data { gpr_atm counters[GRPC_STATS_COUNTER_COUNT]; gpr_atm histograms[GRPC_STATS_HISTOGRAM_BUCKETS]; @@ -60,6 +58,4 @@ double grpc_stats_histo_percentile(const grpc_stats_data* data, size_t grpc_stats_histo_count(const grpc_stats_data* data, grpc_stats_histograms histogram); - - #endif diff --git a/src/core/lib/debug/stats_data.h b/src/core/lib/debug/stats_data.h index 7bd6ccff6fb..8a5bc973899 100644 --- a/src/core/lib/debug/stats_data.h +++ b/src/core/lib/debug/stats_data.h @@ -24,8 +24,6 @@ #include #include "src/core/lib/iomgr/exec_ctx.h" - - typedef enum { GRPC_STATS_COUNTER_CLIENT_CALLS_CREATED, GRPC_STATS_COUNTER_SERVER_CALLS_CREATED, @@ -500,6 +498,4 @@ extern const int* const grpc_stats_histo_bucket_boundaries[13]; extern void (*const grpc_stats_inc_histogram[13])(grpc_exec_ctx* exec_ctx, int x); - - #endif /* GRPC_CORE_LIB_DEBUG_STATS_DATA_H */ diff --git a/src/core/lib/debug/trace.h b/src/core/lib/debug/trace.h index 237793eeb3e..66cca144478 100644 --- a/src/core/lib/debug/trace.h +++ b/src/core/lib/debug/trace.h @@ -23,8 +23,6 @@ #include #include - - #if defined(__has_feature) #if __has_feature(thread_sanitizer) #define GRPC_THREADSAFE_TRACER @@ -54,6 +52,4 @@ void grpc_register_tracer(grpc_tracer_flag* flag); void grpc_tracer_init(const char* env_var_name); void grpc_tracer_shutdown(void); - - #endif /* GRPC_CORE_LIB_DEBUG_TRACE_H */ diff --git a/src/core/lib/http/format_request.h b/src/core/lib/http/format_request.h index 65be293f1bd..c1919651f96 100644 --- a/src/core/lib/http/format_request.h +++ b/src/core/lib/http/format_request.h @@ -22,8 +22,6 @@ #include #include "src/core/lib/http/httpcli.h" - - grpc_slice grpc_httpcli_format_get_request(const grpc_httpcli_request* request); grpc_slice grpc_httpcli_format_post_request(const grpc_httpcli_request* request, const char* body_bytes, @@ -31,6 +29,4 @@ grpc_slice grpc_httpcli_format_post_request(const grpc_httpcli_request* request, grpc_slice grpc_httpcli_format_connect_request( const grpc_httpcli_request* request); - - #endif /* GRPC_CORE_LIB_HTTP_FORMAT_REQUEST_H */ diff --git a/src/core/lib/http/httpcli.h b/src/core/lib/http/httpcli.h index d1027b82c38..6f675568bd0 100644 --- a/src/core/lib/http/httpcli.h +++ b/src/core/lib/http/httpcli.h @@ -32,8 +32,6 @@ /* User agent this library reports */ #define GRPC_HTTPCLI_USER_AGENT "grpc-httpcli/0.0" - - /* Tracks in-progress http requests TODO(ctiller): allow caching and capturing multiple requests for the same content and combining them */ @@ -125,6 +123,4 @@ typedef int (*grpc_httpcli_post_override)( void grpc_httpcli_set_override(grpc_httpcli_get_override get, grpc_httpcli_post_override post); - - #endif /* GRPC_CORE_LIB_HTTP_HTTPCLI_H */ diff --git a/src/core/lib/http/parser.h b/src/core/lib/http/parser.h index 0a17e6b6941..add6042f9bc 100644 --- a/src/core/lib/http/parser.h +++ b/src/core/lib/http/parser.h @@ -27,8 +27,6 @@ /* Maximum length of a header string of the form 'Key: Value\r\n' */ #define GRPC_HTTP_PARSER_MAX_HEADER_LENGTH 4096 - - /* A single header to be passed in a request */ typedef struct grpc_http_header { char* key; @@ -111,6 +109,4 @@ void grpc_http_response_destroy(grpc_http_response* response); extern grpc_tracer_flag grpc_http1_trace; - - #endif /* GRPC_CORE_LIB_HTTP_PARSER_H */ diff --git a/src/core/lib/iomgr/block_annotate.h b/src/core/lib/iomgr/block_annotate.h index 6eecd651f9a..340ebcb1afa 100644 --- a/src/core/lib/iomgr/block_annotate.h +++ b/src/core/lib/iomgr/block_annotate.h @@ -19,13 +19,9 @@ #ifndef GRPC_CORE_LIB_IOMGR_BLOCK_ANNOTATE_H #define GRPC_CORE_LIB_IOMGR_BLOCK_ANNOTATE_H - - void gpr_thd_start_blocking_region(); void gpr_thd_end_blocking_region(); - - /* These annotations identify the beginning and end of regions where the code may block for reasons other than synchronization functions. These include poll, epoll, and getaddrinfo. */ diff --git a/src/core/lib/iomgr/call_combiner.h b/src/core/lib/iomgr/call_combiner.h index 66aaf50a499..5cfb3f0c072 100644 --- a/src/core/lib/iomgr/call_combiner.h +++ b/src/core/lib/iomgr/call_combiner.h @@ -27,8 +27,6 @@ #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/support/mpscq.h" - - // A simple, lock-free mechanism for serializing activity related to a // single call. This is similar to a combiner but is more lightweight. // @@ -120,6 +118,4 @@ void grpc_call_combiner_cancel(grpc_exec_ctx* exec_ctx, grpc_call_combiner* call_combiner, grpc_error* error); - - #endif /* GRPC_CORE_LIB_IOMGR_CALL_COMBINER_H */ diff --git a/src/core/lib/iomgr/combiner.h b/src/core/lib/iomgr/combiner.h index e37e621a758..664326bc0c3 100644 --- a/src/core/lib/iomgr/combiner.h +++ b/src/core/lib/iomgr/combiner.h @@ -26,8 +26,6 @@ #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/support/mpscq.h" - - // Provides serialized access to some resource. // Each action queued on a combiner is executed serially in a borrowed thread. // The actual thread executing actions may change over time (but there will only @@ -65,6 +63,4 @@ bool grpc_combiner_continue_exec_ctx(grpc_exec_ctx* exec_ctx); extern grpc_tracer_flag grpc_combiner_trace; - - #endif /* GRPC_CORE_LIB_IOMGR_COMBINER_H */ diff --git a/src/core/lib/iomgr/endpoint.h b/src/core/lib/iomgr/endpoint.h index 8918438d230..6ab0a6591cc 100644 --- a/src/core/lib/iomgr/endpoint.h +++ b/src/core/lib/iomgr/endpoint.h @@ -26,8 +26,6 @@ #include "src/core/lib/iomgr/pollset_set.h" #include "src/core/lib/iomgr/resource_quota.h" - - /* An endpoint caps a streaming channel between two communicating processes. Examples may be: a tcp socket, , or some shared memory. */ @@ -104,6 +102,4 @@ struct grpc_endpoint { const grpc_endpoint_vtable* vtable; }; - - #endif /* GRPC_CORE_LIB_IOMGR_ENDPOINT_H */ diff --git a/src/core/lib/iomgr/endpoint_pair.h b/src/core/lib/iomgr/endpoint_pair.h index 35158da0aaa..506ffc88b4b 100644 --- a/src/core/lib/iomgr/endpoint_pair.h +++ b/src/core/lib/iomgr/endpoint_pair.h @@ -21,8 +21,6 @@ #include "src/core/lib/iomgr/endpoint.h" - - typedef struct { grpc_endpoint* client; grpc_endpoint* server; @@ -31,6 +29,4 @@ typedef struct { grpc_endpoint_pair grpc_iomgr_create_endpoint_pair(const char* name, grpc_channel_args* args); - - #endif /* GRPC_CORE_LIB_IOMGR_ENDPOINT_PAIR_H */ diff --git a/src/core/lib/iomgr/error.h b/src/core/lib/iomgr/error.h index f0d4437a511..bde9a24c471 100644 --- a/src/core/lib/iomgr/error.h +++ b/src/core/lib/iomgr/error.h @@ -29,8 +29,6 @@ #include "src/core/lib/debug/trace.h" - - /// Opaque representation of an error. /// See https://github.com/grpc/grpc/blob/master/doc/core/grpc-error.md for a /// full write up of this object. @@ -203,6 +201,4 @@ bool grpc_log_if_error(const char* what, grpc_error* error, const char* file, #define GRPC_LOG_IF_ERROR(what, error) \ grpc_log_if_error((what), (error), __FILE__, __LINE__) - - #endif /* GRPC_CORE_LIB_IOMGR_ERROR_H */ diff --git a/src/core/lib/iomgr/error_internal.h b/src/core/lib/iomgr/error_internal.h index 26088b2210e..6cb09c2cdbd 100644 --- a/src/core/lib/iomgr/error_internal.h +++ b/src/core/lib/iomgr/error_internal.h @@ -25,8 +25,6 @@ #include #include "src/core/lib/iomgr/error.h" - - typedef struct grpc_linked_error grpc_linked_error; struct grpc_linked_error { @@ -60,6 +58,4 @@ struct grpc_error { bool grpc_error_is_special(struct grpc_error* err); - - #endif /* GRPC_CORE_LIB_IOMGR_ERROR_INTERNAL_H */ diff --git a/src/core/lib/iomgr/ev_epoll1_linux.h b/src/core/lib/iomgr/ev_epoll1_linux.h index 03b61f5eb1d..9a1b96bd45a 100644 --- a/src/core/lib/iomgr/ev_epoll1_linux.h +++ b/src/core/lib/iomgr/ev_epoll1_linux.h @@ -22,12 +22,8 @@ #include "src/core/lib/iomgr/ev_posix.h" #include "src/core/lib/iomgr/port.h" - - // a polling engine that utilizes a singleton epoll set and turnstile polling const grpc_event_engine_vtable* grpc_init_epoll1_linux(bool explicit_request); - - #endif /* GRPC_CORE_LIB_IOMGR_EV_EPOLL1_LINUX_H */ diff --git a/src/core/lib/iomgr/ev_epollex_linux.h b/src/core/lib/iomgr/ev_epollex_linux.h index 6eb980d593f..ffa7fc7f327 100644 --- a/src/core/lib/iomgr/ev_epollex_linux.h +++ b/src/core/lib/iomgr/ev_epollex_linux.h @@ -22,11 +22,7 @@ #include "src/core/lib/iomgr/ev_posix.h" #include "src/core/lib/iomgr/port.h" - - const grpc_event_engine_vtable* grpc_init_epollex_linux( bool explicitly_requested); - - #endif /* GRPC_CORE_LIB_IOMGR_EV_EPOLLEX_LINUX_H */ diff --git a/src/core/lib/iomgr/ev_epollsig_linux.h b/src/core/lib/iomgr/ev_epollsig_linux.h index 15e94bba73d..5b8aba9d9f9 100644 --- a/src/core/lib/iomgr/ev_epollsig_linux.h +++ b/src/core/lib/iomgr/ev_epollsig_linux.h @@ -22,8 +22,6 @@ #include "src/core/lib/iomgr/ev_posix.h" #include "src/core/lib/iomgr/port.h" - - const grpc_event_engine_vtable* grpc_init_epollsig_linux(bool explicit_request); #ifdef GRPC_LINUX_EPOLL @@ -32,6 +30,4 @@ void* grpc_pollset_get_polling_island(grpc_pollset* ps); bool grpc_are_polling_islands_equal(void* p, void* q); #endif /* defined(GRPC_LINUX_EPOLL) */ - - #endif /* GRPC_CORE_LIB_IOMGR_EV_EPOLLSIG_LINUX_H */ diff --git a/src/core/lib/iomgr/ev_poll_posix.h b/src/core/lib/iomgr/ev_poll_posix.h index 820e14c3379..f6bc624d4fd 100644 --- a/src/core/lib/iomgr/ev_poll_posix.h +++ b/src/core/lib/iomgr/ev_poll_posix.h @@ -21,11 +21,7 @@ #include "src/core/lib/iomgr/ev_posix.h" - - const grpc_event_engine_vtable* grpc_init_poll_posix(bool explicit_request); const grpc_event_engine_vtable* grpc_init_poll_cv_posix(bool explicit_request); - - #endif /* GRPC_CORE_LIB_IOMGR_EV_POLL_POSIX_H */ diff --git a/src/core/lib/iomgr/ev_posix.h b/src/core/lib/iomgr/ev_posix.h index acc7f3df398..6fc10b4e3e7 100644 --- a/src/core/lib/iomgr/ev_posix.h +++ b/src/core/lib/iomgr/ev_posix.h @@ -27,8 +27,6 @@ #include "src/core/lib/iomgr/pollset_set.h" #include "src/core/lib/iomgr/wakeup_fd_posix.h" - - extern grpc_tracer_flag grpc_polling_trace; /* Disabled by default */ typedef struct grpc_fd grpc_fd; @@ -160,6 +158,4 @@ extern grpc_poll_function_type grpc_poll_function; void grpc_set_event_engine_test_only(const grpc_event_engine_vtable*); const grpc_event_engine_vtable* grpc_get_event_engine_test_only(); - - #endif /* GRPC_CORE_LIB_IOMGR_EV_POSIX_H */ diff --git a/src/core/lib/iomgr/exec_ctx.h b/src/core/lib/iomgr/exec_ctx.h index 1baca89d6ed..b415d2c2556 100644 --- a/src/core/lib/iomgr/exec_ctx.h +++ b/src/core/lib/iomgr/exec_ctx.h @@ -24,8 +24,6 @@ #include "src/core/lib/iomgr/closure.h" - - typedef gpr_atm grpc_millis; #define GRPC_MILLIS_INF_FUTURE GPR_ATM_MAX diff --git a/src/core/lib/iomgr/executor.h b/src/core/lib/iomgr/executor.h index 35823b0f0ec..d349083eebe 100644 --- a/src/core/lib/iomgr/executor.h +++ b/src/core/lib/iomgr/executor.h @@ -21,8 +21,6 @@ #include "src/core/lib/iomgr/closure.h" - - typedef enum { GRPC_EXECUTOR_SHORT, GRPC_EXECUTOR_LONG @@ -47,6 +45,4 @@ bool grpc_executor_is_threaded(); grpc_executor_shutdown */ void grpc_executor_set_threading(grpc_exec_ctx* exec_ctx, bool enable); - - #endif /* GRPC_CORE_LIB_IOMGR_EXECUTOR_H */ diff --git a/src/core/lib/iomgr/gethostname.h b/src/core/lib/iomgr/gethostname.h index 19da54378ac..9f10b4afa78 100644 --- a/src/core/lib/iomgr/gethostname.h +++ b/src/core/lib/iomgr/gethostname.h @@ -19,12 +19,8 @@ #ifndef GRPC_CORE_LIB_IOMGR_GETHOSTNAME_H #define GRPC_CORE_LIB_IOMGR_GETHOSTNAME_H - - // Returns the hostname of the local machine. // Caller takes ownership of result. char* grpc_gethostname(); - - #endif /* GRPC_CORE_LIB_IOMGR_GETHOSTNAME_H */ diff --git a/src/core/lib/iomgr/iocp_windows.h b/src/core/lib/iomgr/iocp_windows.h index ca6d3c91bd3..0e9c3481f7e 100644 --- a/src/core/lib/iomgr/iocp_windows.h +++ b/src/core/lib/iomgr/iocp_windows.h @@ -27,8 +27,6 @@ #include "src/core/lib/iomgr/socket_windows.h" - - typedef enum { GRPC_IOCP_WORK_WORK, GRPC_IOCP_WORK_TIMEOUT, @@ -43,8 +41,6 @@ void grpc_iocp_flush(void); void grpc_iocp_shutdown(void); void grpc_iocp_add_socket(grpc_winsocket*); - - #endif #endif /* GRPC_CORE_LIB_IOMGR_IOCP_WINDOWS_H */ diff --git a/src/core/lib/iomgr/iomgr.h b/src/core/lib/iomgr/iomgr.h index 4e4fb4a1a22..2f00c0343de 100644 --- a/src/core/lib/iomgr/iomgr.h +++ b/src/core/lib/iomgr/iomgr.h @@ -22,8 +22,6 @@ #include #include "src/core/lib/iomgr/port.h" - - /** Initializes the iomgr. */ void grpc_iomgr_init(grpc_exec_ctx* exec_ctx); @@ -34,6 +32,4 @@ void grpc_iomgr_start(grpc_exec_ctx* exec_ctx); * exec_ctx. */ void grpc_iomgr_shutdown(grpc_exec_ctx* exec_ctx); - - #endif /* GRPC_CORE_LIB_IOMGR_IOMGR_H */ diff --git a/src/core/lib/iomgr/iomgr_internal.h b/src/core/lib/iomgr/iomgr_internal.h index 144a92a6c4e..20b3cb70d0b 100644 --- a/src/core/lib/iomgr/iomgr_internal.h +++ b/src/core/lib/iomgr/iomgr_internal.h @@ -23,8 +23,6 @@ #include "src/core/lib/iomgr/iomgr.h" - - typedef struct grpc_iomgr_object { char* name; struct grpc_iomgr_object* next; @@ -42,6 +40,4 @@ void grpc_iomgr_platform_shutdown(void); bool grpc_iomgr_abort_on_leaks(void); - - #endif /* GRPC_CORE_LIB_IOMGR_IOMGR_INTERNAL_H */ diff --git a/src/core/lib/iomgr/iomgr_uv.h b/src/core/lib/iomgr/iomgr_uv.h index 218e696e3ab..3b4daaa73ba 100644 --- a/src/core/lib/iomgr/iomgr_uv.h +++ b/src/core/lib/iomgr/iomgr_uv.h @@ -23,14 +23,10 @@ #include - - /* The thread ID of the thread on which grpc was initialized. Used to verify * that all calls into libuv are made on that same thread */ extern gpr_thd_id g_init_thread; - - #ifdef GRPC_UV_THREAD_CHECK #define GRPC_UV_ASSERT_SAME_THREAD() \ GPR_ASSERT(gpr_thd_currentid() == g_init_thread) diff --git a/src/core/lib/iomgr/is_epollexclusive_available.h b/src/core/lib/iomgr/is_epollexclusive_available.h index 8dc7af0bcee..1d2e133a3b1 100644 --- a/src/core/lib/iomgr/is_epollexclusive_available.h +++ b/src/core/lib/iomgr/is_epollexclusive_available.h @@ -21,10 +21,6 @@ #include - - bool grpc_is_epollexclusive_available(void); - - #endif /* GRPC_CORE_LIB_IOMGR_IS_EPOLLEXCLUSIVE_AVAILABLE_H */ diff --git a/src/core/lib/iomgr/load_file.h b/src/core/lib/iomgr/load_file.h index 61e0cb1a1a4..a7336527ce9 100644 --- a/src/core/lib/iomgr/load_file.h +++ b/src/core/lib/iomgr/load_file.h @@ -25,13 +25,9 @@ #include "src/core/lib/iomgr/error.h" - - /* Loads the content of a file into a slice. add_null_terminator will add a NULL terminator if non-zero. */ grpc_error* grpc_load_file(const char* filename, int add_null_terminator, grpc_slice* slice); - - #endif /* GRPC_CORE_LIB_IOMGR_LOAD_FILE_H */ diff --git a/src/core/lib/iomgr/polling_entity.h b/src/core/lib/iomgr/polling_entity.h index f0b4617a9d8..dbe579e60d9 100644 --- a/src/core/lib/iomgr/polling_entity.h +++ b/src/core/lib/iomgr/polling_entity.h @@ -22,8 +22,6 @@ #include "src/core/lib/iomgr/pollset.h" #include "src/core/lib/iomgr/pollset_set.h" - - typedef enum grpc_pollset_tag { GRPC_POLLS_NONE, GRPC_POLLS_POLLSET, @@ -67,5 +65,4 @@ void grpc_polling_entity_del_from_pollset_set(grpc_exec_ctx* exec_ctx, grpc_polling_entity* pollent, grpc_pollset_set* pss_dst); - #endif /* GRPC_CORE_LIB_IOMGR_POLLING_ENTITY_H */ diff --git a/src/core/lib/iomgr/pollset.h b/src/core/lib/iomgr/pollset.h index 761aa806433..1905e1ec33a 100644 --- a/src/core/lib/iomgr/pollset.h +++ b/src/core/lib/iomgr/pollset.h @@ -25,8 +25,6 @@ #include "src/core/lib/iomgr/exec_ctx.h" - - #ifndef NDEBUG extern grpc_tracer_flag grpc_trace_fd_refcount; #endif @@ -82,6 +80,4 @@ grpc_error* grpc_pollset_kick(grpc_exec_ctx* exec_ctx, grpc_pollset* pollset, grpc_pollset_worker* specific_worker) GRPC_MUST_USE_RESULT; - - #endif /* GRPC_CORE_LIB_IOMGR_POLLSET_H */ diff --git a/src/core/lib/iomgr/pollset_set.h b/src/core/lib/iomgr/pollset_set.h index 4a3793eccbd..089c15cc949 100644 --- a/src/core/lib/iomgr/pollset_set.h +++ b/src/core/lib/iomgr/pollset_set.h @@ -21,8 +21,6 @@ #include "src/core/lib/iomgr/pollset.h" - - /* A grpc_pollset_set is a set of pollsets that are interested in an action. Adding a pollset to a pollset_set automatically adds any fd's (etc) that have been registered with the set_set to that pollset. @@ -46,6 +44,4 @@ void grpc_pollset_set_del_pollset_set(grpc_exec_ctx* exec_ctx, grpc_pollset_set* bag, grpc_pollset_set* item); - - #endif /* GRPC_CORE_LIB_IOMGR_POLLSET_SET_H */ diff --git a/src/core/lib/iomgr/pollset_uv.h b/src/core/lib/iomgr/pollset_uv.h index ce62297cc79..566c110ca6c 100644 --- a/src/core/lib/iomgr/pollset_uv.h +++ b/src/core/lib/iomgr/pollset_uv.h @@ -19,13 +19,9 @@ #ifndef GRPC_CORE_LIB_IOMGR_POLLSET_UV_H #define GRPC_CORE_LIB_IOMGR_POLLSET_UV_H - - extern int grpc_pollset_work_run_loop; void grpc_pollset_global_init(void); void grpc_pollset_global_shutdown(void); - - #endif /* GRPC_CORE_LIB_IOMGR_POLLSET_UV_H */ diff --git a/src/core/lib/iomgr/pollset_windows.h b/src/core/lib/iomgr/pollset_windows.h index d0b4144c276..93fe7d669ba 100644 --- a/src/core/lib/iomgr/pollset_windows.h +++ b/src/core/lib/iomgr/pollset_windows.h @@ -26,8 +26,6 @@ #ifdef GRPC_WINSOCK_SOCKET #include "src/core/lib/iomgr/socket_windows.h" - - /* There isn't really any such thing as a pollset under Windows, due to the nature of the IO completion ports. A Windows "pollset" is merely a mutex used to synchronize with the IOCP, and workers are condition variables @@ -65,8 +63,6 @@ struct grpc_pollset { void grpc_pollset_global_init(void); void grpc_pollset_global_shutdown(void); - - #endif #endif /* GRPC_CORE_LIB_IOMGR_POLLSET_WINDOWS_H */ diff --git a/src/core/lib/iomgr/resolve_address.h b/src/core/lib/iomgr/resolve_address.h index 790d614aae2..5105020404b 100644 --- a/src/core/lib/iomgr/resolve_address.h +++ b/src/core/lib/iomgr/resolve_address.h @@ -25,8 +25,6 @@ #define GRPC_MAX_SOCKADDR_SIZE 128 - - typedef struct { char addr[GRPC_MAX_SOCKADDR_SIZE]; size_t len; @@ -54,6 +52,4 @@ extern grpc_error* (*grpc_blocking_resolve_address)( const char* name, const char* default_port, grpc_resolved_addresses** addresses); - - #endif /* GRPC_CORE_LIB_IOMGR_RESOLVE_ADDRESS_H */ diff --git a/src/core/lib/iomgr/resource_quota.h b/src/core/lib/iomgr/resource_quota.h index 331efe0e358..e085ab11d01 100644 --- a/src/core/lib/iomgr/resource_quota.h +++ b/src/core/lib/iomgr/resource_quota.h @@ -24,8 +24,6 @@ #include "src/core/lib/debug/trace.h" #include "src/core/lib/iomgr/exec_ctx.h" - - /** \file Tracks resource usage against a pool. The current implementation tracks only memory usage, but in the future @@ -152,6 +150,4 @@ grpc_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/sockaddr_utils.h b/src/core/lib/iomgr/sockaddr_utils.h index 0d5cc5bb425..e3bd51a4ad2 100644 --- a/src/core/lib/iomgr/sockaddr_utils.h +++ b/src/core/lib/iomgr/sockaddr_utils.h @@ -21,8 +21,6 @@ #include "src/core/lib/iomgr/resolve_address.h" - - /* Returns true if addr is an IPv4-mapped IPv6 address within the ::ffff:0.0.0.0/96 range, or false otherwise. @@ -79,6 +77,4 @@ const char* grpc_sockaddr_get_uri_scheme(const grpc_resolved_address* addr); int grpc_sockaddr_get_family(const grpc_resolved_address* resolved_addr); - - #endif /* GRPC_CORE_LIB_IOMGR_SOCKADDR_UTILS_H */ diff --git a/src/core/lib/iomgr/socket_factory_posix.h b/src/core/lib/iomgr/socket_factory_posix.h index 920a72901e7..af57cc5b605 100644 --- a/src/core/lib/iomgr/socket_factory_posix.h +++ b/src/core/lib/iomgr/socket_factory_posix.h @@ -23,8 +23,6 @@ #include #include "src/core/lib/iomgr/resolve_address.h" - - /** The virtual table of grpc_socket_factory */ typedef struct { /** Replacement for socket(2) */ @@ -66,6 +64,4 @@ int grpc_socket_factory_compare(grpc_socket_factory* a, grpc_socket_factory* b); grpc_socket_factory* grpc_socket_factory_ref(grpc_socket_factory* factory); void grpc_socket_factory_unref(grpc_socket_factory* factory); - - #endif /* GRPC_CORE_LIB_IOMGR_SOCKET_FACTORY_POSIX_H */ diff --git a/src/core/lib/iomgr/socket_mutator.h b/src/core/lib/iomgr/socket_mutator.h index 703aee3145f..0a97cf657f0 100644 --- a/src/core/lib/iomgr/socket_mutator.h +++ b/src/core/lib/iomgr/socket_mutator.h @@ -24,8 +24,6 @@ #include - - /** The virtual table of grpc_socket_mutator */ typedef struct { /** Mutates the socket opitons of \a fd */ @@ -58,6 +56,4 @@ int grpc_socket_mutator_compare(grpc_socket_mutator* a, grpc_socket_mutator* b); grpc_socket_mutator* grpc_socket_mutator_ref(grpc_socket_mutator* mutator); void grpc_socket_mutator_unref(grpc_socket_mutator* mutator); - - #endif /* GRPC_CORE_LIB_IOMGR_SOCKET_MUTATOR_H */ diff --git a/src/core/lib/iomgr/socket_utils.h b/src/core/lib/iomgr/socket_utils.h index dc5c4dc56e0..9fd141b6dec 100644 --- a/src/core/lib/iomgr/socket_utils.h +++ b/src/core/lib/iomgr/socket_utils.h @@ -21,11 +21,7 @@ #include - - /* A wrapper for inet_ntop on POSIX systems and InetNtop on Windows systems */ const char* grpc_inet_ntop(int af, const void* src, char* dst, size_t size); - - #endif /* GRPC_CORE_LIB_IOMGR_SOCKET_UTILS_H */ diff --git a/src/core/lib/iomgr/socket_utils_posix.h b/src/core/lib/iomgr/socket_utils_posix.h index 02fdd02e2b3..77df4205ff2 100644 --- a/src/core/lib/iomgr/socket_utils_posix.h +++ b/src/core/lib/iomgr/socket_utils_posix.h @@ -29,8 +29,6 @@ #include "src/core/lib/iomgr/socket_factory_posix.h" #include "src/core/lib/iomgr/socket_mutator.h" - - /* a wrapper for accept or accept4 */ int grpc_accept4(int sockfd, grpc_resolved_address* resolved_addr, int nonblock, int cloexec); @@ -131,6 +129,4 @@ grpc_error* grpc_create_dualstack_socket_using_factory( grpc_socket_factory* factory, const grpc_resolved_address* addr, int type, int protocol, grpc_dualstack_mode* dsmode, int* newfd); - - #endif /* GRPC_CORE_LIB_IOMGR_SOCKET_UTILS_POSIX_H */ diff --git a/src/core/lib/iomgr/socket_windows.h b/src/core/lib/iomgr/socket_windows.h index 5a09c52b7a5..04e0a89d703 100644 --- a/src/core/lib/iomgr/socket_windows.h +++ b/src/core/lib/iomgr/socket_windows.h @@ -31,8 +31,6 @@ #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/iomgr_internal.h" - - /* This holds the data for an outstanding read or write on a socket. The mutex to protect the concurrent access to that data is the one inside the winsocket wrapper. */ @@ -112,8 +110,6 @@ void grpc_socket_become_ready(grpc_exec_ctx* exec_ctx, grpc_winsocket* winsocket, grpc_winsocket_callback_info* ci); - - #endif #endif /* GRPC_CORE_LIB_IOMGR_SOCKET_WINDOWS_H */ diff --git a/src/core/lib/iomgr/tcp_client.h b/src/core/lib/iomgr/tcp_client.h index 9ad06f2f9ed..75e2fe0f36c 100644 --- a/src/core/lib/iomgr/tcp_client.h +++ b/src/core/lib/iomgr/tcp_client.h @@ -25,8 +25,6 @@ #include "src/core/lib/iomgr/pollset_set.h" #include "src/core/lib/iomgr/resolve_address.h" - - /* Asynchronously connect to an address (specified as (addr, len)), and call cb with arg and the completed connection when done (or call cb with arg and NULL on failure). @@ -39,6 +37,4 @@ void grpc_tcp_client_connect(grpc_exec_ctx* exec_ctx, grpc_closure* on_connect, const grpc_resolved_address* addr, grpc_millis deadline); - - #endif /* GRPC_CORE_LIB_IOMGR_TCP_CLIENT_H */ diff --git a/src/core/lib/iomgr/tcp_client_posix.h b/src/core/lib/iomgr/tcp_client_posix.h index aac74effba3..2b1fe79e902 100644 --- a/src/core/lib/iomgr/tcp_client_posix.h +++ b/src/core/lib/iomgr/tcp_client_posix.h @@ -23,12 +23,8 @@ #include "src/core/lib/iomgr/ev_posix.h" #include "src/core/lib/iomgr/tcp_client.h" - - grpc_endpoint* grpc_tcp_client_create_from_fd( grpc_exec_ctx* exec_ctx, grpc_fd* fd, const grpc_channel_args* channel_args, const char* addr_str); - - #endif /* GRPC_CORE_LIB_IOMGR_TCP_CLIENT_POSIX_H */ diff --git a/src/core/lib/iomgr/tcp_posix.h b/src/core/lib/iomgr/tcp_posix.h index 273e3277a93..ff899658015 100644 --- a/src/core/lib/iomgr/tcp_posix.h +++ b/src/core/lib/iomgr/tcp_posix.h @@ -33,8 +33,6 @@ #include "src/core/lib/iomgr/endpoint.h" #include "src/core/lib/iomgr/ev_posix.h" - - extern grpc_tracer_flag grpc_tcp_trace; /* Create a tcp endpoint given a file desciptor and a read slice size. @@ -55,6 +53,4 @@ int grpc_tcp_fd(grpc_endpoint* ep); void grpc_tcp_destroy_and_release_fd(grpc_exec_ctx* exec_ctx, grpc_endpoint* ep, int* fd, grpc_closure* done); - - #endif /* GRPC_CORE_LIB_IOMGR_TCP_POSIX_H */ diff --git a/src/core/lib/iomgr/tcp_server.h b/src/core/lib/iomgr/tcp_server.h index ab271f997c1..a1757a2b3ee 100644 --- a/src/core/lib/iomgr/tcp_server.h +++ b/src/core/lib/iomgr/tcp_server.h @@ -25,8 +25,6 @@ #include "src/core/lib/iomgr/endpoint.h" #include "src/core/lib/iomgr/resolve_address.h" - - /* Forward decl of grpc_tcp_server */ typedef struct grpc_tcp_server grpc_tcp_server; @@ -100,6 +98,4 @@ void grpc_tcp_server_unref(grpc_exec_ctx* exec_ctx, grpc_tcp_server* s); void grpc_tcp_server_shutdown_listeners(grpc_exec_ctx* exec_ctx, grpc_tcp_server* s); - - #endif /* GRPC_CORE_LIB_IOMGR_TCP_SERVER_H */ diff --git a/src/core/lib/iomgr/tcp_server_utils_posix.h b/src/core/lib/iomgr/tcp_server_utils_posix.h index fb2510ec390..6046f257f98 100644 --- a/src/core/lib/iomgr/tcp_server_utils_posix.h +++ b/src/core/lib/iomgr/tcp_server_utils_posix.h @@ -24,8 +24,6 @@ #include "src/core/lib/iomgr/socket_utils_posix.h" #include "src/core/lib/iomgr/tcp_server.h" - - /* one listening port */ typedef struct grpc_tcp_listener { int fd; @@ -119,6 +117,4 @@ grpc_error* grpc_tcp_server_prepare_socket(int fd, /* Ruturn true if the platform supports ifaddrs */ bool grpc_tcp_server_have_ifaddrs(void); - - #endif /* GRPC_CORE_LIB_IOMGR_TCP_SERVER_UTILS_POSIX_H */ diff --git a/src/core/lib/iomgr/tcp_uv.h b/src/core/lib/iomgr/tcp_uv.h index df12c882e0d..aa648edcf3a 100644 --- a/src/core/lib/iomgr/tcp_uv.h +++ b/src/core/lib/iomgr/tcp_uv.h @@ -42,14 +42,10 @@ extern grpc_tracer_flag grpc_tcp_trace; #define GRPC_TCP_DEFAULT_READ_SLICE_SIZE 8192 - - grpc_endpoint* grpc_tcp_create(uv_tcp_t* handle, grpc_resource_quota* resource_quota, char* peer_string); - - #endif /* GRPC_UV */ #endif /* GRPC_CORE_LIB_IOMGR_TCP_UV_H */ diff --git a/src/core/lib/iomgr/tcp_windows.h b/src/core/lib/iomgr/tcp_windows.h index ccfde727231..28287e27950 100644 --- a/src/core/lib/iomgr/tcp_windows.h +++ b/src/core/lib/iomgr/tcp_windows.h @@ -35,8 +35,6 @@ #include "src/core/lib/iomgr/endpoint.h" #include "src/core/lib/iomgr/socket_windows.h" - - /* Create a tcp endpoint given a winsock handle. * Takes ownership of the handle. */ @@ -46,8 +44,6 @@ grpc_endpoint* grpc_tcp_create(grpc_exec_ctx* exec_ctx, grpc_winsocket* socket, grpc_error* grpc_tcp_prepare_socket(SOCKET sock); - - #endif #endif /* GRPC_CORE_LIB_IOMGR_TCP_WINDOWS_H */ diff --git a/src/core/lib/iomgr/time_averaged_stats.h b/src/core/lib/iomgr/time_averaged_stats.h index 519bc2db16c..8745f7fa13f 100644 --- a/src/core/lib/iomgr/time_averaged_stats.h +++ b/src/core/lib/iomgr/time_averaged_stats.h @@ -19,8 +19,6 @@ #ifndef GRPC_CORE_LIB_IOMGR_TIME_AVERAGED_STATS_H #define GRPC_CORE_LIB_IOMGR_TIME_AVERAGED_STATS_H - - /* This tracks a time-decaying weighted average. It works by collecting batches of samples and then mixing their average into a time-decaying weighted mean. It is designed for batch operations where we do many adds @@ -72,6 +70,4 @@ void grpc_time_averaged_stats_add_sample(grpc_time_averaged_stats* stats, value. */ double grpc_time_averaged_stats_update_average(grpc_time_averaged_stats* stats); - - #endif /* GRPC_CORE_LIB_IOMGR_TIME_AVERAGED_STATS_H */ diff --git a/src/core/lib/iomgr/timer.h b/src/core/lib/iomgr/timer.h index 9e454d995df..b9acce229ec 100644 --- a/src/core/lib/iomgr/timer.h +++ b/src/core/lib/iomgr/timer.h @@ -32,8 +32,6 @@ #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/iomgr.h" - - typedef struct grpc_timer grpc_timer; /* Initialize *timer. When expired or canceled, closure will be called with @@ -104,6 +102,4 @@ void grpc_timer_consume_kick(void); void grpc_kick_poller(void); - - #endif /* GRPC_CORE_LIB_IOMGR_TIMER_H */ diff --git a/src/core/lib/iomgr/timer_heap.h b/src/core/lib/iomgr/timer_heap.h index 12a7ab2884f..436eef55a6a 100644 --- a/src/core/lib/iomgr/timer_heap.h +++ b/src/core/lib/iomgr/timer_heap.h @@ -21,8 +21,6 @@ #include "src/core/lib/iomgr/timer.h" - - typedef struct { grpc_timer** timers; uint32_t timer_count; @@ -41,6 +39,4 @@ void grpc_timer_heap_pop(grpc_timer_heap* heap); int grpc_timer_heap_is_empty(grpc_timer_heap* heap); - - #endif /* GRPC_CORE_LIB_IOMGR_TIMER_HEAP_H */ diff --git a/src/core/lib/iomgr/timer_manager.h b/src/core/lib/iomgr/timer_manager.h index 861ee6845e7..0ba502928a5 100644 --- a/src/core/lib/iomgr/timer_manager.h +++ b/src/core/lib/iomgr/timer_manager.h @@ -21,8 +21,6 @@ #include - - /* Timer Manager tries to keep one thread waiting for the next timeout at all times */ @@ -36,6 +34,4 @@ void grpc_timer_manager_set_threading(bool enabled); * disabled */ void grpc_timer_manager_tick(void); - - #endif /* GRPC_CORE_LIB_IOMGR_TIMER_MANAGER_H */ diff --git a/src/core/lib/iomgr/udp_server.h b/src/core/lib/iomgr/udp_server.h index 6bd5b205c3b..8cc08d321da 100644 --- a/src/core/lib/iomgr/udp_server.h +++ b/src/core/lib/iomgr/udp_server.h @@ -23,8 +23,6 @@ #include "src/core/lib/iomgr/ev_posix.h" #include "src/core/lib/iomgr/resolve_address.h" - - /* Forward decl of struct grpc_server */ /* This is not typedef'ed to avoid a typedef-redefinition error */ struct grpc_server; @@ -75,6 +73,4 @@ int grpc_udp_server_add_port(grpc_udp_server* s, void grpc_udp_server_destroy(grpc_exec_ctx* exec_ctx, grpc_udp_server* server, grpc_closure* on_done); - - #endif /* GRPC_CORE_LIB_IOMGR_UDP_SERVER_H */ diff --git a/src/core/lib/iomgr/unix_sockets_posix.h b/src/core/lib/iomgr/unix_sockets_posix.h index a0d90723701..1c079e6e765 100644 --- a/src/core/lib/iomgr/unix_sockets_posix.h +++ b/src/core/lib/iomgr/unix_sockets_posix.h @@ -25,8 +25,6 @@ #include "src/core/lib/iomgr/resolve_address.h" - - void grpc_create_socketpair_if_unix(int sv[2]); grpc_error* grpc_resolve_unix_domain_address( @@ -40,6 +38,4 @@ void grpc_unlink_if_unix_domain_socket( char* grpc_sockaddr_to_uri_unix_if_possible( const grpc_resolved_address* resolved_addr); - - #endif /* GRPC_CORE_LIB_IOMGR_UNIX_SOCKETS_POSIX_H */ diff --git a/src/core/lib/iomgr/wakeup_fd_cv.h b/src/core/lib/iomgr/wakeup_fd_cv.h index 94473318e57..017e41bfa88 100644 --- a/src/core/lib/iomgr/wakeup_fd_cv.h +++ b/src/core/lib/iomgr/wakeup_fd_cv.h @@ -40,8 +40,6 @@ #define GRPC_FD_TO_IDX(fd) (-(fd)-1) #define GRPC_IDX_TO_FD(idx) (-(idx)-1) - - typedef struct cv_node { gpr_cv* cv; struct cv_node* next; @@ -66,6 +64,4 @@ typedef struct cv_fd_table { extern const grpc_wakeup_fd_vtable grpc_cv_wakeup_fd_vtable; - - #endif /* GRPC_CORE_LIB_IOMGR_WAKEUP_FD_CV_H */ diff --git a/src/core/lib/iomgr/wakeup_fd_pipe.h b/src/core/lib/iomgr/wakeup_fd_pipe.h index bb1dfd7a263..326a0c4e01d 100644 --- a/src/core/lib/iomgr/wakeup_fd_pipe.h +++ b/src/core/lib/iomgr/wakeup_fd_pipe.h @@ -21,10 +21,6 @@ #include "src/core/lib/iomgr/wakeup_fd_posix.h" - - extern const grpc_wakeup_fd_vtable grpc_pipe_wakeup_fd_vtable; - - #endif /* GRPC_CORE_LIB_IOMGR_WAKEUP_FD_PIPE_H */ diff --git a/src/core/lib/iomgr/wakeup_fd_posix.h b/src/core/lib/iomgr/wakeup_fd_posix.h index 65a80d44f41..a9584d0d489 100644 --- a/src/core/lib/iomgr/wakeup_fd_posix.h +++ b/src/core/lib/iomgr/wakeup_fd_posix.h @@ -49,8 +49,6 @@ #include "src/core/lib/iomgr/error.h" - - void grpc_wakeup_fd_global_init(void); void grpc_wakeup_fd_global_destroy(void); @@ -93,6 +91,4 @@ void grpc_wakeup_fd_destroy(grpc_wakeup_fd* fd_info); * wakeup_fd_nospecial.c if no such implementation exists. */ extern const grpc_wakeup_fd_vtable grpc_specialized_wakeup_fd_vtable; - - #endif /* GRPC_CORE_LIB_IOMGR_WAKEUP_FD_POSIX_H */ diff --git a/src/core/lib/json/json.h b/src/core/lib/json/json.h index 0e841e0726c..bbd43025eb8 100644 --- a/src/core/lib/json/json.h +++ b/src/core/lib/json/json.h @@ -23,8 +23,6 @@ #include "src/core/lib/json/json_common.h" - - /* A tree-like structure to hold json values. The key and value pointers * are not owned by it. */ @@ -72,6 +70,4 @@ char* grpc_json_dump_to_string(grpc_json* json, int indent); grpc_json* grpc_json_create(grpc_json_type type); void grpc_json_destroy(grpc_json* json); - - #endif /* GRPC_CORE_LIB_JSON_JSON_H */ diff --git a/src/core/lib/json/json_reader.h b/src/core/lib/json/json_reader.h index 62718bbcdc3..03185cb2b65 100644 --- a/src/core/lib/json/json_reader.h +++ b/src/core/lib/json/json_reader.h @@ -22,8 +22,6 @@ #include #include "src/core/lib/json/json_common.h" - - typedef enum { GRPC_JSON_STATE_OBJECT_KEY_BEGIN, GRPC_JSON_STATE_OBJECT_KEY_STRING, @@ -144,6 +142,4 @@ void grpc_json_reader_init(grpc_json_reader* reader, */ int grpc_json_reader_is_complete(grpc_json_reader* reader); - - #endif /* GRPC_CORE_LIB_JSON_JSON_READER_H */ diff --git a/src/core/lib/json/json_writer.h b/src/core/lib/json/json_writer.h index ead8426d03b..a4f2d4daeb3 100644 --- a/src/core/lib/json/json_writer.h +++ b/src/core/lib/json/json_writer.h @@ -35,8 +35,6 @@ #include "src/core/lib/json/json_common.h" - - typedef struct grpc_json_writer_vtable { /* Adds a character to the output stream. */ void (*output_char)(void* userdata, char); @@ -81,6 +79,4 @@ void grpc_json_writer_value_raw_with_len(grpc_json_writer* writer, void grpc_json_writer_value_string(grpc_json_writer* writer, const char* string); - - #endif /* GRPC_CORE_LIB_JSON_JSON_WRITER_H */ diff --git a/src/core/lib/profiling/timers.h b/src/core/lib/profiling/timers.h index a0a0a4fff1f..9f11f771e67 100644 --- a/src/core/lib/profiling/timers.h +++ b/src/core/lib/profiling/timers.h @@ -19,8 +19,6 @@ #ifndef GRPC_CORE_LIB_PROFILING_TIMERS_H #define GRPC_CORE_LIB_PROFILING_TIMERS_H - - void gpr_timers_global_init(void); void gpr_timers_global_destroy(void); diff --git a/src/core/lib/security/context/security_context.h b/src/core/lib/security/context/security_context.h index 261bc167f56..41152643ea7 100644 --- a/src/core/lib/security/context/security_context.h +++ b/src/core/lib/security/context/security_context.h @@ -26,8 +26,6 @@ extern grpc_tracer_flag grpc_trace_auth_context_refcount; #endif - - /* --- grpc_auth_context --- High level authentication context object. Can optionally be chained. */ @@ -114,6 +112,4 @@ grpc_auth_context* grpc_auth_context_from_arg(const grpc_arg* arg); grpc_auth_context* grpc_find_auth_context_in_args( const grpc_channel_args* args); - - #endif /* GRPC_CORE_LIB_SECURITY_CONTEXT_SECURITY_CONTEXT_H */ diff --git a/src/core/lib/security/credentials/composite/composite_credentials.h b/src/core/lib/security/credentials/composite/composite_credentials.h index e3438dd3d11..11990d38ff7 100644 --- a/src/core/lib/security/credentials/composite/composite_credentials.h +++ b/src/core/lib/security/credentials/composite/composite_credentials.h @@ -21,8 +21,6 @@ #include "src/core/lib/security/credentials/credentials.h" - - typedef struct { grpc_call_credentials** creds_array; size_t num_creds; @@ -55,7 +53,5 @@ typedef struct { grpc_call_credentials_array inner; } grpc_composite_call_credentials; - - #endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_COMPOSITE_COMPOSITE_CREDENTIALS_H \ */ diff --git a/src/core/lib/security/credentials/credentials.h b/src/core/lib/security/credentials/credentials.h index f74b047edc7..bc1bd11c77d 100644 --- a/src/core/lib/security/credentials/credentials.h +++ b/src/core/lib/security/credentials/credentials.h @@ -29,8 +29,6 @@ #include "src/core/lib/iomgr/polling_entity.h" #include "src/core/lib/security/transport/security_connector.h" - - struct grpc_http_response; /* --- Constants. --- */ @@ -254,6 +252,4 @@ grpc_credentials_metadata_request* grpc_credentials_metadata_request_create( void grpc_credentials_metadata_request_destroy( grpc_exec_ctx* exec_ctx, grpc_credentials_metadata_request* r); - - #endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_CREDENTIALS_H */ diff --git a/src/core/lib/security/credentials/fake/fake_credentials.h b/src/core/lib/security/credentials/fake/fake_credentials.h index 7645671cee9..0e9ff155d89 100644 --- a/src/core/lib/security/credentials/fake/fake_credentials.h +++ b/src/core/lib/security/credentials/fake/fake_credentials.h @@ -21,8 +21,6 @@ #include "src/core/lib/security/credentials/credentials.h" - - /* -- Fake transport security credentials. -- */ /* Creates a fake transport security credentials object for testing. */ @@ -58,6 +56,4 @@ typedef struct { bool is_async; } grpc_md_only_test_credentials; - - #endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_FAKE_FAKE_CREDENTIALS_H */ diff --git a/src/core/lib/security/credentials/google_default/google_default_credentials.h b/src/core/lib/security/credentials/google_default/google_default_credentials.h index 6453480f0fb..b163e486310 100644 --- a/src/core/lib/security/credentials/google_default/google_default_credentials.h +++ b/src/core/lib/security/credentials/google_default/google_default_credentials.h @@ -23,8 +23,6 @@ #include "src/core/lib/security/credentials/credentials.h" - - #define GRPC_GOOGLE_CLOUD_SDK_CONFIG_DIRECTORY "gcloud" #define GRPC_GOOGLE_WELL_KNOWN_CREDENTIALS_FILE \ "application_default_credentials.json" @@ -43,7 +41,5 @@ void grpc_flush_cached_google_default_credentials(void); - - #endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_GOOGLE_DEFAULT_GOOGLE_DEFAULT_CREDENTIALS_H \ */ diff --git a/src/core/lib/security/credentials/jwt/json_token.h b/src/core/lib/security/credentials/jwt/json_token.h index 038f470a42a..9b774882b76 100644 --- a/src/core/lib/security/credentials/jwt/json_token.h +++ b/src/core/lib/security/credentials/jwt/json_token.h @@ -19,8 +19,6 @@ #ifndef GRPC_CORE_LIB_SECURITY_CREDENTIALS_JWT_JSON_TOKEN_H #define GRPC_CORE_LIB_SECURITY_CREDENTIALS_JWT_JSON_TOKEN_H - - #include #include @@ -72,6 +70,4 @@ typedef char* (*grpc_jwt_encode_and_sign_override)( void grpc_jwt_encode_and_sign_set_override( grpc_jwt_encode_and_sign_override func); - - #endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_JWT_JSON_TOKEN_H */ diff --git a/src/core/lib/security/credentials/jwt/jwt_credentials.h b/src/core/lib/security/credentials/jwt/jwt_credentials.h index cd461d217ec..85f068aac84 100644 --- a/src/core/lib/security/credentials/jwt/jwt_credentials.h +++ b/src/core/lib/security/credentials/jwt/jwt_credentials.h @@ -22,8 +22,6 @@ #include "src/core/lib/security/credentials/credentials.h" #include "src/core/lib/security/credentials/jwt/json_token.h" - - typedef struct { grpc_call_credentials base; @@ -47,6 +45,4 @@ grpc_service_account_jwt_access_credentials_create_from_auth_json_key( grpc_exec_ctx* exec_ctx, grpc_auth_json_key key, gpr_timespec token_lifetime); - - #endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_JWT_JWT_CREDENTIALS_H */ diff --git a/src/core/lib/security/credentials/jwt/jwt_verifier.h b/src/core/lib/security/credentials/jwt/jwt_verifier.h index 98db50887b4..2aacd497c7f 100644 --- a/src/core/lib/security/credentials/jwt/jwt_verifier.h +++ b/src/core/lib/security/credentials/jwt/jwt_verifier.h @@ -32,8 +32,6 @@ #define GRPC_GOOGLE_SERVICE_ACCOUNTS_KEY_URL_PREFIX \ "www.googleapis.com/robot/v1/metadata/x509" - - /* --- grpc_jwt_verifier_status. --- */ typedef enum { @@ -124,6 +122,4 @@ grpc_jwt_verifier_status grpc_jwt_claims_check(const grpc_jwt_claims* claims, const char* audience); const char* grpc_jwt_issuer_email_domain(const char* issuer); - - #endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_JWT_JWT_VERIFIER_H */ diff --git a/src/core/lib/security/credentials/oauth2/oauth2_credentials.h b/src/core/lib/security/credentials/oauth2/oauth2_credentials.h index 57332f0a39e..627783d648f 100644 --- a/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +++ b/src/core/lib/security/credentials/oauth2/oauth2_credentials.h @@ -22,8 +22,6 @@ #include "src/core/lib/json/json.h" #include "src/core/lib/security/credentials/credentials.h" - - // auth_refresh_token parsing. typedef struct { const char* type; @@ -104,6 +102,4 @@ grpc_oauth2_token_fetcher_credentials_parse_server_response( grpc_exec_ctx* exec_ctx, const struct grpc_http_response* response, grpc_mdelem* token_md, grpc_millis* token_lifetime); - - #endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_OAUTH2_OAUTH2_CREDENTIALS_H */ diff --git a/src/core/lib/security/credentials/ssl/ssl_credentials.h b/src/core/lib/security/credentials/ssl/ssl_credentials.h index 5d10de71a37..00039058572 100644 --- a/src/core/lib/security/credentials/ssl/ssl_credentials.h +++ b/src/core/lib/security/credentials/ssl/ssl_credentials.h @@ -20,8 +20,6 @@ #include "src/core/lib/security/credentials/credentials.h" - - typedef struct { grpc_channel_credentials base; grpc_ssl_config config; @@ -51,6 +49,4 @@ tsi_ssl_pem_key_cert_pair* grpc_convert_grpc_to_tsi_cert_pairs( void grpc_tsi_ssl_pem_key_cert_pairs_destroy(tsi_ssl_pem_key_cert_pair* kp, size_t num_key_cert_pairs); - - #endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_SSL_SSL_CREDENTIALS_H */ diff --git a/src/core/lib/security/transport/auth_filters.h b/src/core/lib/security/transport/auth_filters.h index add335d74fc..e999a027aeb 100644 --- a/src/core/lib/security/transport/auth_filters.h +++ b/src/core/lib/security/transport/auth_filters.h @@ -22,8 +22,6 @@ #include #include "src/core/lib/channel/channel_stack.h" - - extern const grpc_channel_filter grpc_client_auth_filter; extern const grpc_channel_filter grpc_server_auth_filter; @@ -34,6 +32,4 @@ void grpc_auth_metadata_context_build( void grpc_auth_metadata_context_reset(grpc_auth_metadata_context* context); - - #endif /* GRPC_CORE_LIB_SECURITY_TRANSPORT_AUTH_FILTERS_H */ diff --git a/src/core/lib/security/transport/lb_targets_info.h b/src/core/lib/security/transport/lb_targets_info.h index 0442d8df0be..7543d3c012f 100644 --- a/src/core/lib/security/transport/lb_targets_info.h +++ b/src/core/lib/security/transport/lb_targets_info.h @@ -21,8 +21,6 @@ #include "src/core/lib/slice/slice_hash_table.h" - - /** Return a channel argument containing \a targets_info. */ grpc_arg grpc_lb_targets_info_create_channel_arg( grpc_slice_hash_table* targets_info); @@ -31,6 +29,4 @@ grpc_arg grpc_lb_targets_info_create_channel_arg( grpc_slice_hash_table* grpc_lb_targets_info_find_in_args( const grpc_channel_args* args); - - #endif /* GRPC_CORE_LIB_SECURITY_TRANSPORT_LB_TARGETS_INFO_H */ diff --git a/src/core/lib/security/transport/secure_endpoint.h b/src/core/lib/security/transport/secure_endpoint.h index 7f0843f17a4..aff6b220509 100644 --- a/src/core/lib/security/transport/secure_endpoint.h +++ b/src/core/lib/security/transport/secure_endpoint.h @@ -22,8 +22,6 @@ #include #include "src/core/lib/iomgr/endpoint.h" - - struct tsi_frame_protector; struct tsi_zero_copy_grpc_protector; @@ -38,6 +36,4 @@ grpc_endpoint* grpc_secure_endpoint_create( grpc_endpoint* to_wrap, grpc_slice* leftover_slices, size_t leftover_nslices); - - #endif /* GRPC_CORE_LIB_SECURITY_TRANSPORT_SECURE_ENDPOINT_H */ diff --git a/src/core/lib/security/transport/security_connector.h b/src/core/lib/security/transport/security_connector.h index d680db6c8ee..15c04300100 100644 --- a/src/core/lib/security/transport/security_connector.h +++ b/src/core/lib/security/transport/security_connector.h @@ -29,8 +29,6 @@ #include "src/core/tsi/ssl_transport_security.h" #include "src/core/tsi/transport_security_interface.h" - - #ifndef NDEBUG extern grpc_tracer_flag grpc_trace_security_connector_refcount; #endif @@ -259,6 +257,4 @@ tsi_peer tsi_shallow_peer_from_ssl_auth_context( const grpc_auth_context* auth_context); void tsi_shallow_peer_destruct(tsi_peer* peer); - - #endif /* GRPC_CORE_LIB_SECURITY_TRANSPORT_SECURITY_CONNECTOR_H */ diff --git a/src/core/lib/security/transport/security_handshaker.h b/src/core/lib/security/transport/security_handshaker.h index fd23a784a47..6c3a0510cee 100644 --- a/src/core/lib/security/transport/security_handshaker.h +++ b/src/core/lib/security/transport/security_handshaker.h @@ -23,8 +23,6 @@ #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/security/transport/security_connector.h" - - /// Creates a security handshaker using \a handshaker. grpc_handshaker* grpc_security_handshaker_create( grpc_exec_ctx* exec_ctx, tsi_handshaker* handshaker, @@ -33,6 +31,4 @@ grpc_handshaker* grpc_security_handshaker_create( /// Registers security handshaker factories. void grpc_security_register_handshaker_factories(); - - #endif /* GRPC_CORE_LIB_SECURITY_TRANSPORT_SECURITY_HANDSHAKER_H */ diff --git a/src/core/lib/security/transport/tsi_error.h b/src/core/lib/security/transport/tsi_error.h index 9dd7ab4a4ed..8fa6c480acd 100644 --- a/src/core/lib/security/transport/tsi_error.h +++ b/src/core/lib/security/transport/tsi_error.h @@ -22,10 +22,6 @@ #include "src/core/lib/iomgr/error.h" #include "src/core/tsi/transport_security_interface.h" - - grpc_error* grpc_set_tsi_error_result(grpc_error* error, tsi_result result); - - #endif /* GRPC_CORE_LIB_SECURITY_TRANSPORT_TSI_ERROR_H */ diff --git a/src/core/lib/security/util/json_util.h b/src/core/lib/security/util/json_util.h index f99edcd153d..b7e46d40627 100644 --- a/src/core/lib/security/util/json_util.h +++ b/src/core/lib/security/util/json_util.h @@ -28,8 +28,6 @@ #define GRPC_AUTH_JSON_TYPE_SERVICE_ACCOUNT "service_account" #define GRPC_AUTH_JSON_TYPE_AUTHORIZED_USER "authorized_user" - - // Gets a child property from a json node. const char* grpc_json_get_string_property(const grpc_json* json, const char* prop_name); @@ -39,6 +37,4 @@ const char* grpc_json_get_string_property(const grpc_json* json, bool grpc_copy_json_string_property(const grpc_json* json, const char* prop_name, char** copied_value); - - #endif /* GRPC_CORE_LIB_SECURITY_UTIL_JSON_UTIL_H */ diff --git a/src/core/lib/slice/b64.h b/src/core/lib/slice/b64.h index 09a8418fd5b..f86c1d99010 100644 --- a/src/core/lib/slice/b64.h +++ b/src/core/lib/slice/b64.h @@ -21,8 +21,6 @@ #include - - /* Encodes data using base64. It is the caller's responsability to free the returned char * using gpr_free. Returns NULL on NULL input. TODO(makdharma) : change the flags to bool from int */ @@ -49,6 +47,4 @@ grpc_slice grpc_base64_decode(grpc_exec_ctx* exec_ctx, const char* b64, grpc_slice grpc_base64_decode_with_len(grpc_exec_ctx* exec_ctx, const char* b64, size_t b64_len, int url_safe); - - #endif /* GRPC_CORE_LIB_SLICE_B64_H */ diff --git a/src/core/lib/slice/percent_encoding.h b/src/core/lib/slice/percent_encoding.h index e7cd0cd2c91..a1009ff01f3 100644 --- a/src/core/lib/slice/percent_encoding.h +++ b/src/core/lib/slice/percent_encoding.h @@ -30,8 +30,6 @@ #include - - /* URL percent encoding spec bitfield (usabel as 'unreserved_bytes' in grpc_percent_encode_slice, grpc_strict_percent_decode_slice). Flags [A-Za-z0-9-_.~] as unreserved bytes for the percent encoding routines @@ -62,6 +60,4 @@ bool grpc_strict_percent_decode_slice(grpc_slice slice_in, This cannot fail. */ grpc_slice grpc_permissive_percent_decode_slice(grpc_slice slice_in); - - #endif /* GRPC_CORE_LIB_SLICE_PERCENT_ENCODING_H */ diff --git a/src/core/lib/slice/slice_hash_table.h b/src/core/lib/slice/slice_hash_table.h index 99a3928eeb6..85102bd67d7 100644 --- a/src/core/lib/slice/slice_hash_table.h +++ b/src/core/lib/slice/slice_hash_table.h @@ -19,8 +19,6 @@ #include "src/core/lib/transport/metadata.h" - - /** Hash table implementation. * * This implementation uses open addressing @@ -69,6 +67,4 @@ void* grpc_slice_hash_table_get(const grpc_slice_hash_table* table, int grpc_slice_hash_table_cmp(const grpc_slice_hash_table* a, const grpc_slice_hash_table* b); - - #endif /* GRPC_CORE_LIB_SLICE_SLICE_HASH_TABLE_H */ diff --git a/src/core/lib/slice/slice_internal.h b/src/core/lib/slice/slice_internal.h index 01c0dee87f8..556e6b84b2c 100644 --- a/src/core/lib/slice/slice_internal.h +++ b/src/core/lib/slice/slice_internal.h @@ -24,8 +24,6 @@ #include "src/core/lib/iomgr/exec_ctx.h" - - grpc_slice grpc_slice_ref_internal(grpc_slice slice); void grpc_slice_unref_internal(grpc_exec_ctx* exec_ctx, grpc_slice slice); void grpc_slice_buffer_reset_and_unref_internal(grpc_exec_ctx* exec_ctx, @@ -48,6 +46,4 @@ grpc_slice grpc_slice_maybe_static_intern(grpc_slice slice, uint32_t grpc_static_slice_hash(grpc_slice s); int grpc_static_slice_eq(grpc_slice a, grpc_slice b); - - #endif /* GRPC_CORE_LIB_SLICE_SLICE_INTERNAL_H */ diff --git a/src/core/lib/slice/slice_string_helpers.h b/src/core/lib/slice/slice_string_helpers.h index afbd90331e1..7f51b11b9cf 100644 --- a/src/core/lib/slice/slice_string_helpers.h +++ b/src/core/lib/slice/slice_string_helpers.h @@ -28,8 +28,6 @@ #include "src/core/lib/support/string.h" - - /* Calls gpr_dump on a slice. */ char* grpc_dump_slice(grpc_slice slice, uint32_t flags); @@ -39,6 +37,4 @@ void grpc_slice_split(grpc_slice str, const char* sep, grpc_slice_buffer* dst); bool grpc_parse_slice_to_uint32(grpc_slice str, uint32_t* result); - - #endif /* GRPC_CORE_LIB_SLICE_SLICE_STRING_HELPERS_H */ diff --git a/src/core/lib/slice/slice_traits.h b/src/core/lib/slice/slice_traits.h index 6e314a363bd..4b898bdcd46 100644 --- a/src/core/lib/slice/slice_traits.h +++ b/src/core/lib/slice/slice_traits.h @@ -22,12 +22,8 @@ #include #include - - bool grpc_slice_is_legal_header(grpc_slice s); bool grpc_slice_is_legal_nonbin_header(grpc_slice s); bool grpc_slice_is_bin_suffixed(grpc_slice s); - - #endif /* GRPC_CORE_LIB_SLICE_SLICE_TRAITS_H */ diff --git a/src/core/lib/support/arena.h b/src/core/lib/support/arena.h index 9984c53feab..cfe973a0368 100644 --- a/src/core/lib/support/arena.h +++ b/src/core/lib/support/arena.h @@ -27,8 +27,6 @@ #include - - typedef struct gpr_arena gpr_arena; // Create an arena, with \a initial_size bytes in the first allocated buffer @@ -38,6 +36,4 @@ void* gpr_arena_alloc(gpr_arena* arena, size_t size); // Destroy an arena, returning the total number of bytes allocated size_t gpr_arena_destroy(gpr_arena* arena); - - #endif /* GRPC_CORE_LIB_SUPPORT_ARENA_H */ diff --git a/src/core/lib/support/env.h b/src/core/lib/support/env.h index fe51b708351..2452fd330d9 100644 --- a/src/core/lib/support/env.h +++ b/src/core/lib/support/env.h @@ -21,8 +21,6 @@ #include - - /* Env utility functions */ /* Gets the environment variable value with the specified name. @@ -40,6 +38,4 @@ void gpr_setenv(const char* name, const char* value); level of logging. So DO NOT USE THIS. */ const char* gpr_getenv_silent(const char* name, char** dst); - - #endif /* GRPC_CORE_LIB_SUPPORT_ENV_H */ diff --git a/src/core/lib/support/log_android.cc b/src/core/lib/support/log_android.cc index 648a016b50b..0d3ac0fe522 100644 --- a/src/core/lib/support/log_android.cc +++ b/src/core/lib/support/log_android.cc @@ -40,7 +40,7 @@ static android_LogPriority severity_to_log_priority(gpr_log_severity severity) { } void gpr_log(const char* file, int line, gpr_log_severity severity, - const char* format, ...) { + const char* format, ...) { char* message = NULL; va_list args; va_start(args, format); diff --git a/src/core/lib/support/mpscq.h b/src/core/lib/support/mpscq.h index 743a62b325b..648ead1f5b5 100644 --- a/src/core/lib/support/mpscq.h +++ b/src/core/lib/support/mpscq.h @@ -24,8 +24,6 @@ #include #include - - // Multiple-producer single-consumer lock free queue, based upon the // implementation from Dmitry Vyukov here: // http://www.1024cores.net/home/lock-free-algorithms/queues/intrusive-mpsc-node-based-queue @@ -83,5 +81,4 @@ gpr_mpscq_node* gpr_locked_mpscq_try_pop(gpr_locked_mpscq* q); // calling this function gpr_mpscq_node* gpr_locked_mpscq_pop(gpr_locked_mpscq* q); - #endif /* GRPC_CORE_LIB_SUPPORT_MPSCQ_H */ diff --git a/src/core/lib/support/murmur_hash.h b/src/core/lib/support/murmur_hash.h index c28e58af27b..422770f1035 100644 --- a/src/core/lib/support/murmur_hash.h +++ b/src/core/lib/support/murmur_hash.h @@ -23,11 +23,7 @@ #include - - /* compute the hash of key (length len) */ uint32_t gpr_murmur_hash3(const void* key, size_t len, uint32_t seed); - - #endif /* GRPC_CORE_LIB_SUPPORT_MURMUR_HASH_H */ diff --git a/src/core/lib/support/stack_lockfree.h b/src/core/lib/support/stack_lockfree.h index ebefc7560ce..75baf4fa5d9 100644 --- a/src/core/lib/support/stack_lockfree.h +++ b/src/core/lib/support/stack_lockfree.h @@ -21,8 +21,6 @@ #include - - typedef struct gpr_stack_lockfree gpr_stack_lockfree; /* This stack must specify the maximum number of entries to track. @@ -37,6 +35,4 @@ int gpr_stack_lockfree_push(gpr_stack_lockfree*, int entry); /* Returns -1 on empty or the actual entry number */ int gpr_stack_lockfree_pop(gpr_stack_lockfree* stack); - - #endif /* GRPC_CORE_LIB_SUPPORT_STACK_LOCKFREE_H */ diff --git a/src/core/lib/support/string.h b/src/core/lib/support/string.h index 8f95f899ce7..dd37f0b0e19 100644 --- a/src/core/lib/support/string.h +++ b/src/core/lib/support/string.h @@ -24,8 +24,6 @@ #include - - /* String utility functions */ /* Flags for gpr_dump function. */ @@ -108,5 +106,4 @@ void* gpr_memrchr(const void* s, int c, size_t n); /** Return true if lower(s) equals "true", "yes" or "1", otherwise false. */ bool gpr_is_true(const char* s); - #endif /* GRPC_CORE_LIB_SUPPORT_STRING_H */ diff --git a/src/core/lib/support/string_windows.h b/src/core/lib/support/string_windows.h index 18932e20a7c..7c7f31e7aaf 100644 --- a/src/core/lib/support/string_windows.h +++ b/src/core/lib/support/string_windows.h @@ -21,8 +21,6 @@ #include - - #ifdef GPR_WINDOWS /* These allocate new strings using gpr_malloc to convert from and to utf-8. */ @@ -31,6 +29,4 @@ LPSTR gpr_tchar_to_char(LPCTSTR input); #endif /* GPR_WINDOWS */ - - #endif /* GRPC_CORE_LIB_SUPPORT_STRING_WINDOWS_H */ diff --git a/src/core/lib/support/time_precise.h b/src/core/lib/support/time_precise.h index 650df6ce67b..35cd154dbdf 100644 --- a/src/core/lib/support/time_precise.h +++ b/src/core/lib/support/time_precise.h @@ -21,11 +21,7 @@ #include - - void gpr_precise_clock_init(void); void gpr_precise_clock_now(gpr_timespec* clk); - - #endif /* GRPC_CORE_LIB_SUPPORT_TIME_PRECISE_H */ diff --git a/src/core/lib/support/tmpfile.h b/src/core/lib/support/tmpfile.h index e28f4cb11f3..c5ceda86751 100644 --- a/src/core/lib/support/tmpfile.h +++ b/src/core/lib/support/tmpfile.h @@ -21,14 +21,10 @@ #include - - /* Creates a temporary file from a prefix. If tmp_filename is not NULL, *tmp_filename is assigned the name of the created file and it is the responsibility of the caller to gpr_free it unless an error occurs in which case it will be set to NULL. */ FILE* gpr_tmpfile(const char* prefix, char** tmp_filename); - - #endif /* GRPC_CORE_LIB_SUPPORT_TMPFILE_H */ diff --git a/src/core/lib/surface/alarm_internal.h b/src/core/lib/surface/alarm_internal.h index e4b9f34408f..7f2126c5c91 100644 --- a/src/core/lib/surface/alarm_internal.h +++ b/src/core/lib/surface/alarm_internal.h @@ -22,8 +22,6 @@ #include #include "src/core/lib/debug/trace.h" - - #ifndef NDEBUG extern grpc_tracer_flag grpc_trace_alarm_refcount; @@ -39,6 +37,4 @@ extern grpc_tracer_flag grpc_trace_alarm_refcount; #endif /* defined(NDEBUG) */ - - #endif /* GRPC_CORE_LIB_SURFACE_ALARM_INTERNAL_H */ diff --git a/src/core/lib/surface/api_trace.h b/src/core/lib/surface/api_trace.h index a72d80eaaee..849cbaaef6e 100644 --- a/src/core/lib/surface/api_trace.h +++ b/src/core/lib/surface/api_trace.h @@ -22,8 +22,6 @@ #include #include "src/core/lib/debug/trace.h" - - extern grpc_tracer_flag grpc_api_trace; /* Provide unwrapping macros because we're in C89 and variadic macros weren't @@ -49,6 +47,4 @@ extern grpc_tracer_flag grpc_api_trace; gpr_log(GPR_INFO, fmt GRPC_API_TRACE_UNWRAP##nargs args); \ } - - #endif /* GRPC_CORE_LIB_SURFACE_API_TRACE_H */ diff --git a/src/core/lib/surface/call.h b/src/core/lib/surface/call.h index b30650781c5..4408f90e7f8 100644 --- a/src/core/lib/surface/call.h +++ b/src/core/lib/surface/call.h @@ -19,8 +19,6 @@ #ifndef GRPC_CORE_LIB_SURFACE_CALL_H #define GRPC_CORE_LIB_SURFACE_CALL_H - - #include "src/core/lib/channel/channel_stack.h" #include "src/core/lib/channel/context.h" #include "src/core/lib/surface/api_trace.h" @@ -113,6 +111,4 @@ grpc_compression_algorithm grpc_call_compression_for_level( extern grpc_tracer_flag grpc_call_error_trace; extern grpc_tracer_flag grpc_compression_trace; - - #endif /* GRPC_CORE_LIB_SURFACE_CALL_H */ diff --git a/src/core/lib/surface/call_test_only.h b/src/core/lib/surface/call_test_only.h index c0815dc0f19..90444f85b6c 100644 --- a/src/core/lib/surface/call_test_only.h +++ b/src/core/lib/surface/call_test_only.h @@ -21,8 +21,6 @@ #include - - /** Return the compression algorithm from \a call. * * \warning This function should \b only be used in test code. */ @@ -52,6 +50,4 @@ uint32_t grpc_call_test_only_get_stream_encodings_accepted_by_peer( grpc_stream_compression_algorithm grpc_call_test_only_get_incoming_stream_encodings(grpc_call* call); - - #endif /* GRPC_CORE_LIB_SURFACE_CALL_TEST_ONLY_H */ diff --git a/src/core/lib/surface/channel.h b/src/core/lib/surface/channel.h index c2786b50a2b..a2e53c777d6 100644 --- a/src/core/lib/surface/channel.h +++ b/src/core/lib/surface/channel.h @@ -23,8 +23,6 @@ #include "src/core/lib/channel/channel_stack_builder.h" #include "src/core/lib/surface/channel_stack_type.h" - - grpc_channel* grpc_channel_create(grpc_exec_ctx* exec_ctx, const char* target, const grpc_channel_args* args, grpc_channel_stack_type channel_stack_type, @@ -83,6 +81,4 @@ void grpc_channel_internal_unref(grpc_exec_ctx* exec_ctx, grpc_compression_options grpc_channel_compression_options( const grpc_channel* channel); - - #endif /* GRPC_CORE_LIB_SURFACE_CHANNEL_H */ diff --git a/src/core/lib/surface/channel_init.h b/src/core/lib/surface/channel_init.h index e09fe1fdb82..556ecc4147e 100644 --- a/src/core/lib/surface/channel_init.h +++ b/src/core/lib/surface/channel_init.h @@ -25,8 +25,6 @@ #define GRPC_CHANNEL_INIT_BUILTIN_PRIORITY 10000 - - /// This module provides a way for plugins (and the grpc core library itself) /// to register mutators for channel stacks. /// It also provides a universal entry path to run those mutators to build @@ -72,6 +70,4 @@ bool grpc_channel_init_create_stack(grpc_exec_ctx* exec_ctx, grpc_channel_stack_builder* builder, grpc_channel_stack_type type); - - #endif /* GRPC_CORE_LIB_SURFACE_CHANNEL_INIT_H */ diff --git a/src/core/lib/surface/channel_stack_type.h b/src/core/lib/surface/channel_stack_type.h index 5a26248dfeb..52f85a64069 100644 --- a/src/core/lib/surface/channel_stack_type.h +++ b/src/core/lib/surface/channel_stack_type.h @@ -21,8 +21,6 @@ #include - - typedef enum { // normal top-half client channel with load-balancing, connection management GRPC_CLIENT_CHANNEL, @@ -44,6 +42,4 @@ bool grpc_channel_stack_type_is_client(grpc_channel_stack_type type); const char* grpc_channel_stack_type_string(grpc_channel_stack_type type); - - #endif /* GRPC_CORE_LIB_SURFACE_CHANNEL_STACK_TYPE_H */ diff --git a/src/core/lib/surface/completion_queue.h b/src/core/lib/surface/completion_queue.h index f4fa9a17f45..ca9c0c8c3c1 100644 --- a/src/core/lib/surface/completion_queue.h +++ b/src/core/lib/surface/completion_queue.h @@ -36,8 +36,6 @@ extern grpc_tracer_flag grpc_trace_pending_tags; extern grpc_tracer_flag grpc_trace_cq_refcount; #endif - - typedef struct grpc_cq_completion { gpr_mpscq_node node; @@ -96,6 +94,4 @@ int grpc_get_cq_poll_num(grpc_completion_queue* cc); grpc_completion_queue* grpc_completion_queue_create_internal( grpc_cq_completion_type completion_type, grpc_cq_polling_type polling_type); - - #endif /* GRPC_CORE_LIB_SURFACE_COMPLETION_QUEUE_H */ diff --git a/src/core/lib/surface/completion_queue_factory.h b/src/core/lib/surface/completion_queue_factory.h index 74c1c18b24d..89be8f8216a 100644 --- a/src/core/lib/surface/completion_queue_factory.h +++ b/src/core/lib/surface/completion_queue_factory.h @@ -22,8 +22,6 @@ #include #include "src/core/lib/surface/completion_queue.h" - - typedef struct grpc_completion_queue_factory_vtable { grpc_completion_queue* (*create)(const grpc_completion_queue_factory*, const grpc_completion_queue_attributes*); @@ -35,6 +33,4 @@ struct grpc_completion_queue_factory { grpc_completion_queue_factory_vtable* vtable; }; - - #endif /* GRPC_CORE_LIB_SURFACE_COMPLETION_QUEUE_FACTORY_H */ diff --git a/src/core/lib/surface/event_string.h b/src/core/lib/surface/event_string.h index a7633278629..cbf96da6c5d 100644 --- a/src/core/lib/surface/event_string.h +++ b/src/core/lib/surface/event_string.h @@ -21,11 +21,7 @@ #include - - /* Returns a string describing an event. Must be later freed with gpr_free() */ char* grpc_event_string(grpc_event* ev); - - #endif /* GRPC_CORE_LIB_SURFACE_EVENT_STRING_H */ diff --git a/src/core/lib/surface/init.h b/src/core/lib/surface/init.h index c2969f972d1..9353208332f 100644 --- a/src/core/lib/surface/init.h +++ b/src/core/lib/surface/init.h @@ -19,13 +19,9 @@ #ifndef GRPC_CORE_LIB_SURFACE_INIT_H #define GRPC_CORE_LIB_SURFACE_INIT_H - - void grpc_register_security_filters(void); void grpc_security_pre_init(void); void grpc_security_init(void); int grpc_is_initialized(void); - - #endif /* GRPC_CORE_LIB_SURFACE_INIT_H */ diff --git a/src/core/lib/surface/lame_client.h b/src/core/lib/surface/lame_client.h index 964e625f288..3ce353f101f 100644 --- a/src/core/lib/surface/lame_client.h +++ b/src/core/lib/surface/lame_client.h @@ -21,10 +21,6 @@ #include "src/core/lib/channel/channel_stack.h" - - extern const grpc_channel_filter grpc_lame_filter; - - #endif /* GRPC_CORE_LIB_SURFACE_LAME_CLIENT_H */ diff --git a/src/core/lib/surface/server.h b/src/core/lib/surface/server.h index e515e3099de..35c32ee82bf 100644 --- a/src/core/lib/surface/server.h +++ b/src/core/lib/surface/server.h @@ -24,8 +24,6 @@ #include "src/core/lib/debug/trace.h" #include "src/core/lib/transport/transport.h" - - extern const grpc_channel_filter grpc_server_top_filter; /** Lightweight tracing of server channel state */ @@ -56,6 +54,4 @@ int grpc_server_has_open_connections(grpc_server* server); void grpc_server_get_pollsets(grpc_server* server, grpc_pollset*** pollsets, size_t* pollset_count); - - #endif /* GRPC_CORE_LIB_SURFACE_SERVER_H */ diff --git a/src/core/lib/surface/validate_metadata.h b/src/core/lib/surface/validate_metadata.h index 30941b5f831..ff074b00b2c 100644 --- a/src/core/lib/surface/validate_metadata.h +++ b/src/core/lib/surface/validate_metadata.h @@ -22,11 +22,7 @@ #include #include "src/core/lib/iomgr/error.h" - - grpc_error* grpc_validate_header_key_is_legal(grpc_slice slice); grpc_error* grpc_validate_header_nonbin_value_is_legal(grpc_slice slice); - - #endif /* GRPC_CORE_LIB_SURFACE_VALIDATE_METADATA_H */ diff --git a/src/core/lib/transport/byte_stream.h b/src/core/lib/transport/byte_stream.h index 8b660b3287b..6bca154cb57 100644 --- a/src/core/lib/transport/byte_stream.h +++ b/src/core/lib/transport/byte_stream.h @@ -28,8 +28,6 @@ /** Mask of all valid internal flags. */ #define GRPC_WRITE_INTERNAL_USED_MASK (GRPC_WRITE_INTERNAL_COMPRESS) - - typedef struct grpc_byte_stream grpc_byte_stream; typedef struct { @@ -137,6 +135,4 @@ void grpc_caching_byte_stream_init(grpc_caching_byte_stream* stream, // Resets the byte stream to the start of the underlying stream. void grpc_caching_byte_stream_reset(grpc_caching_byte_stream* stream); - - #endif /* GRPC_CORE_LIB_TRANSPORT_BYTE_STREAM_H */ diff --git a/src/core/lib/transport/connectivity_state.h b/src/core/lib/transport/connectivity_state.h index 2d8dd148810..79053366e46 100644 --- a/src/core/lib/transport/connectivity_state.h +++ b/src/core/lib/transport/connectivity_state.h @@ -23,8 +23,6 @@ #include "src/core/lib/debug/trace.h" #include "src/core/lib/iomgr/exec_ctx.h" - - typedef struct grpc_connectivity_state_watcher { /** we keep watchers in a linked list */ struct grpc_connectivity_state_watcher* next; @@ -86,6 +84,4 @@ bool grpc_connectivity_state_notify_on_state_change( grpc_exec_ctx* exec_ctx, grpc_connectivity_state_tracker* tracker, grpc_connectivity_state* current, grpc_closure* notify); - - #endif /* GRPC_CORE_LIB_TRANSPORT_CONNECTIVITY_STATE_H */ diff --git a/src/core/lib/transport/error_utils.h b/src/core/lib/transport/error_utils.h index 9cd1bc57d25..1c91976ba5d 100644 --- a/src/core/lib/transport/error_utils.h +++ b/src/core/lib/transport/error_utils.h @@ -23,8 +23,6 @@ #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/transport/http2_errors.h" - - /// A utility function to get the status code and message to be returned /// to the application. If not set in the top-level message, looks /// through child errors until it finds the first one with these attributes. @@ -42,6 +40,4 @@ void grpc_error_get_status(grpc_exec_ctx* exec_ctx, grpc_error* error, /// GRPC_ERROR_CANCELLED bool grpc_error_has_clear_grpc_status(grpc_error* error); - - #endif /* GRPC_CORE_LIB_TRANSPORT_ERROR_UTILS_H */ diff --git a/src/core/lib/transport/metadata.h b/src/core/lib/transport/metadata.h index 077b4ce0c51..4cf5752df8e 100644 --- a/src/core/lib/transport/metadata.h +++ b/src/core/lib/transport/metadata.h @@ -29,8 +29,6 @@ extern grpc_tracer_flag grpc_trace_metadata; #endif - - /* This file provides a mechanism for tracking metadata through the grpc stack. It's not intended for consumption outside of the library. @@ -168,6 +166,4 @@ void grpc_mdelem_unref(grpc_exec_ctx* exec_ctx, grpc_mdelem md); void grpc_mdctx_global_init(void); void grpc_mdctx_global_shutdown(grpc_exec_ctx* exec_ctx); - - #endif /* GRPC_CORE_LIB_TRANSPORT_METADATA_H */ diff --git a/src/core/lib/transport/metadata_batch.h b/src/core/lib/transport/metadata_batch.h index cae79bf6944..adfb2d80694 100644 --- a/src/core/lib/transport/metadata_batch.h +++ b/src/core/lib/transport/metadata_batch.h @@ -28,8 +28,6 @@ #include "src/core/lib/transport/metadata.h" #include "src/core/lib/transport/static_metadata.h" - - typedef struct grpc_linked_mdelem { grpc_mdelem md; struct grpc_linked_mdelem* next; @@ -144,6 +142,4 @@ void grpc_metadata_batch_assert_ok(grpc_metadata_batch* comd); } while (0) #endif - - #endif /* GRPC_CORE_LIB_TRANSPORT_METADATA_BATCH_H */ diff --git a/src/core/lib/transport/service_config.h b/src/core/lib/transport/service_config.h index 7abd278c192..75a290bfd80 100644 --- a/src/core/lib/transport/service_config.h +++ b/src/core/lib/transport/service_config.h @@ -22,8 +22,6 @@ #include "src/core/lib/json/json.h" #include "src/core/lib/slice/slice_hash_table.h" - - typedef struct grpc_service_config grpc_service_config; grpc_service_config* grpc_service_config_create(const char* json_string); @@ -62,6 +60,4 @@ void* grpc_method_config_table_get(grpc_exec_ctx* exec_ctx, const grpc_slice_hash_table* table, grpc_slice path); - - #endif /* GRPC_CORE_LIB_TRANSPORT_SERVICE_CONFIG_H */ diff --git a/src/core/lib/transport/static_metadata.h b/src/core/lib/transport/static_metadata.h index d1a962461f4..ce3a11b0095 100644 --- a/src/core/lib/transport/static_metadata.h +++ b/src/core/lib/transport/static_metadata.h @@ -27,8 +27,6 @@ #ifndef GRPC_CORE_LIB_TRANSPORT_STATIC_METADATA_H #define GRPC_CORE_LIB_TRANSPORT_STATIC_METADATA_H - - #include "src/core/lib/transport/metadata.h" #define GRPC_STATIC_MDSTR_COUNT 100 diff --git a/src/core/lib/transport/status_conversion.h b/src/core/lib/transport/status_conversion.h index 70387539c55..3637b828019 100644 --- a/src/core/lib/transport/status_conversion.h +++ b/src/core/lib/transport/status_conversion.h @@ -23,8 +23,6 @@ #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/transport/http2_errors.h" - - /* Conversion of grpc status codes to http2 error codes (for RST_STREAM) */ grpc_http2_error_code grpc_status_to_http2_error(grpc_status_code status); grpc_status_code grpc_http2_error_to_grpc_status(grpc_exec_ctx* exec_ctx, @@ -35,6 +33,4 @@ grpc_status_code grpc_http2_error_to_grpc_status(grpc_exec_ctx* exec_ctx, grpc_status_code grpc_http2_status_to_grpc_status(int status); int grpc_status_to_http2_status(grpc_status_code status); - - #endif /* GRPC_CORE_LIB_TRANSPORT_STATUS_CONVERSION_H */ diff --git a/src/core/lib/transport/timeout_encoding.h b/src/core/lib/transport/timeout_encoding.h index 4e5034ff15b..8611f49b009 100644 --- a/src/core/lib/transport/timeout_encoding.h +++ b/src/core/lib/transport/timeout_encoding.h @@ -27,13 +27,9 @@ #define GRPC_HTTP2_TIMEOUT_ENCODE_MIN_BUFSIZE (GPR_LTOA_MIN_BUFSIZE + 1) - - /* Encode/decode timeouts to the GRPC over HTTP/2 format; encoding may round up arbitrarily */ void grpc_http2_encode_timeout(grpc_millis timeout, char* buffer); int grpc_http2_decode_timeout(grpc_slice text, grpc_millis* timeout); - - #endif /* GRPC_CORE_LIB_TRANSPORT_TIMEOUT_ENCODING_H */ diff --git a/src/core/lib/transport/transport.h b/src/core/lib/transport/transport.h index 01f03121b6c..5ab085f088c 100644 --- a/src/core/lib/transport/transport.h +++ b/src/core/lib/transport/transport.h @@ -31,8 +31,6 @@ #include "src/core/lib/transport/byte_stream.h" #include "src/core/lib/transport/metadata_batch.h" - - /* forward declarations */ typedef struct grpc_transport grpc_transport; @@ -350,6 +348,4 @@ grpc_transport_op* grpc_make_transport_op(grpc_closure* on_consumed); grpc_transport_stream_op_batch* grpc_make_transport_stream_op( grpc_closure* on_consumed); - - #endif /* GRPC_CORE_LIB_TRANSPORT_TRANSPORT_H */ diff --git a/src/core/lib/transport/transport_impl.h b/src/core/lib/transport/transport_impl.h index 5dedc257073..46be61427e5 100644 --- a/src/core/lib/transport/transport_impl.h +++ b/src/core/lib/transport/transport_impl.h @@ -21,8 +21,6 @@ #include "src/core/lib/transport/transport.h" - - typedef struct grpc_transport_vtable { /* Memory required for a single stream element - this is allocated by upper layers and initialized by the transport */ @@ -71,6 +69,4 @@ struct grpc_transport { const grpc_transport_vtable* vtable; }; - - #endif /* GRPC_CORE_LIB_TRANSPORT_TRANSPORT_IMPL_H */ diff --git a/src/core/tsi/fake_transport_security.h b/src/core/tsi/fake_transport_security.h index 2a6edba0037..3848e7c6bf7 100644 --- a/src/core/tsi/fake_transport_security.h +++ b/src/core/tsi/fake_transport_security.h @@ -21,8 +21,6 @@ #include "src/core/tsi/transport_security_interface.h" - - /* Value for the TSI_CERTIFICATE_TYPE_PEER_PROPERTY property for FAKE certs. */ #define TSI_FAKE_CERTIFICATE_TYPE "FAKE" @@ -42,6 +40,4 @@ tsi_frame_protector* tsi_create_fake_frame_protector( tsi_zero_copy_grpc_protector* tsi_create_fake_zero_copy_grpc_protector( size_t* max_protected_frame_size); - - #endif /* GRPC_CORE_TSI_FAKE_TRANSPORT_SECURITY_H */ diff --git a/src/core/tsi/gts_transport_security.h b/src/core/tsi/gts_transport_security.h index aca03b0d27c..23b2b66fb3c 100644 --- a/src/core/tsi/gts_transport_security.h +++ b/src/core/tsi/gts_transport_security.h @@ -23,8 +23,6 @@ #include #include - - typedef struct gts_shared_resource { gpr_thd_id thread_id; grpc_channel* channel; @@ -36,6 +34,4 @@ typedef struct gts_shared_resource { * TSI handshakes. */ gts_shared_resource* gts_get_shared_resource(void); - - #endif /* GRPC_CORE_TSI_GTS_TRANSPORT_SECURITY_H */ diff --git a/src/core/tsi/ssl_transport_security.h b/src/core/tsi/ssl_transport_security.h index e6011f71a47..bf211e110a2 100644 --- a/src/core/tsi/ssl_transport_security.h +++ b/src/core/tsi/ssl_transport_security.h @@ -21,8 +21,6 @@ #include "src/core/tsi/transport_security_interface.h" - - /* Value for the TSI_CERTIFICATE_TYPE_PEER_PROPERTY property for X509 certs. */ #define TSI_X509_CERTIFICATE_TYPE "X509" @@ -191,6 +189,4 @@ const tsi_ssl_handshaker_factory_vtable* tsi_ssl_handshaker_factory_swap_vtable( tsi_ssl_handshaker_factory* factory, tsi_ssl_handshaker_factory_vtable* new_vtable); - - #endif /* GRPC_CORE_TSI_SSL_TRANSPORT_SECURITY_H */ diff --git a/src/core/tsi/ssl_types.h b/src/core/tsi/ssl_types.h index 06e6b44da94..3788643355c 100644 --- a/src/core/tsi/ssl_types.h +++ b/src/core/tsi/ssl_types.h @@ -19,8 +19,6 @@ #ifndef GRPC_CORE_TSI_SSL_TYPES_H #define GRPC_CORE_TSI_SSL_TYPES_H - - /* A collection of macros to cast between various integer types that are * used differently between BoringSSL and OpenSSL: * TSI_INT_AS_SIZE(x): convert 'int x' to a length parameter for an OpenSSL @@ -39,6 +37,4 @@ #define TSI_SIZE_AS_SIZE(x) ((int)(x)) #endif - - #endif /* GRPC_CORE_TSI_SSL_TYPES_H */ diff --git a/src/core/tsi/transport_security.h b/src/core/tsi/transport_security.h index 9292e038130..3adfb638b54 100644 --- a/src/core/tsi/transport_security.h +++ b/src/core/tsi/transport_security.h @@ -24,8 +24,6 @@ #include "src/core/lib/debug/trace.h" #include "src/core/tsi/transport_security_interface.h" - - extern grpc_tracer_flag tsi_tracing_enabled; /* Base for tsi_frame_protector implementations. @@ -124,6 +122,4 @@ tsi_result tsi_construct_string_peer_property_from_cstring( /* Utils. */ char* tsi_strdup(const char* src); /* Sadly, no strdup in C89. */ - - #endif /* GRPC_CORE_TSI_TRANSPORT_SECURITY_H */ diff --git a/src/core/tsi/transport_security_adapter.h b/src/core/tsi/transport_security_adapter.h index d999af28212..9818fceb865 100644 --- a/src/core/tsi/transport_security_adapter.h +++ b/src/core/tsi/transport_security_adapter.h @@ -21,8 +21,6 @@ #include "src/core/tsi/transport_security_interface.h" - - /* Create a tsi handshaker that takes an implementation of old interface and converts into an implementation of new interface. In the old interface, there are get_bytes_to_send_to_peer, process_bytes_from_peer, get_result, @@ -38,6 +36,4 @@ tsi_handshaker* tsi_create_adapter_handshaker(tsi_handshaker* wrapped); the caller. */ tsi_handshaker* tsi_adapter_handshaker_get_wrapped(tsi_handshaker* adapter); - - #endif /* GRPC_CORE_TSI_TRANSPORT_SECURITY_ADAPTER_H */ diff --git a/src/core/tsi/transport_security_grpc.h b/src/core/tsi/transport_security_grpc.h index 8ebee37b725..9fccfd79dd7 100644 --- a/src/core/tsi/transport_security_grpc.h +++ b/src/core/tsi/transport_security_grpc.h @@ -22,8 +22,6 @@ #include #include "src/core/tsi/transport_security.h" - - /* This method creates a tsi_zero_copy_grpc_protector object. It return TSI_OK assuming there is no fatal error. The caller is responsible for destroying the protector. */ @@ -75,6 +73,4 @@ struct tsi_zero_copy_grpc_protector { const tsi_zero_copy_grpc_protector_vtable* vtable; }; - - #endif /* GRPC_CORE_TSI_TRANSPORT_SECURITY_GRPC_H */ diff --git a/src/core/tsi/transport_security_interface.h b/src/core/tsi/transport_security_interface.h index fa1924bb625..92e2b1098e1 100644 --- a/src/core/tsi/transport_security_interface.h +++ b/src/core/tsi/transport_security_interface.h @@ -24,8 +24,6 @@ #include "src/core/lib/debug/trace.h" - - /* --- tsi result --- */ typedef enum { @@ -451,6 +449,4 @@ void tsi_init(); /* This method destroys the shared objects created by tsi_init. */ void tsi_destroy(); - - #endif /* GRPC_CORE_TSI_TRANSPORT_SECURITY_INTERFACE_H */ diff --git a/test/core/end2end/cq_verifier.h b/test/core/end2end/cq_verifier.h index 90c93f11f11..959f849cb11 100644 --- a/test/core/end2end/cq_verifier.h +++ b/test/core/end2end/cq_verifier.h @@ -24,8 +24,6 @@ #include #include "test/core/util/test_config.h" - - /* A cq_verifier can verify that expected events arrive in a timely fashion on a single completion queue */ @@ -61,6 +59,4 @@ int contains_metadata(grpc_metadata_array* array, const char* key, int contains_metadata_slices(grpc_metadata_array* array, grpc_slice key, grpc_slice value); - - #endif /* GRPC_TEST_CORE_END2END_CQ_VERIFIER_H */ diff --git a/test/core/end2end/data/ssl_test_data.h b/test/core/end2end/data/ssl_test_data.h index 558e6cfe976..303f3a6eda3 100644 --- a/test/core/end2end/data/ssl_test_data.h +++ b/test/core/end2end/data/ssl_test_data.h @@ -19,8 +19,6 @@ #ifndef GRPC_TEST_CORE_END2END_DATA_SSL_TEST_DATA_H #define GRPC_TEST_CORE_END2END_DATA_SSL_TEST_DATA_H - - extern const char test_root_cert[]; extern const char test_server1_cert[]; extern const char test_server1_key[]; @@ -29,6 +27,4 @@ extern const char test_self_signed_client_key[]; extern const char test_signed_client_cert[]; extern const char test_signed_client_key[]; - - #endif /* GRPC_TEST_CORE_END2END_DATA_SSL_TEST_DATA_H */ diff --git a/test/core/end2end/end2end_tests.h b/test/core/end2end/end2end_tests.h index a56c955d1b9..b42d90b55cf 100644 --- a/test/core/end2end/end2end_tests.h +++ b/test/core/end2end/end2end_tests.h @@ -21,8 +21,6 @@ #include - - typedef struct grpc_end2end_test_fixture grpc_end2end_test_fixture; typedef struct grpc_end2end_test_config grpc_end2end_test_config; @@ -76,6 +74,4 @@ const grpc_slice* get_host_override_slice(const char* str, void validate_host_override_string(const char* pattern, grpc_slice str, grpc_end2end_test_config config); - - #endif /* GRPC_TEST_CORE_END2END_END2END_TESTS_H */ diff --git a/test/core/util/port.h b/test/core/util/port.h index bb4fd91fee6..3a4cf4467a3 100644 --- a/test/core/util/port.h +++ b/test/core/util/port.h @@ -19,8 +19,6 @@ #ifndef GRPC_TEST_CORE_UTIL_PORT_H #define GRPC_TEST_CORE_UTIL_PORT_H - - typedef struct grpc_pick_port_functions { int (*pick_unused_port_fn)(void); int (*pick_unused_port_or_die_fn)(void); @@ -43,6 +41,4 @@ void grpc_recycle_unused_port(int port); /** Request the family of pick_port functions in \a functions be used. */ void grpc_set_pick_port_functions(grpc_pick_port_functions functions); - - #endif /* GRPC_TEST_CORE_UTIL_PORT_H */ diff --git a/test/core/util/test_config.h b/test/core/util/test_config.h index adfec486627..775ffac9497 100644 --- a/test/core/util/test_config.h +++ b/test/core/util/test_config.h @@ -21,8 +21,6 @@ #include - - extern int64_t g_fixture_slowdown_factor; extern int64_t g_poller_slowdown_factor; @@ -41,6 +39,4 @@ gpr_timespec grpc_timeout_milliseconds_to_deadline(int64_t time_ms); void grpc_test_init(int argc, char** argv); - - #endif /* GRPC_TEST_CORE_UTIL_TEST_CONFIG_H */ From 509aba4f60f790b470bbd44ec5830ea5404ce0df Mon Sep 17 00:00:00 2001 From: ncteisen Date: Fri, 17 Nov 2017 13:31:56 -0800 Subject: [PATCH 36/86] Fix test builds --- src/core/lib/iomgr/is_epollexclusive_available.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/core/lib/iomgr/is_epollexclusive_available.h b/src/core/lib/iomgr/is_epollexclusive_available.h index 1d2e133a3b1..9ae9c5c1915 100644 --- a/src/core/lib/iomgr/is_epollexclusive_available.h +++ b/src/core/lib/iomgr/is_epollexclusive_available.h @@ -21,6 +21,14 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + bool grpc_is_epollexclusive_available(void); +#ifdef __cplusplus +} +#endif + #endif /* GRPC_CORE_LIB_IOMGR_IS_EPOLLEXCLUSIVE_AVAILABLE_H */ From 46f9175ba3a27958a1655707d6014de1ba3ce4d5 Mon Sep 17 00:00:00 2001 From: ncteisen Date: Fri, 17 Nov 2017 16:27:56 -0800 Subject: [PATCH 37/86] Fix windows build --- src/core/lib/compression/stream_compression.cc | 3 +-- test/core/end2end/data/client_certs.cc | 8 ++++---- test/core/end2end/data/server1_cert.cc | 2 +- test/core/end2end/data/server1_key.cc | 2 +- test/core/end2end/data/test_root_cert.cc | 2 +- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/core/lib/compression/stream_compression.cc b/src/core/lib/compression/stream_compression.cc index 1ccbe162b6f..f989160d06e 100644 --- a/src/core/lib/compression/stream_compression.cc +++ b/src/core/lib/compression/stream_compression.cc @@ -21,8 +21,7 @@ #include "src/core/lib/compression/stream_compression.h" #include "src/core/lib/compression/stream_compression_gzip.h" -extern "C" const grpc_stream_compression_vtable - grpc_stream_compression_identity_vtable; +const grpc_stream_compression_vtable grpc_stream_compression_identity_vtable; bool grpc_stream_compress(grpc_stream_compression_context* ctx, grpc_slice_buffer* in, grpc_slice_buffer* out, diff --git a/test/core/end2end/data/client_certs.cc b/test/core/end2end/data/client_certs.cc index 7e0b10da5c4..78770674c4a 100644 --- a/test/core/end2end/data/client_certs.cc +++ b/test/core/end2end/data/client_certs.cc @@ -16,7 +16,7 @@ * */ -extern "C" const char test_self_signed_client_cert[] = { +const char test_self_signed_client_cert[] = { 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x43, 0x45, 0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x4d, 0x49, 0x49, 0x43, 0x6f, 0x44, 0x43, 0x43, @@ -100,7 +100,7 @@ extern "C" const char test_self_signed_client_cert[] = { 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x00}; -extern "C" const char test_self_signed_client_key[] = { +const char test_self_signed_client_key[] = { 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x20, 0x4b, 0x45, 0x59, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x4d, 0x49, 0x49, 0x43, 0x64, 0x77, 0x49, 0x42, @@ -179,7 +179,7 @@ extern "C" const char test_self_signed_client_key[] = { 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x20, 0x4b, 0x45, 0x59, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x00}; -extern "C" const char test_signed_client_cert[] = { +const char test_signed_client_cert[] = { 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x43, 0x45, 0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x4d, 0x49, 0x49, 0x43, 0x48, 0x7a, 0x43, 0x43, @@ -248,7 +248,7 @@ extern "C" const char test_signed_client_cert[] = { 0x20, 0x43, 0x45, 0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x00}; -extern "C" const char test_signed_client_key[] = { +const char test_signed_client_key[] = { 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x20, 0x4b, 0x45, 0x59, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x4d, 0x49, 0x49, 0x43, 0x65, 0x51, 0x49, 0x42, diff --git a/test/core/end2end/data/server1_cert.cc b/test/core/end2end/data/server1_cert.cc index dd09810732c..8d149607b60 100644 --- a/test/core/end2end/data/server1_cert.cc +++ b/test/core/end2end/data/server1_cert.cc @@ -16,7 +16,7 @@ * */ -extern "C" const char test_server1_cert[] = { +const char test_server1_cert[] = { 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x43, 0x45, 0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x4d, 0x49, 0x49, 0x43, 0x6e, 0x44, 0x43, 0x43, diff --git a/test/core/end2end/data/server1_key.cc b/test/core/end2end/data/server1_key.cc index 59dcaf63345..eee5cc6d82a 100644 --- a/test/core/end2end/data/server1_key.cc +++ b/test/core/end2end/data/server1_key.cc @@ -16,7 +16,7 @@ * */ -extern "C" const char test_server1_key[] = { +const char test_server1_key[] = { 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x52, 0x53, 0x41, 0x20, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x20, 0x4b, 0x45, 0x59, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x4d, 0x49, 0x49, 0x43, diff --git a/test/core/end2end/data/test_root_cert.cc b/test/core/end2end/data/test_root_cert.cc index 36fca2e45fe..ef39ca56ab1 100644 --- a/test/core/end2end/data/test_root_cert.cc +++ b/test/core/end2end/data/test_root_cert.cc @@ -16,7 +16,7 @@ * */ -extern "C" const char test_root_cert[] = { +const char test_root_cert[] = { 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x43, 0x45, 0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x4d, 0x49, 0x49, 0x43, 0x49, 0x7a, 0x43, 0x43, From 6dc1097c5e1599fdf3bb1102946413a14fa6f1ce Mon Sep 17 00:00:00 2001 From: ncteisen Date: Mon, 20 Nov 2017 12:41:13 -0500 Subject: [PATCH 38/86] Fix test cert build --- test/core/end2end/data/client_certs.cc | 2 ++ test/core/end2end/data/server1_cert.cc | 2 ++ test/core/end2end/data/server1_key.cc | 2 ++ test/core/end2end/data/test_root_cert.cc | 2 ++ test/core/end2end/fuzzers/api_fuzzer.cc | 2 +- test/core/transport/bdp_estimator_test.cc | 2 +- test/core/util/fuzzer_corpus_test.cc | 4 ++-- test/cpp/microbenchmarks/bm_fullstack_trickle.cc | 2 +- test/cpp/microbenchmarks/helpers.h | 8 ++++---- 9 files changed, 17 insertions(+), 9 deletions(-) diff --git a/test/core/end2end/data/client_certs.cc b/test/core/end2end/data/client_certs.cc index 78770674c4a..6e61501234e 100644 --- a/test/core/end2end/data/client_certs.cc +++ b/test/core/end2end/data/client_certs.cc @@ -16,6 +16,8 @@ * */ +#include "test/core/end2end/data/ssl_test_data.h" + const char test_self_signed_client_cert[] = { 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x43, 0x45, 0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d, diff --git a/test/core/end2end/data/server1_cert.cc b/test/core/end2end/data/server1_cert.cc index 8d149607b60..5e017c4da73 100644 --- a/test/core/end2end/data/server1_cert.cc +++ b/test/core/end2end/data/server1_cert.cc @@ -16,6 +16,8 @@ * */ +#include "test/core/end2end/data/ssl_test_data.h" + const char test_server1_cert[] = { 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x43, 0x45, 0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d, diff --git a/test/core/end2end/data/server1_key.cc b/test/core/end2end/data/server1_key.cc index eee5cc6d82a..92a77aa21f0 100644 --- a/test/core/end2end/data/server1_key.cc +++ b/test/core/end2end/data/server1_key.cc @@ -16,6 +16,8 @@ * */ +#include "test/core/end2end/data/ssl_test_data.h" + const char test_server1_key[] = { 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x52, 0x53, 0x41, 0x20, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x20, 0x4b, diff --git a/test/core/end2end/data/test_root_cert.cc b/test/core/end2end/data/test_root_cert.cc index ef39ca56ab1..81ca410e14c 100644 --- a/test/core/end2end/data/test_root_cert.cc +++ b/test/core/end2end/data/test_root_cert.cc @@ -16,6 +16,8 @@ * */ +#include "test/core/end2end/data/ssl_test_data.h" + const char test_root_cert[] = { 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x43, 0x45, 0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d, diff --git a/test/core/end2end/fuzzers/api_fuzzer.cc b/test/core/end2end/fuzzers/api_fuzzer.cc index 9fab1a9382c..39e18dd121a 100644 --- a/test/core/end2end/fuzzers/api_fuzzer.cc +++ b/test/core/end2end/fuzzers/api_fuzzer.cc @@ -56,7 +56,7 @@ static grpc_server* g_server; static grpc_channel* g_channel; static grpc_resource_quota* g_resource_quota; -extern "C" gpr_timespec (*gpr_now_impl)(gpr_clock_type clock_type); +extern gpr_timespec (*gpr_now_impl)(gpr_clock_type clock_type); static gpr_timespec now_impl(gpr_clock_type clock_type) { GPR_ASSERT(clock_type != GPR_TIMESPAN); diff --git a/test/core/transport/bdp_estimator_test.cc b/test/core/transport/bdp_estimator_test.cc index 2a6fa95162c..d1272607f2a 100644 --- a/test/core/transport/bdp_estimator_test.cc +++ b/test/core/transport/bdp_estimator_test.cc @@ -29,7 +29,7 @@ #include "src/core/lib/support/string.h" #include "test/core/util/test_config.h" -extern "C" gpr_timespec (*gpr_now_impl)(gpr_clock_type clock_type); +extern gpr_timespec (*gpr_now_impl)(gpr_clock_type clock_type); namespace grpc_core { namespace testing { diff --git a/test/core/util/fuzzer_corpus_test.cc b/test/core/util/fuzzer_corpus_test.cc index 4094fb85484..e2ed301c942 100644 --- a/test/core/util/fuzzer_corpus_test.cc +++ b/test/core/util/fuzzer_corpus_test.cc @@ -29,8 +29,8 @@ #include "test/core/util/test_config.h" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size); -extern "C" bool squelch; -extern "C" bool leak_check; +extern bool squelch; +extern bool leak_check; // In some distros, gflags is in the namespace google, and in some others, // in gflags. This hack is enabling us to find both. diff --git a/test/cpp/microbenchmarks/bm_fullstack_trickle.cc b/test/cpp/microbenchmarks/bm_fullstack_trickle.cc index bb974fad507..5e72213823c 100644 --- a/test/cpp/microbenchmarks/bm_fullstack_trickle.cc +++ b/test/cpp/microbenchmarks/bm_fullstack_trickle.cc @@ -445,7 +445,7 @@ BENCHMARK(BM_PumpUnbalancedUnary_Trickle)->Apply(UnaryTrickleArgs); } // namespace testing } // namespace grpc -extern "C" gpr_timespec (*gpr_now_impl)(gpr_clock_type clock_type); +extern gpr_timespec (*gpr_now_impl)(gpr_clock_type clock_type); int main(int argc, char** argv) { ::benchmark::Initialize(&argc, argv); diff --git a/test/cpp/microbenchmarks/helpers.h b/test/cpp/microbenchmarks/helpers.h index 07be589df60..afa3e0f3ca8 100644 --- a/test/cpp/microbenchmarks/helpers.h +++ b/test/cpp/microbenchmarks/helpers.h @@ -54,10 +54,10 @@ class Library { }; #ifdef GPR_LOW_LEVEL_COUNTERS -extern "C" gpr_atm gpr_mu_locks; -extern "C" gpr_atm gpr_counter_atm_cas; -extern "C" gpr_atm gpr_counter_atm_add; -extern "C" gpr_atm gpr_now_call_count; +extern gpr_atm gpr_mu_locks; +extern gpr_atm gpr_counter_atm_cas; +extern gpr_atm gpr_counter_atm_add; +extern gpr_atm gpr_now_call_count; #endif class TrackCounters { From abdc290d26a059aa814d32da4e09643db9eaf0d3 Mon Sep 17 00:00:00 2001 From: ncteisen Date: Mon, 20 Nov 2017 15:15:58 -0500 Subject: [PATCH 39/86] clang fmt --- src/core/lib/compression/stream_compression.cc | 3 ++- src/core/lib/debug/trace.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/lib/compression/stream_compression.cc b/src/core/lib/compression/stream_compression.cc index fc39e0bc58a..b4b3e524d0e 100644 --- a/src/core/lib/compression/stream_compression.cc +++ b/src/core/lib/compression/stream_compression.cc @@ -21,7 +21,8 @@ #include "src/core/lib/compression/stream_compression.h" #include "src/core/lib/compression/stream_compression_gzip.h" -extern const grpc_stream_compression_vtable grpc_stream_compression_identity_vtable; +extern const grpc_stream_compression_vtable + grpc_stream_compression_identity_vtable; bool grpc_stream_compress(grpc_stream_compression_context* ctx, grpc_slice_buffer* in, grpc_slice_buffer* out, diff --git a/src/core/lib/debug/trace.h b/src/core/lib/debug/trace.h index 55713c89256..69ddd802222 100644 --- a/src/core/lib/debug/trace.h +++ b/src/core/lib/debug/trace.h @@ -92,6 +92,7 @@ class DebugOnlyTraceFlag { public: DebugOnlyTraceFlag(bool default_enabled, const char* name) {} bool enabled() { return false; } + private: void set_enabled(bool enabled) {} }; From 1ee85d13a4d81cfdbfe944d3453ffb4854a0baec Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 26 Apr 2017 10:58:48 +0200 Subject: [PATCH 40/86] expose batchcontext.Reset --- .../Grpc.Core/Internal/BatchContextSafeHandle.cs | 5 +++++ src/csharp/Grpc.Core/Internal/NativeMethods.cs | 3 +++ src/csharp/ext/grpc_csharp_ext.c | 13 +++++++++---- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/csharp/Grpc.Core/Internal/BatchContextSafeHandle.cs b/src/csharp/Grpc.Core/Internal/BatchContextSafeHandle.cs index 1e6f1fba376..be26b341ef4 100644 --- a/src/csharp/Grpc.Core/Internal/BatchContextSafeHandle.cs +++ b/src/csharp/Grpc.Core/Internal/BatchContextSafeHandle.cs @@ -104,6 +104,11 @@ namespace Grpc.Core.Internal return Native.grpcsharp_batch_context_recv_close_on_server_cancelled(this) != 0; } + public void Reset() + { + Native.grpcsharp_batch_context_reset(this); + } + protected override bool ReleaseHandle() { Native.grpcsharp_batch_context_destroy(handle); diff --git a/src/csharp/Grpc.Core/Internal/NativeMethods.cs b/src/csharp/Grpc.Core/Internal/NativeMethods.cs index d517252cfe6..43acb8f9156 100644 --- a/src/csharp/Grpc.Core/Internal/NativeMethods.cs +++ b/src/csharp/Grpc.Core/Internal/NativeMethods.cs @@ -52,6 +52,7 @@ namespace Grpc.Core.Internal public readonly Delegates.grpcsharp_batch_context_recv_status_on_client_details_delegate grpcsharp_batch_context_recv_status_on_client_details; public readonly Delegates.grpcsharp_batch_context_recv_status_on_client_trailing_metadata_delegate grpcsharp_batch_context_recv_status_on_client_trailing_metadata; public readonly Delegates.grpcsharp_batch_context_recv_close_on_server_cancelled_delegate grpcsharp_batch_context_recv_close_on_server_cancelled; + public readonly Delegates.grpcsharp_batch_context_reset_delegate grpcsharp_batch_context_reset; public readonly Delegates.grpcsharp_batch_context_destroy_delegate grpcsharp_batch_context_destroy; public readonly Delegates.grpcsharp_request_call_context_create_delegate grpcsharp_request_call_context_create; @@ -169,6 +170,7 @@ namespace Grpc.Core.Internal this.grpcsharp_batch_context_recv_status_on_client_details = GetMethodDelegate(library); this.grpcsharp_batch_context_recv_status_on_client_trailing_metadata = GetMethodDelegate(library); this.grpcsharp_batch_context_recv_close_on_server_cancelled = GetMethodDelegate(library); + this.grpcsharp_batch_context_reset = GetMethodDelegate(library); this.grpcsharp_batch_context_destroy = GetMethodDelegate(library); this.grpcsharp_request_call_context_create = GetMethodDelegate(library); @@ -311,6 +313,7 @@ namespace Grpc.Core.Internal public delegate IntPtr grpcsharp_batch_context_recv_status_on_client_details_delegate(BatchContextSafeHandle ctx, out UIntPtr detailsLength); public delegate IntPtr grpcsharp_batch_context_recv_status_on_client_trailing_metadata_delegate(BatchContextSafeHandle ctx); public delegate int grpcsharp_batch_context_recv_close_on_server_cancelled_delegate(BatchContextSafeHandle ctx); + public delegate void grpcsharp_batch_context_reset_delegate(BatchContextSafeHandle ctx); public delegate void grpcsharp_batch_context_destroy_delegate(IntPtr ctx); public delegate RequestCallContextSafeHandle grpcsharp_request_call_context_create_delegate(); diff --git a/src/csharp/ext/grpc_csharp_ext.c b/src/csharp/ext/grpc_csharp_ext.c index bcb3bfaee58..24d779e1e57 100644 --- a/src/csharp/ext/grpc_csharp_ext.c +++ b/src/csharp/ext/grpc_csharp_ext.c @@ -197,10 +197,7 @@ void grpcsharp_metadata_array_move(grpc_metadata_array* dest, } GPR_EXPORT void GPR_CALLTYPE -grpcsharp_batch_context_destroy(grpcsharp_batch_context* ctx) { - if (!ctx) { - return; - } +grpcsharp_batch_context_reset(grpcsharp_batch_context* ctx) { grpcsharp_metadata_array_destroy_metadata_including_entries( &(ctx->send_initial_metadata)); @@ -216,7 +213,15 @@ grpcsharp_batch_context_destroy(grpcsharp_batch_context* ctx) { grpcsharp_metadata_array_destroy_metadata_only( &(ctx->recv_status_on_client.trailing_metadata)); grpc_slice_unref(ctx->recv_status_on_client.status_details); + memset(ctx, 0, sizeof(grpcsharp_batch_context)); +} +GPR_EXPORT void GPR_CALLTYPE +grpcsharp_batch_context_destroy(grpcsharp_batch_context* ctx) { + if (!ctx) { + return; + } + grpcsharp_batch_context_reset(ctx); gpr_free(ctx); } From 0f41e496d27ae0adbc4b7017fdc3802fc88ada6e Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 20 Nov 2017 16:53:10 +0100 Subject: [PATCH 41/86] simple version of batchcontext pooling --- .../Internal/CompletionQueueSafeHandleTest.cs | 2 +- src/csharp/Grpc.Core/GrpcEnvironment.cs | 6 + src/csharp/Grpc.Core/Internal/AsyncCall.cs | 25 ++- .../Internal/BatchContextSafeHandle.cs | 21 +- .../Grpc.Core/Internal/CallSafeHandle.cs | 33 +-- .../Grpc.Core/Internal/ChannelSafeHandle.cs | 3 +- .../Grpc.Core/Internal/CompletionRegistry.cs | 10 +- .../Grpc.Core/Internal/DefaultObjectPool.cs | 196 ++++++++++++++++++ .../Grpc.Core/Internal/GrpcThreadPool.cs | 2 +- src/csharp/Grpc.Core/Internal/IObjectPool.cs | 35 ++++ .../Grpc.Core/Internal/ServerSafeHandle.cs | 3 +- .../CompletionRegistryBenchmark.cs | 6 +- 12 files changed, 293 insertions(+), 49 deletions(-) create mode 100644 src/csharp/Grpc.Core/Internal/DefaultObjectPool.cs create mode 100644 src/csharp/Grpc.Core/Internal/IObjectPool.cs diff --git a/src/csharp/Grpc.Core.Tests/Internal/CompletionQueueSafeHandleTest.cs b/src/csharp/Grpc.Core.Tests/Internal/CompletionQueueSafeHandleTest.cs index 1d9475a8b8a..775c950c8ce 100644 --- a/src/csharp/Grpc.Core.Tests/Internal/CompletionQueueSafeHandleTest.cs +++ b/src/csharp/Grpc.Core.Tests/Internal/CompletionQueueSafeHandleTest.cs @@ -40,7 +40,7 @@ namespace Grpc.Core.Internal.Tests public void CreateAsyncAndShutdown() { var env = GrpcEnvironment.AddRef(); - var cq = CompletionQueueSafeHandle.CreateAsync(new CompletionRegistry(env)); + var cq = CompletionQueueSafeHandle.CreateAsync(new CompletionRegistry(env, () => BatchContextSafeHandle.Create())); cq.Shutdown(); var ev = cq.Next(); cq.Dispose(); diff --git a/src/csharp/Grpc.Core/GrpcEnvironment.cs b/src/csharp/Grpc.Core/GrpcEnvironment.cs index 80031cb7efe..8f69b3a9672 100644 --- a/src/csharp/Grpc.Core/GrpcEnvironment.cs +++ b/src/csharp/Grpc.Core/GrpcEnvironment.cs @@ -45,6 +45,7 @@ namespace Grpc.Core static ILogger logger = new LogLevelFilterLogger(new ConsoleLogger(), LogLevel.Off, true); + readonly IObjectPool batchContextPool; readonly GrpcThreadPool threadPool; readonly DebugStats debugStats = new DebugStats(); readonly AtomicCounter cqPickerCounter = new AtomicCounter(); @@ -249,6 +250,8 @@ namespace Grpc.Core private GrpcEnvironment() { GrpcNativeInit(); + // TODO(jtattermusch): configure params + batchContextPool = new DefaultObjectPool(() => BatchContextSafeHandle.Create(this.batchContextPool), 10000, 64); threadPool = new GrpcThreadPool(this, GetThreadPoolSizeOrDefault(), GetCompletionQueueCountOrDefault(), inlineHandlers); threadPool.Start(); } @@ -264,6 +267,8 @@ namespace Grpc.Core } } + internal IObjectPool BatchContextPool => batchContextPool; + internal bool IsAlive { get @@ -325,6 +330,7 @@ namespace Grpc.Core await Task.Run(() => ShuttingDown?.Invoke(this, null)).ConfigureAwait(false); await threadPool.StopAsync().ConfigureAwait(false); + batchContextPool.Dispose(); GrpcNativeShutdown(); isShutdown = true; diff --git a/src/csharp/Grpc.Core/Internal/AsyncCall.cs b/src/csharp/Grpc.Core/Internal/AsyncCall.cs index aa2161267a5..9946d1a6cf9 100644 --- a/src/csharp/Grpc.Core/Internal/AsyncCall.cs +++ b/src/csharp/Grpc.Core/Internal/AsyncCall.cs @@ -92,23 +92,28 @@ namespace Grpc.Core.Internal } using (var metadataArray = MetadataArraySafeHandle.Create(details.Options.Headers)) - using (var ctx = BatchContextSafeHandle.Create()) { - call.StartUnary(ctx, payload, GetWriteFlagsForCall(), metadataArray, details.Options.Flags); - - var ev = cq.Pluck(ctx.Handle); - - bool success = (ev.success != 0); + var ctx = details.Channel.Environment.BatchContextPool.Lease(); try { - using (profiler.NewScope("AsyncCall.UnaryCall.HandleBatch")) + call.StartUnary(ctx, payload, GetWriteFlagsForCall(), metadataArray, details.Options.Flags); + var ev = cq.Pluck(ctx.Handle); + bool success = (ev.success != 0); + try + { + using (profiler.NewScope("AsyncCall.UnaryCall.HandleBatch")) + { + HandleUnaryResponse(success, ctx.GetReceivedStatusOnClient(), ctx.GetReceivedMessage(), ctx.GetReceivedInitialMetadata()); + } + } + catch (Exception e) { - HandleUnaryResponse(success, ctx.GetReceivedStatusOnClient(), ctx.GetReceivedMessage(), ctx.GetReceivedInitialMetadata()); + Logger.Error(e, "Exception occured while invoking completion delegate."); } } - catch (Exception e) + finally { - Logger.Error(e, "Exception occured while invoking completion delegate."); + ctx.Recycle(); } } diff --git a/src/csharp/Grpc.Core/Internal/BatchContextSafeHandle.cs b/src/csharp/Grpc.Core/Internal/BatchContextSafeHandle.cs index be26b341ef4..83385ad7d35 100644 --- a/src/csharp/Grpc.Core/Internal/BatchContextSafeHandle.cs +++ b/src/csharp/Grpc.Core/Internal/BatchContextSafeHandle.cs @@ -38,15 +38,18 @@ namespace Grpc.Core.Internal static readonly NativeMethods Native = NativeMethods.Get(); static readonly ILogger Logger = GrpcEnvironment.Logger.ForType(); + IObjectPool ownedByPool; CompletionCallbackData completionCallbackData; private BatchContextSafeHandle() { } - public static BatchContextSafeHandle Create() + public static BatchContextSafeHandle Create(IObjectPool ownedByPool = null) { - return Native.grpcsharp_batch_context_create(); + var ctx = Native.grpcsharp_batch_context_create(); + ctx.ownedByPool = ownedByPool; + return ctx; } public IntPtr Handle @@ -104,9 +107,17 @@ namespace Grpc.Core.Internal return Native.grpcsharp_batch_context_recv_close_on_server_cancelled(this) != 0; } - public void Reset() + public void Recycle() { - Native.grpcsharp_batch_context_reset(this); + if (ownedByPool != null) + { + Native.grpcsharp_batch_context_reset(this); + ownedByPool.Return(this); + } + else + { + Dispose(); + } } protected override bool ReleaseHandle() @@ -128,7 +139,7 @@ namespace Grpc.Core.Internal finally { completionCallbackData = default(CompletionCallbackData); - Dispose(); + Recycle(); } } diff --git a/src/csharp/Grpc.Core/Internal/CallSafeHandle.cs b/src/csharp/Grpc.Core/Internal/CallSafeHandle.cs index d6a5ba586bd..a3ef3e61ee1 100644 --- a/src/csharp/Grpc.Core/Internal/CallSafeHandle.cs +++ b/src/csharp/Grpc.Core/Internal/CallSafeHandle.cs @@ -70,8 +70,7 @@ namespace Grpc.Core.Internal { using (completionQueue.NewScope()) { - var ctx = BatchContextSafeHandle.Create(); - completionQueue.CompletionRegistry.RegisterBatchCompletion(ctx, CompletionHandler_IUnaryResponseClientCallback, callback); + var ctx = completionQueue.CompletionRegistry.RegisterBatchCompletion(CompletionHandler_IUnaryResponseClientCallback, callback); Native.grpcsharp_call_start_unary(this, ctx, payload, new UIntPtr((ulong)payload.Length), writeFlags, metadataArray, callFlags) .CheckOk(); } @@ -87,8 +86,7 @@ namespace Grpc.Core.Internal { using (completionQueue.NewScope()) { - var ctx = BatchContextSafeHandle.Create(); - completionQueue.CompletionRegistry.RegisterBatchCompletion(ctx, CompletionHandler_IUnaryResponseClientCallback, callback); + var ctx = completionQueue.CompletionRegistry.RegisterBatchCompletion(CompletionHandler_IUnaryResponseClientCallback, callback); Native.grpcsharp_call_start_client_streaming(this, ctx, metadataArray, callFlags).CheckOk(); } } @@ -97,8 +95,7 @@ namespace Grpc.Core.Internal { using (completionQueue.NewScope()) { - var ctx = BatchContextSafeHandle.Create(); - completionQueue.CompletionRegistry.RegisterBatchCompletion(ctx, CompletionHandler_IReceivedStatusOnClientCallback, callback); + var ctx = completionQueue.CompletionRegistry.RegisterBatchCompletion(CompletionHandler_IReceivedStatusOnClientCallback, callback); Native.grpcsharp_call_start_server_streaming(this, ctx, payload, new UIntPtr((ulong)payload.Length), writeFlags, metadataArray, callFlags).CheckOk(); } } @@ -107,8 +104,7 @@ namespace Grpc.Core.Internal { using (completionQueue.NewScope()) { - var ctx = BatchContextSafeHandle.Create(); - completionQueue.CompletionRegistry.RegisterBatchCompletion(ctx, CompletionHandler_IReceivedStatusOnClientCallback, callback); + var ctx = completionQueue.CompletionRegistry.RegisterBatchCompletion(CompletionHandler_IReceivedStatusOnClientCallback, callback); Native.grpcsharp_call_start_duplex_streaming(this, ctx, metadataArray, callFlags).CheckOk(); } } @@ -117,8 +113,7 @@ namespace Grpc.Core.Internal { using (completionQueue.NewScope()) { - var ctx = BatchContextSafeHandle.Create(); - completionQueue.CompletionRegistry.RegisterBatchCompletion(ctx, CompletionHandler_ISendCompletionCallback, callback); + var ctx = completionQueue.CompletionRegistry.RegisterBatchCompletion(CompletionHandler_ISendCompletionCallback, callback); Native.grpcsharp_call_send_message(this, ctx, payload, new UIntPtr((ulong)payload.Length), writeFlags, sendEmptyInitialMetadata ? 1 : 0).CheckOk(); } } @@ -127,8 +122,7 @@ namespace Grpc.Core.Internal { using (completionQueue.NewScope()) { - var ctx = BatchContextSafeHandle.Create(); - completionQueue.CompletionRegistry.RegisterBatchCompletion(ctx, CompletionHandler_ISendCompletionCallback, callback); + var ctx = completionQueue.CompletionRegistry.RegisterBatchCompletion(CompletionHandler_ISendCompletionCallback, callback); Native.grpcsharp_call_send_close_from_client(this, ctx).CheckOk(); } } @@ -138,9 +132,8 @@ namespace Grpc.Core.Internal { using (completionQueue.NewScope()) { - var ctx = BatchContextSafeHandle.Create(); + var ctx = completionQueue.CompletionRegistry.RegisterBatchCompletion(CompletionHandler_ISendStatusFromServerCompletionCallback, callback); var optionalPayloadLength = optionalPayload != null ? new UIntPtr((ulong)optionalPayload.Length) : UIntPtr.Zero; - completionQueue.CompletionRegistry.RegisterBatchCompletion(ctx, CompletionHandler_ISendStatusFromServerCompletionCallback, callback); var statusDetailBytes = MarshalUtils.GetBytesUTF8(status.Detail); Native.grpcsharp_call_send_status_from_server(this, ctx, status.StatusCode, statusDetailBytes, new UIntPtr((ulong)statusDetailBytes.Length), metadataArray, sendEmptyInitialMetadata ? 1 : 0, optionalPayload, optionalPayloadLength, writeFlags).CheckOk(); @@ -151,8 +144,7 @@ namespace Grpc.Core.Internal { using (completionQueue.NewScope()) { - var ctx = BatchContextSafeHandle.Create(); - completionQueue.CompletionRegistry.RegisterBatchCompletion(ctx, CompletionHandler_IReceivedMessageCallback, callback); + var ctx = completionQueue.CompletionRegistry.RegisterBatchCompletion(CompletionHandler_IReceivedMessageCallback, callback); Native.grpcsharp_call_recv_message(this, ctx).CheckOk(); } } @@ -161,8 +153,7 @@ namespace Grpc.Core.Internal { using (completionQueue.NewScope()) { - var ctx = BatchContextSafeHandle.Create(); - completionQueue.CompletionRegistry.RegisterBatchCompletion(ctx, CompletionHandler_IReceivedResponseHeadersCallback, callback); + var ctx = completionQueue.CompletionRegistry.RegisterBatchCompletion(CompletionHandler_IReceivedResponseHeadersCallback, callback); Native.grpcsharp_call_recv_initial_metadata(this, ctx).CheckOk(); } } @@ -171,8 +162,7 @@ namespace Grpc.Core.Internal { using (completionQueue.NewScope()) { - var ctx = BatchContextSafeHandle.Create(); - completionQueue.CompletionRegistry.RegisterBatchCompletion(ctx, CompletionHandler_IReceivedCloseOnServerCallback, callback); + var ctx = completionQueue.CompletionRegistry.RegisterBatchCompletion(CompletionHandler_IReceivedCloseOnServerCallback, callback); Native.grpcsharp_call_start_serverside(this, ctx).CheckOk(); } } @@ -181,8 +171,7 @@ namespace Grpc.Core.Internal { using (completionQueue.NewScope()) { - var ctx = BatchContextSafeHandle.Create(); - completionQueue.CompletionRegistry.RegisterBatchCompletion(ctx, CompletionHandler_ISendCompletionCallback, callback); + var ctx = completionQueue.CompletionRegistry.RegisterBatchCompletion(CompletionHandler_ISendCompletionCallback, callback); Native.grpcsharp_call_send_initial_metadata(this, ctx, metadataArray).CheckOk(); } } diff --git a/src/csharp/Grpc.Core/Internal/ChannelSafeHandle.cs b/src/csharp/Grpc.Core/Internal/ChannelSafeHandle.cs index 1eeb0e3d97f..cd5f8ed92e6 100644 --- a/src/csharp/Grpc.Core/Internal/ChannelSafeHandle.cs +++ b/src/csharp/Grpc.Core/Internal/ChannelSafeHandle.cs @@ -66,8 +66,7 @@ namespace Grpc.Core.Internal public void WatchConnectivityState(ChannelState lastObservedState, Timespec deadline, CompletionQueueSafeHandle cq, BatchCompletionDelegate callback, object callbackState) { - var ctx = BatchContextSafeHandle.Create(); - cq.CompletionRegistry.RegisterBatchCompletion(ctx, callback, callbackState); + var ctx = cq.CompletionRegistry.RegisterBatchCompletion(callback, callbackState); Native.grpcsharp_channel_watch_connectivity_state(this, lastObservedState, deadline, cq, ctx); } diff --git a/src/csharp/Grpc.Core/Internal/CompletionRegistry.cs b/src/csharp/Grpc.Core/Internal/CompletionRegistry.cs index b68655b33ca..cf3f3c0995a 100644 --- a/src/csharp/Grpc.Core/Internal/CompletionRegistry.cs +++ b/src/csharp/Grpc.Core/Internal/CompletionRegistry.cs @@ -36,13 +36,15 @@ namespace Grpc.Core.Internal static readonly ILogger Logger = GrpcEnvironment.Logger.ForType(); readonly GrpcEnvironment environment; + readonly Func batchContextFactory; readonly Dictionary dict = new Dictionary(new IntPtrComparer()); SpinLock spinLock = new SpinLock(Debugger.IsAttached); IntPtr lastRegisteredKey; // only for testing - public CompletionRegistry(GrpcEnvironment environment) + public CompletionRegistry(GrpcEnvironment environment, Func batchContextFactory) { - this.environment = environment; + this.environment = GrpcPreconditions.CheckNotNull(environment); + this.batchContextFactory = GrpcPreconditions.CheckNotNull(batchContextFactory); } public void Register(IntPtr key, IOpCompletionCallback callback) @@ -63,10 +65,12 @@ namespace Grpc.Core.Internal } } - public void RegisterBatchCompletion(BatchContextSafeHandle ctx, BatchCompletionDelegate callback, object state) + public BatchContextSafeHandle RegisterBatchCompletion(BatchCompletionDelegate callback, object state) { + var ctx = batchContextFactory(); ctx.SetCompletionCallback(callback, state); Register(ctx.Handle, ctx); + return ctx; } public void RegisterRequestCallCompletion(RequestCallContextSafeHandle ctx, RequestCallCompletionDelegate callback) diff --git a/src/csharp/Grpc.Core/Internal/DefaultObjectPool.cs b/src/csharp/Grpc.Core/Internal/DefaultObjectPool.cs new file mode 100644 index 00000000000..37c9ae06feb --- /dev/null +++ b/src/csharp/Grpc.Core/Internal/DefaultObjectPool.cs @@ -0,0 +1,196 @@ +#region Copyright notice and license + +// Copyright 2017 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#endregion + +using System; +using System.Threading; +using System.Collections.Generic; +using Grpc.Core.Utils; + +namespace Grpc.Core.Internal +{ + /// + /// Pool of objects that combines a shared pool and a thread local pool. + /// + internal class DefaultObjectPool : IObjectPool + where T : class, IDisposable + { + readonly object myLock = new object(); + readonly Func itemFactory; + + // Queue shared between threads, access needs to be synchronized. + readonly Queue sharedQueue; + readonly int sharedCapacity; + + readonly ThreadLocal threadLocalData; + readonly int threadLocalCapacity; + readonly int rentLimit; + + bool disposed; + + /// + /// Initializes a new instance of DefaultObjectPool with given shared capacity and thread local capacity. + /// Thread local capacity should be significantly smaller than the shared capacity as we don't guarantee immediately + /// disposing the objects in the thread local pool after this pool is disposed (they will eventually be garbage collected + /// after the thread that owns them has finished). + /// On average, the shared pool will only be accessed approx. once for every threadLocalCapacity / 2 rent or lease + /// operations. + /// + public DefaultObjectPool(Func itemFactory, int sharedCapacity, int threadLocalCapacity) + { + GrpcPreconditions.CheckArgument(sharedCapacity >= 0); + GrpcPreconditions.CheckArgument(threadLocalCapacity >= 0); + this.itemFactory = GrpcPreconditions.CheckNotNull(itemFactory, nameof(itemFactory)); + this.sharedQueue = new Queue(sharedCapacity); + this.sharedCapacity = sharedCapacity; + this.threadLocalData = new ThreadLocal(() => new ThreadLocalData(threadLocalCapacity), false); + this.threadLocalCapacity = threadLocalCapacity; + this.rentLimit = threadLocalCapacity / 2; + } + + /// + /// Leases an item from the pool or creates a new instance if the pool is empty. + /// Attempts to retrieve the item from the thread local pool first. + /// If the thread local pool is empty, the item is taken from the shared pool + /// along with more items that are moved to the thread local pool to avoid + /// prevent acquiring the lock for shared pool too often. + /// The methods should not be called after the pool is disposed, but it won't + /// results in an error to do so (after depleting the items potentially left + /// in the thread local pool, it will continue returning new objects created by the factory). + /// + public T Lease() + { + var localData = threadLocalData.Value; + if (localData.Queue.Count > 0) + { + return localData.Queue.Dequeue(); + } + if (localData.CreateBudget > 0) + { + localData.CreateBudget --; + return itemFactory(); + } + + int itemsMoved = 0; + T leasedItem = null; + lock(myLock) + { + if (sharedQueue.Count > 0) + { + leasedItem = sharedQueue.Dequeue(); + } + while (sharedQueue.Count > 0 && itemsMoved < rentLimit) + { + localData.Queue.Enqueue(sharedQueue.Dequeue()); + itemsMoved ++; + } + } + + // If the shared pool didn't contain all rentLimit items, + // next time we try to lease we will just create those + // instead of trying to grab them from the shared queue. + // This is to guarantee we won't be accessing the shared queue too often. + localData.CreateBudget += rentLimit - itemsMoved; + + return leasedItem ?? itemFactory(); + } + + /// + /// Returns an item to the pool. + /// Attempts to add the item to the thread local pool first. + /// If the thread local pool is full, item is added to a shared pool, + /// along with half of the items for the thread local pool, which + /// should prevent acquiring the lock for shared pool too often. + /// If called after the pool is disposed, we make best effort not to + /// add anything to the thread local pool and we guarantee not to add + /// anything to the shared pool (items will be disposed instead). + /// + public void Return(T item) + { + GrpcPreconditions.CheckNotNull(item); + + var localData = threadLocalData.Value; + if (localData.Queue.Count < threadLocalCapacity && !disposed) + { + localData.Queue.Enqueue(item); + return; + } + if (localData.DisposeBudget > 0) + { + localData.DisposeBudget --; + item.Dispose(); + return; + } + + int itemsReturned = 0; + int returnLimit = rentLimit + 1; + lock (myLock) + { + if (sharedQueue.Count < sharedCapacity && !disposed) + { + sharedQueue.Enqueue(item); + itemsReturned ++; + } + while (sharedQueue.Count < sharedCapacity && itemsReturned < returnLimit && !disposed) + { + sharedQueue.Enqueue(localData.Queue.Dequeue()); + itemsReturned ++; + } + } + + // If the shared pool could not accomodate all returnLimit items, + // next time we try to return we will just dispose the item + // instead of trying to return them to the shared queue. + // This is to guarantee we won't be accessing the shared queue too often. + localData.DisposeBudget += returnLimit - itemsReturned; + + if (itemsReturned == 0) + { + localData.DisposeBudget --; + item.Dispose(); + } + } + + public void Dispose() + { + lock (myLock) + { + if (!disposed) + { + disposed = true; + + while (sharedQueue.Count > 0) + { + sharedQueue.Dequeue().Dispose(); + } + } + } + } + + class ThreadLocalData + { + public ThreadLocalData(int capacity) + { + this.Queue = new Queue(capacity); + } + + public Queue Queue { get; } + public int CreateBudget { get; set; } + public int DisposeBudget { get; set; } + } + } +} diff --git a/src/csharp/Grpc.Core/Internal/GrpcThreadPool.cs b/src/csharp/Grpc.Core/Internal/GrpcThreadPool.cs index bd0229a9dd4..f1b5a4f9ffd 100644 --- a/src/csharp/Grpc.Core/Internal/GrpcThreadPool.cs +++ b/src/csharp/Grpc.Core/Internal/GrpcThreadPool.cs @@ -219,7 +219,7 @@ namespace Grpc.Core.Internal var list = new List(); for (int i = 0; i < completionQueueCount; i++) { - var completionRegistry = new CompletionRegistry(environment); + var completionRegistry = new CompletionRegistry(environment, () => environment.BatchContextPool.Lease()); list.Add(CompletionQueueSafeHandle.CreateAsync(completionRegistry)); } return list.AsReadOnly(); diff --git a/src/csharp/Grpc.Core/Internal/IObjectPool.cs b/src/csharp/Grpc.Core/Internal/IObjectPool.cs new file mode 100644 index 00000000000..f7d6e30a2ad --- /dev/null +++ b/src/csharp/Grpc.Core/Internal/IObjectPool.cs @@ -0,0 +1,35 @@ +#region Copyright notice and license + +// Copyright 2017 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#endregion + +using System; +using System.Threading; +using System.Collections.Generic; +using Grpc.Core.Utils; + +namespace Grpc.Core.Internal +{ + /// + /// Pool of objects. + /// + internal interface IObjectPool : IDisposable + where T : class + { + T Lease(); + void Return(T item); + } +} diff --git a/src/csharp/Grpc.Core/Internal/ServerSafeHandle.cs b/src/csharp/Grpc.Core/Internal/ServerSafeHandle.cs index a308890cde2..9b7ea884dd0 100644 --- a/src/csharp/Grpc.Core/Internal/ServerSafeHandle.cs +++ b/src/csharp/Grpc.Core/Internal/ServerSafeHandle.cs @@ -64,10 +64,9 @@ namespace Grpc.Core.Internal { using (completionQueue.NewScope()) { - var ctx = BatchContextSafeHandle.Create(); // TODO(jtattermusch): delegate allocation by caller can be avoided by utilizing the "state" object, // but server shutdown isn't worth optimizing right now. - completionQueue.CompletionRegistry.RegisterBatchCompletion(ctx, callback, null); + var ctx = completionQueue.CompletionRegistry.RegisterBatchCompletion(callback, null); Native.grpcsharp_server_shutdown_and_notify_callback(this, completionQueue, ctx); } } diff --git a/src/csharp/Grpc.Microbenchmarks/CompletionRegistryBenchmark.cs b/src/csharp/Grpc.Microbenchmarks/CompletionRegistryBenchmark.cs index 2d1c33e9a0c..eefdb50e39f 100644 --- a/src/csharp/Grpc.Microbenchmarks/CompletionRegistryBenchmark.cs +++ b/src/csharp/Grpc.Microbenchmarks/CompletionRegistryBenchmark.cs @@ -43,7 +43,7 @@ namespace Grpc.Microbenchmarks public void Run(int threadCount, int iterations, bool useSharedRegistry) { Console.WriteLine(string.Format("CompletionRegistryBenchmark: threads={0}, iterations={1}, useSharedRegistry={2}", threadCount, iterations, useSharedRegistry)); - CompletionRegistry sharedRegistry = useSharedRegistry ? new CompletionRegistry(environment) : null; + CompletionRegistry sharedRegistry = useSharedRegistry ? new CompletionRegistry(environment, () => BatchContextSafeHandle.Create()) : null; var threadedBenchmark = new ThreadedBenchmark(threadCount, () => ThreadBody(iterations, sharedRegistry)); threadedBenchmark.Run(); // TODO: parametrize by number of pending completions @@ -51,7 +51,7 @@ namespace Grpc.Microbenchmarks private void ThreadBody(int iterations, CompletionRegistry optionalSharedRegistry) { - var completionRegistry = optionalSharedRegistry ?? new CompletionRegistry(environment); + var completionRegistry = optionalSharedRegistry ?? new CompletionRegistry(environment, () => BatchContextSafeHandle.Create()); var ctx = BatchContextSafeHandle.Create(); var stopwatch = Stopwatch.StartNew(); @@ -64,7 +64,7 @@ namespace Grpc.Microbenchmarks stopwatch.Stop(); Console.WriteLine("Elapsed millis: " + stopwatch.ElapsedMilliseconds); - ctx.Dispose(); + ctx.Recycle(); } private class NopCompletionCallback : IOpCompletionCallback From 63834bf62a60fef5c0cd48a635e9bc4c78aa3538 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Sat, 25 Nov 2017 12:38:07 +0100 Subject: [PATCH 42/86] add basic tests --- .../Internal/DefaultObjectPoolTest.cs | 79 +++++++++++++++++++ src/csharp/tests.json | 1 + 2 files changed, 80 insertions(+) create mode 100644 src/csharp/Grpc.Core.Tests/Internal/DefaultObjectPoolTest.cs diff --git a/src/csharp/Grpc.Core.Tests/Internal/DefaultObjectPoolTest.cs b/src/csharp/Grpc.Core.Tests/Internal/DefaultObjectPoolTest.cs new file mode 100644 index 00000000000..b6bb0a9eaeb --- /dev/null +++ b/src/csharp/Grpc.Core.Tests/Internal/DefaultObjectPoolTest.cs @@ -0,0 +1,79 @@ +#region Copyright notice and license + +// Copyright 2017 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#endregion + +using System; +using Grpc.Core; +using Grpc.Core.Internal; +using Grpc.Core.Utils; +using NUnit.Framework; + +namespace Grpc.Core.Internal.Tests +{ + public class DefaultObjectPoolTest + { + [Test] + [TestCase(10, 2)] + [TestCase(10, 1)] + [TestCase(0, 2)] + [TestCase(2, 0)] + public void ObjectIsReused(int sharedCapacity, int threadLocalCapacity) + { + var pool = new DefaultObjectPool(() => new TestPooledObject(), sharedCapacity, threadLocalCapacity); + var origLeased = pool.Lease(); + pool.Return(origLeased); + Assert.AreSame(origLeased, pool.Lease()); + Assert.AreNotSame(origLeased, pool.Lease()); + } + + [Test] + public void ZeroCapacities() + { + var pool = new DefaultObjectPool(() => new TestPooledObject(), 0, 0); + var origLeased = pool.Lease(); + pool.Return(origLeased); + Assert.AreNotSame(origLeased, pool.Lease()); + } + + [Test] + public void DisposeCleansSharedPool() + { + var pool = new DefaultObjectPool(() => new TestPooledObject(), 10, 0); + var origLeased = pool.Lease(); + pool.Return(origLeased); + pool.Dispose(); + Assert.AreNotSame(origLeased, pool.Lease()); + } + + [Test] + public void Constructor() + { + Assert.Throws(() => new DefaultObjectPool(null, 10, 2)); + Assert.Throws(() => new DefaultObjectPool(() => new TestPooledObject(), -1, 10)); + Assert.Throws(() => new DefaultObjectPool(() => new TestPooledObject(), 10, -1)); + } + + class TestPooledObject : IDisposable + { + + public void Dispose() + { + + } + } + } +} diff --git a/src/csharp/tests.json b/src/csharp/tests.json index 78410510526..1d64f5acb1e 100644 --- a/src/csharp/tests.json +++ b/src/csharp/tests.json @@ -5,6 +5,7 @@ "Grpc.Core.Internal.Tests.ChannelArgsSafeHandleTest", "Grpc.Core.Internal.Tests.CompletionQueueEventTest", "Grpc.Core.Internal.Tests.CompletionQueueSafeHandleTest", + "Grpc.Core.Internal.Tests.DefaultObjectPoolTest", "Grpc.Core.Internal.Tests.MetadataArraySafeHandleTest", "Grpc.Core.Internal.Tests.TimespecTest", "Grpc.Core.Tests.AppDomainUnloadTest", From 2e631706e2b2c2a3190e039ee26781fcd0483b40 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Sat, 25 Nov 2017 19:37:45 +0100 Subject: [PATCH 43/86] expose batchcontextpool settings --- src/csharp/Grpc.Core/GrpcEnvironment.cs | 31 +++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/src/csharp/Grpc.Core/GrpcEnvironment.cs b/src/csharp/Grpc.Core/GrpcEnvironment.cs index 8f69b3a9672..2b1b5e32d74 100644 --- a/src/csharp/Grpc.Core/GrpcEnvironment.cs +++ b/src/csharp/Grpc.Core/GrpcEnvironment.cs @@ -33,6 +33,8 @@ namespace Grpc.Core public class GrpcEnvironment { const int MinDefaultThreadPoolSize = 4; + const int DefaultBatchContextPoolSharedCapacity = 10000; + const int DefaultBatchContextPoolThreadLocalCapacity = 64; static object staticLock = new object(); static GrpcEnvironment instance; @@ -40,6 +42,8 @@ namespace Grpc.Core static int? customThreadPoolSize; static int? customCompletionQueueCount; static bool inlineHandlers; + static int batchContextPoolSharedCapacity = DefaultBatchContextPoolSharedCapacity; + static int batchContextPoolThreadLocalCapacity = DefaultBatchContextPoolThreadLocalCapacity; static readonly HashSet registeredChannels = new HashSet(); static readonly HashSet registeredServers = new HashSet(); @@ -187,7 +191,7 @@ namespace Grpc.Core /// /// Sets the number of threads in the gRPC thread pool that polls for internal RPC events. - /// Can be only invoke before the GrpcEnviroment is started and cannot be changed afterwards. + /// Can be only invoked before the GrpcEnviroment is started and cannot be changed afterwards. /// Setting thread pool size is an advanced setting and you should only use it if you know what you are doing. /// Most users should rely on the default value provided by gRPC library. /// Note: this method is part of an experimental API that can change or be removed without any prior notice. @@ -204,7 +208,7 @@ namespace Grpc.Core /// /// Sets the number of completion queues in the gRPC thread pool that polls for internal RPC events. - /// Can be only invoke before the GrpcEnviroment is started and cannot be changed afterwards. + /// Can be only invoked before the GrpcEnviroment is started and cannot be changed afterwards. /// Setting the number of completions queues is an advanced setting and you should only use it if you know what you are doing. /// Most users should rely on the default value provided by gRPC library. /// Note: this method is part of an experimental API that can change or be removed without any prior notice. @@ -238,6 +242,26 @@ namespace Grpc.Core } } + /// + /// Sets the parameters for a pool that caches batch context instances. Reusing batch context instances + /// instead of creating a new one for every C core operation helps reducing the GC pressure. + /// Can be only invoked before the GrpcEnviroment is started and cannot be changed afterwards. + /// This is an advanced setting and you should only use it if you know what you are doing. + /// Most users should rely on the default value provided by gRPC library. + /// Note: this method is part of an experimental API that can change or be removed without any prior notice. + /// + public static void SetBatchContextPoolParams(int sharedCapacity, int threadLocalCapacity) + { + lock (staticLock) + { + GrpcPreconditions.CheckState(instance == null, "Can only be set before GrpcEnvironment is initialized"); + GrpcPreconditions.CheckArgument(sharedCapacity >= 0, "Shared capacity needs to be a non-negative number"); + GrpcPreconditions.CheckArgument(threadLocalCapacity >= 0, "Thread local capacity needs to be a non-negative number"); + batchContextPoolSharedCapacity = sharedCapacity; + batchContextPoolThreadLocalCapacity = threadLocalCapacity; + } + } + /// /// Occurs when GrpcEnvironment is about the start the shutdown logic. /// If GrpcEnvironment is later initialized and shutdown, the event will be fired again (unless unregistered first). @@ -250,8 +274,7 @@ namespace Grpc.Core private GrpcEnvironment() { GrpcNativeInit(); - // TODO(jtattermusch): configure params - batchContextPool = new DefaultObjectPool(() => BatchContextSafeHandle.Create(this.batchContextPool), 10000, 64); + batchContextPool = new DefaultObjectPool(() => BatchContextSafeHandle.Create(this.batchContextPool), batchContextPoolSharedCapacity, batchContextPoolThreadLocalCapacity); threadPool = new GrpcThreadPool(this, GetThreadPoolSizeOrDefault(), GetCompletionQueueCountOrDefault(), inlineHandlers); threadPool.Start(); } From 21cde3d22a113969fb135ae765473fb79b3de405 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Sat, 25 Nov 2017 11:59:09 +0100 Subject: [PATCH 44/86] use pool in SendMessageBenchmark --- src/csharp/Grpc.Microbenchmarks/SendMessageBenchmark.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/csharp/Grpc.Microbenchmarks/SendMessageBenchmark.cs b/src/csharp/Grpc.Microbenchmarks/SendMessageBenchmark.cs index 9cff97eb883..da4f35ff963 100644 --- a/src/csharp/Grpc.Microbenchmarks/SendMessageBenchmark.cs +++ b/src/csharp/Grpc.Microbenchmarks/SendMessageBenchmark.cs @@ -52,10 +52,7 @@ namespace Grpc.Microbenchmarks private void ThreadBody(int iterations, int payloadSize) { - // TODO(jtattermusch): parametrize by number of pending completions. - // TODO(jtattermusch): parametrize by cached/non-cached BatchContextSafeHandle - - var completionRegistry = new CompletionRegistry(environment); + var completionRegistry = new CompletionRegistry(environment, () => environment.BatchContextPool.Lease()); var cq = CompletionQueueSafeHandle.CreateAsync(completionRegistry); var call = CreateFakeCall(cq); From 70db663ae8773dc45464c904603a3e73045b45c5 Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Mon, 27 Nov 2017 14:53:26 -0800 Subject: [PATCH 45/86] Add ReferenceCounted base class. --- BUILD | 17 ++++++ CMakeLists.txt | 42 +++++++++++++ Makefile | 49 +++++++++++++++ build.yaml | 17 ++++++ config.m4 | 1 + config.w32 | 1 + gRPC-Core.podspec | 5 ++ grpc.gemspec | 3 + grpc.gyp | 1 + package.xml | 3 + src/core/lib/support/debug_location.h | 48 +++++++++++++++ src/core/lib/support/reference_counted.cc | 58 ++++++++++++++++++ src/core/lib/support/reference_counted.h | 55 +++++++++++++++++ src/python/grpcio/grpc_core_dependencies.py | 1 + test/core/support/BUILD | 13 ++++ test/core/support/reference_counted_test.cc | 60 +++++++++++++++++++ tools/doxygen/Doxyfile.c++.internal | 2 + tools/doxygen/Doxyfile.core.internal | 3 + .../generated/sources_and_headers.json | 24 ++++++++ tools/run_tests/generated/tests.json | 24 ++++++++ 20 files changed, 427 insertions(+) create mode 100644 src/core/lib/support/debug_location.h create mode 100644 src/core/lib/support/reference_counted.cc create mode 100644 src/core/lib/support/reference_counted.h create mode 100644 test/core/support/reference_counted_test.cc diff --git a/BUILD b/BUILD index 25daba8e1e9..5289023ef5a 100644 --- a/BUILD +++ b/BUILD @@ -537,6 +537,23 @@ grpc_cc_library( ], ) +grpc_cc_library( + name = "debug_location", + public_hdrs = ["src/core/lib/support/debug_location.h"], + language = "c++", +) + +grpc_cc_library( + name = "reference_counted", + srcs = ["src/core/lib/support/reference_counted.cc"], + public_hdrs = ["src/core/lib/support/reference_counted.h"], + language = "c++", + deps = [ + "grpc_trace", + "debug_location", + ], +) + grpc_cc_library( name = "grpc_base_c", srcs = [ diff --git a/CMakeLists.txt b/CMakeLists.txt index 77b60e898ab..ca59c84e500 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -739,6 +739,7 @@ endif() add_dependencies(buildtests_cxx qps_worker) add_dependencies(buildtests_cxx reconnect_interop_client) add_dependencies(buildtests_cxx reconnect_interop_server) +add_dependencies(buildtests_cxx reference_counted_test) add_dependencies(buildtests_cxx secure_auth_context_test) if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_dependencies(buildtests_cxx secure_sync_unary_ping_pong_test) @@ -807,6 +808,7 @@ add_library(gpr src/core/lib/support/log_windows.cc src/core/lib/support/mpscq.cc src/core/lib/support/murmur_hash.cc + src/core/lib/support/reference_counted.cc src/core/lib/support/stack_lockfree.cc src/core/lib/support/string.cc src/core/lib/support/string_posix.cc @@ -12260,6 +12262,46 @@ target_link_libraries(reconnect_interop_server endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) +add_executable(reference_counted_test + test/core/support/reference_counted_test.cc + third_party/googletest/googletest/src/gtest-all.cc + third_party/googletest/googlemock/src/gmock-all.cc +) + + +target_include_directories(reference_counted_test + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include + PRIVATE ${BORINGSSL_ROOT_DIR}/include + PRIVATE ${PROTOBUF_ROOT_DIR}/src + PRIVATE ${BENCHMARK_ROOT_DIR}/include + PRIVATE ${ZLIB_ROOT_DIR} + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib + PRIVATE ${CARES_INCLUDE_DIR} + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/third_party/abseil-cpp + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest + PRIVATE third_party/googletest/googlemock/include + PRIVATE third_party/googletest/googlemock + PRIVATE ${_gRPC_PROTO_GENS_DIR} +) + +target_link_libraries(reference_counted_test + ${_gRPC_PROTOBUF_LIBRARIES} + ${_gRPC_ALLTARGETS_LIBRARIES} + grpc_test_util + grpc++ + grpc + gpr_test_util + gpr + ${_gRPC_GFLAGS_LIBRARIES} +) + +endif (gRPC_BUILD_TESTS) +if (gRPC_BUILD_TESTS) + add_executable(secure_auth_context_test test/cpp/common/secure_auth_context_test.cc third_party/googletest/googletest/src/gtest-all.cc diff --git a/Makefile b/Makefile index c85b1bca733..0e8437a05cd 100644 --- a/Makefile +++ b/Makefile @@ -1165,6 +1165,7 @@ qps_openloop_test: $(BINDIR)/$(CONFIG)/qps_openloop_test qps_worker: $(BINDIR)/$(CONFIG)/qps_worker reconnect_interop_client: $(BINDIR)/$(CONFIG)/reconnect_interop_client reconnect_interop_server: $(BINDIR)/$(CONFIG)/reconnect_interop_server +reference_counted_test: $(BINDIR)/$(CONFIG)/reference_counted_test secure_auth_context_test: $(BINDIR)/$(CONFIG)/secure_auth_context_test secure_sync_unary_ping_pong_test: $(BINDIR)/$(CONFIG)/secure_sync_unary_ping_pong_test server_builder_plugin_test: $(BINDIR)/$(CONFIG)/server_builder_plugin_test @@ -1601,6 +1602,7 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/qps_worker \ $(BINDIR)/$(CONFIG)/reconnect_interop_client \ $(BINDIR)/$(CONFIG)/reconnect_interop_server \ + $(BINDIR)/$(CONFIG)/reference_counted_test \ $(BINDIR)/$(CONFIG)/secure_auth_context_test \ $(BINDIR)/$(CONFIG)/secure_sync_unary_ping_pong_test \ $(BINDIR)/$(CONFIG)/server_builder_plugin_test \ @@ -1727,6 +1729,7 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/qps_worker \ $(BINDIR)/$(CONFIG)/reconnect_interop_client \ $(BINDIR)/$(CONFIG)/reconnect_interop_server \ + $(BINDIR)/$(CONFIG)/reference_counted_test \ $(BINDIR)/$(CONFIG)/secure_auth_context_test \ $(BINDIR)/$(CONFIG)/secure_sync_unary_ping_pong_test \ $(BINDIR)/$(CONFIG)/server_builder_plugin_test \ @@ -2130,6 +2133,8 @@ test_cxx: buildtests_cxx $(Q) $(BINDIR)/$(CONFIG)/proto_utils_test || ( echo test proto_utils_test failed ; exit 1 ) $(E) "[RUN] Testing qps_openloop_test" $(Q) $(BINDIR)/$(CONFIG)/qps_openloop_test || ( echo test qps_openloop_test failed ; exit 1 ) + $(E) "[RUN] Testing reference_counted_test" + $(Q) $(BINDIR)/$(CONFIG)/reference_counted_test || ( echo test reference_counted_test failed ; exit 1 ) $(E) "[RUN] Testing secure_auth_context_test" $(Q) $(BINDIR)/$(CONFIG)/secure_auth_context_test || ( echo test secure_auth_context_test failed ; exit 1 ) $(E) "[RUN] Testing secure_sync_unary_ping_pong_test" @@ -2836,6 +2841,7 @@ LIBGPR_SRC = \ src/core/lib/support/log_windows.cc \ src/core/lib/support/mpscq.cc \ src/core/lib/support/murmur_hash.cc \ + src/core/lib/support/reference_counted.cc \ src/core/lib/support/stack_lockfree.cc \ src/core/lib/support/string.cc \ src/core/lib/support/string_posix.cc \ @@ -16495,6 +16501,49 @@ endif $(OBJDIR)/$(CONFIG)/test/cpp/interop/reconnect_interop_server.o: $(GENDIR)/src/proto/grpc/testing/empty.pb.cc $(GENDIR)/src/proto/grpc/testing/empty.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/test.pb.cc $(GENDIR)/src/proto/grpc/testing/test.grpc.pb.cc +REFERENCE_COUNTED_TEST_SRC = \ + test/core/support/reference_counted_test.cc \ + +REFERENCE_COUNTED_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(REFERENCE_COUNTED_TEST_SRC)))) +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL. + +$(BINDIR)/$(CONFIG)/reference_counted_test: openssl_dep_error + +else + + + + +ifeq ($(NO_PROTOBUF),true) + +# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. + +$(BINDIR)/$(CONFIG)/reference_counted_test: protobuf_dep_error + +else + +$(BINDIR)/$(CONFIG)/reference_counted_test: $(PROTOBUF_DEP) $(REFERENCE_COUNTED_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LDXX) $(LDFLAGS) $(REFERENCE_COUNTED_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/reference_counted_test + +endif + +endif + +$(OBJDIR)/$(CONFIG)/test/core/support/reference_counted_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + +deps_reference_counted_test: $(REFERENCE_COUNTED_TEST_OBJS:.o=.dep) + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(REFERENCE_COUNTED_TEST_OBJS:.o=.dep) +endif +endif + + SECURE_AUTH_CONTEXT_TEST_SRC = \ test/cpp/common/secure_auth_context_test.cc \ diff --git a/build.yaml b/build.yaml index 4f6194ecc41..2903b866dcf 100644 --- a/build.yaml +++ b/build.yaml @@ -49,6 +49,7 @@ filegroups: - src/core/lib/support/log_windows.cc - src/core/lib/support/mpscq.cc - src/core/lib/support/murmur_hash.cc + - src/core/lib/support/reference_counted.cc - src/core/lib/support/stack_lockfree.cc - src/core/lib/support/string.cc - src/core/lib/support/string_posix.cc @@ -109,11 +110,13 @@ filegroups: - src/core/lib/support/atomic.h - src/core/lib/support/atomic_with_atm.h - src/core/lib/support/atomic_with_std.h + - src/core/lib/support/debug_location.h - src/core/lib/support/env.h - src/core/lib/support/manual_constructor.h - src/core/lib/support/memory.h - src/core/lib/support/mpscq.h - src/core/lib/support/murmur_hash.h + - src/core/lib/support/reference_counted.h - src/core/lib/support/spinlock.h - src/core/lib/support/stack_lockfree.h - src/core/lib/support/string.h @@ -4541,6 +4544,20 @@ targets: - gpr_test_util - gpr - grpc++_test_config +- name: reference_counted_test + gtest: true + build: test + language: c++ + src: + - test/core/support/reference_counted_test.cc + deps: + - grpc_test_util + - grpc++ + - grpc + - gpr_test_util + - gpr + uses: + - grpc++_test - name: secure_auth_context_test gtest: true build: test diff --git a/config.m4 b/config.m4 index d2f2520feac..9d514c8552b 100644 --- a/config.m4 +++ b/config.m4 @@ -62,6 +62,7 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/support/log_windows.cc \ src/core/lib/support/mpscq.cc \ src/core/lib/support/murmur_hash.cc \ + src/core/lib/support/reference_counted.cc \ src/core/lib/support/stack_lockfree.cc \ src/core/lib/support/string.cc \ src/core/lib/support/string_posix.cc \ diff --git a/config.w32 b/config.w32 index 8a713751dcd..2f24fcd8b01 100644 --- a/config.w32 +++ b/config.w32 @@ -39,6 +39,7 @@ if (PHP_GRPC != "no") { "src\\core\\lib\\support\\log_windows.cc " + "src\\core\\lib\\support\\mpscq.cc " + "src\\core\\lib\\support\\murmur_hash.cc " + + "src\\core\\lib\\support\\reference_counted.cc " + "src\\core\\lib\\support\\stack_lockfree.cc " + "src\\core\\lib\\support\\string.cc " + "src\\core\\lib\\support\\string_posix.cc " + diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 2f97565f1b4..71e13633ae8 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -192,11 +192,13 @@ Pod::Spec.new do |s| 'src/core/lib/support/atomic.h', 'src/core/lib/support/atomic_with_atm.h', 'src/core/lib/support/atomic_with_std.h', + 'src/core/lib/support/debug_location.h', 'src/core/lib/support/env.h', 'src/core/lib/support/manual_constructor.h', 'src/core/lib/support/memory.h', 'src/core/lib/support/mpscq.h', 'src/core/lib/support/murmur_hash.h', + 'src/core/lib/support/reference_counted.h', 'src/core/lib/support/spinlock.h', 'src/core/lib/support/stack_lockfree.h', 'src/core/lib/support/string.h', @@ -226,6 +228,7 @@ Pod::Spec.new do |s| 'src/core/lib/support/log_windows.cc', 'src/core/lib/support/mpscq.cc', 'src/core/lib/support/murmur_hash.cc', + 'src/core/lib/support/reference_counted.cc', 'src/core/lib/support/stack_lockfree.cc', 'src/core/lib/support/string.cc', 'src/core/lib/support/string_posix.cc', @@ -712,11 +715,13 @@ Pod::Spec.new do |s| 'src/core/lib/support/atomic.h', 'src/core/lib/support/atomic_with_atm.h', 'src/core/lib/support/atomic_with_std.h', + 'src/core/lib/support/debug_location.h', 'src/core/lib/support/env.h', 'src/core/lib/support/manual_constructor.h', 'src/core/lib/support/memory.h', 'src/core/lib/support/mpscq.h', 'src/core/lib/support/murmur_hash.h', + 'src/core/lib/support/reference_counted.h', 'src/core/lib/support/spinlock.h', 'src/core/lib/support/stack_lockfree.h', 'src/core/lib/support/string.h', diff --git a/grpc.gemspec b/grpc.gemspec index 0dd7ceb3506..900f4afe7a4 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -89,11 +89,13 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/support/atomic.h ) s.files += %w( src/core/lib/support/atomic_with_atm.h ) s.files += %w( src/core/lib/support/atomic_with_std.h ) + s.files += %w( src/core/lib/support/debug_location.h ) s.files += %w( src/core/lib/support/env.h ) s.files += %w( src/core/lib/support/manual_constructor.h ) s.files += %w( src/core/lib/support/memory.h ) s.files += %w( src/core/lib/support/mpscq.h ) s.files += %w( src/core/lib/support/murmur_hash.h ) + s.files += %w( src/core/lib/support/reference_counted.h ) s.files += %w( src/core/lib/support/spinlock.h ) s.files += %w( src/core/lib/support/stack_lockfree.h ) s.files += %w( src/core/lib/support/string.h ) @@ -123,6 +125,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/support/log_windows.cc ) s.files += %w( src/core/lib/support/mpscq.cc ) s.files += %w( src/core/lib/support/murmur_hash.cc ) + s.files += %w( src/core/lib/support/reference_counted.cc ) s.files += %w( src/core/lib/support/stack_lockfree.cc ) s.files += %w( src/core/lib/support/string.cc ) s.files += %w( src/core/lib/support/string_posix.cc ) diff --git a/grpc.gyp b/grpc.gyp index fb153915ff0..0ee6529013b 100644 --- a/grpc.gyp +++ b/grpc.gyp @@ -184,6 +184,7 @@ 'src/core/lib/support/log_windows.cc', 'src/core/lib/support/mpscq.cc', 'src/core/lib/support/murmur_hash.cc', + 'src/core/lib/support/reference_counted.cc', 'src/core/lib/support/stack_lockfree.cc', 'src/core/lib/support/string.cc', 'src/core/lib/support/string_posix.cc', diff --git a/package.xml b/package.xml index 59d49dd1657..c0d9b498286 100644 --- a/package.xml +++ b/package.xml @@ -101,11 +101,13 @@ + + @@ -135,6 +137,7 @@ + diff --git a/src/core/lib/support/debug_location.h b/src/core/lib/support/debug_location.h new file mode 100644 index 00000000000..9260752d5e8 --- /dev/null +++ b/src/core/lib/support/debug_location.h @@ -0,0 +1,48 @@ +/* + * + * Copyright 2017 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPC_CORE_LIB_SUPPORT_DEBUG_LOCATION_H +#define GRPC_CORE_LIB_SUPPORT_DEBUG_LOCATION_H + +namespace grpc_core { + +#ifndef NDEBUG +class DebugLocation { + public: + DebugLocation(const char* file, int line) : file_(file), line_(line) {} + bool Log() const { return true; } + const char* file() const { return file_; } + int line() const { return line_; } + private: + const char* file_; + const int line_; +}; +#define DEBUG_LOCATION DebugLocation(__FILE__, __LINE__) +#else +class DebugLocation { + public: + bool Log() const { return false; } + const char* file() const { return nullptr; } + int line() const { return -1; } +}; +#define DEBUG_LOCATION DebugLocation() +#endif + +} // namespace grpc_core + +#endif // GRPC_CORE_LIB_SUPPORT_DEBUG_LOCATION_H diff --git a/src/core/lib/support/reference_counted.cc b/src/core/lib/support/reference_counted.cc new file mode 100644 index 00000000000..853a29da2f3 --- /dev/null +++ b/src/core/lib/support/reference_counted.cc @@ -0,0 +1,58 @@ +/* + * + * Copyright 2017 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "src/core/lib/support/reference_counted.h" + +#include + +namespace grpc_core { + +void ReferenceCounted::Ref(const DebugLocation& location, const char* reason) { + if (location.Log() && trace_flag_ != nullptr && trace_flag_->enabled()) { + gpr_atm old_refs = gpr_atm_no_barrier_load(&refs_.count); + gpr_log(GPR_DEBUG, "%s:%p %s:%d ref %" PRIdPTR " -> %" PRIdPTR " %s", + trace_flag_->name(), this, location.file(), location.line(), + old_refs, old_refs + 1, reason); + } + Ref(); +} + +void ReferenceCounted::Ref() { + gpr_ref(&refs_); +} + +bool ReferenceCounted::Unref(const DebugLocation& location, + const char* reason) { + if (location.Log() && trace_flag_ != nullptr && trace_flag_->enabled()) { + gpr_atm old_refs = gpr_atm_no_barrier_load(&refs_.count); + gpr_log(GPR_DEBUG, "%s:%p %s:%d unref %" PRIdPTR " -> %" PRIdPTR " %s", + trace_flag_->name(), this, location.file(), location.line(), + old_refs, old_refs - 1, reason); + } + return Unref(); +} + +bool ReferenceCounted::Unref() { + if (gpr_unref(&refs_)) { + delete this; + return true; + } + return false; +} + +} // namespace grpc_core diff --git a/src/core/lib/support/reference_counted.h b/src/core/lib/support/reference_counted.h new file mode 100644 index 00000000000..ebd620c5536 --- /dev/null +++ b/src/core/lib/support/reference_counted.h @@ -0,0 +1,55 @@ +/* + * + * Copyright 2017 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPC_CORE_LIB_SUPPORT_REFERENCE_COUNTED_H +#define GRPC_CORE_LIB_SUPPORT_REFERENCE_COUNTED_H + +#include + +#include "src/core/lib/debug/trace.h" +#include "src/core/lib/support/debug_location.h" + +namespace grpc_core { + +class ReferenceCounted { + public: + void Ref(); + void Ref(const DebugLocation& location, const char* reason); + + bool Unref(); + bool Unref(const DebugLocation& location, const char* reason); + + // Not copyable nor movable. + ReferenceCounted(const ReferenceCounted&) = delete; + ReferenceCounted& operator=(const ReferenceCounted&) = delete; + + protected: + explicit ReferenceCounted(TraceFlag* trace_flag) : trace_flag_(trace_flag) { + gpr_ref_init(&refs_, 1); + } + + virtual ~ReferenceCounted() {} + + private: + TraceFlag* trace_flag_; + gpr_refcount refs_; +}; + +} // namespace grpc_core + +#endif // GRPC_CORE_LIB_SUPPORT_REFERENCE_COUNTED_H diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 330c4185c61..38f2a401330 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -38,6 +38,7 @@ CORE_SOURCE_FILES = [ 'src/core/lib/support/log_windows.cc', 'src/core/lib/support/mpscq.cc', 'src/core/lib/support/murmur_hash.cc', + 'src/core/lib/support/reference_counted.cc', 'src/core/lib/support/stack_lockfree.cc', 'src/core/lib/support/string.cc', 'src/core/lib/support/string_posix.cc', diff --git a/test/core/support/BUILD b/test/core/support/BUILD index 69512cd9a92..ee20ef86925 100644 --- a/test/core/support/BUILD +++ b/test/core/support/BUILD @@ -233,3 +233,16 @@ grpc_cc_test( "gtest", ], ) + +grpc_cc_test( + name = "reference_counted_test", + srcs = ["reference_counted_test.cc"], + language = "C++", + deps = [ + "//:reference_counted", + "//test/core/util:gpr_test_util", + ], + external_deps = [ + "gtest", + ], +) diff --git a/test/core/support/reference_counted_test.cc b/test/core/support/reference_counted_test.cc new file mode 100644 index 00000000000..119fc1b6002 --- /dev/null +++ b/test/core/support/reference_counted_test.cc @@ -0,0 +1,60 @@ +/* + * + * Copyright 2017 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "src/core/lib/support/reference_counted.h" +#include +#include "test/core/util/test_config.h" + +namespace grpc_core { +namespace testing { + +class Foo : public ReferenceCounted { + public: + Foo() : ReferenceCounted(nullptr) {} +}; + +TEST(ReferenceCounted, StackAllocated) { + Foo foo; +} + +TEST(ReferenceCounted, StackAllocatedWithExtraRef) { + Foo foo; + foo.Ref(); + foo.Unref(); +} + +TEST(ReferenceCounted, HeapAllocated) { + Foo* foo = new Foo(); + foo->Unref(); +} + +TEST(ReferenceCounted, HeapAllocatedWithExtraRef) { + Foo* foo = new Foo(); + foo->Ref(); + foo->Unref(); + foo->Unref(); +} + +} // namespace testing +} // namespace grpc_core + +int main(int argc, char** argv) { + grpc_test_init(argc, argv); + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 3c564e203af..1d84dcba336 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -1031,11 +1031,13 @@ src/core/lib/support/arena.h \ src/core/lib/support/atomic.h \ src/core/lib/support/atomic_with_atm.h \ src/core/lib/support/atomic_with_std.h \ +src/core/lib/support/debug_location.h \ src/core/lib/support/env.h \ src/core/lib/support/manual_constructor.h \ src/core/lib/support/memory.h \ src/core/lib/support/mpscq.h \ src/core/lib/support/murmur_hash.h \ +src/core/lib/support/reference_counted.h \ src/core/lib/support/spinlock.h \ src/core/lib/support/stack_lockfree.h \ src/core/lib/support/string.h \ diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 5674124f446..5b289e7bc4d 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -1281,6 +1281,7 @@ src/core/lib/support/cpu_iphone.cc \ src/core/lib/support/cpu_linux.cc \ src/core/lib/support/cpu_posix.cc \ src/core/lib/support/cpu_windows.cc \ +src/core/lib/support/debug_location.h \ src/core/lib/support/env.h \ src/core/lib/support/env_linux.cc \ src/core/lib/support/env_posix.cc \ @@ -1298,6 +1299,8 @@ src/core/lib/support/mpscq.cc \ src/core/lib/support/mpscq.h \ src/core/lib/support/murmur_hash.cc \ src/core/lib/support/murmur_hash.h \ +src/core/lib/support/reference_counted.cc \ +src/core/lib/support/reference_counted.h \ src/core/lib/support/spinlock.h \ src/core/lib/support/stack_lockfree.cc \ src/core/lib/support/stack_lockfree.h \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 5a3429c81f5..8ec96198748 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -3917,6 +3917,25 @@ "third_party": false, "type": "target" }, + { + "deps": [ + "gpr", + "gpr_test_util", + "grpc", + "grpc++", + "grpc++_test", + "grpc_test_util" + ], + "headers": [], + "is_filegroup": false, + "language": "c++", + "name": "reference_counted_test", + "src": [ + "test/core/support/reference_counted_test.cc" + ], + "third_party": false, + "type": "target" + }, { "deps": [ "gpr", @@ -7770,6 +7789,7 @@ "src/core/lib/support/log_windows.cc", "src/core/lib/support/mpscq.cc", "src/core/lib/support/murmur_hash.cc", + "src/core/lib/support/reference_counted.cc", "src/core/lib/support/stack_lockfree.cc", "src/core/lib/support/string.cc", "src/core/lib/support/string_posix.cc", @@ -7834,11 +7854,13 @@ "src/core/lib/support/atomic.h", "src/core/lib/support/atomic_with_atm.h", "src/core/lib/support/atomic_with_std.h", + "src/core/lib/support/debug_location.h", "src/core/lib/support/env.h", "src/core/lib/support/manual_constructor.h", "src/core/lib/support/memory.h", "src/core/lib/support/mpscq.h", "src/core/lib/support/murmur_hash.h", + "src/core/lib/support/reference_counted.h", "src/core/lib/support/spinlock.h", "src/core/lib/support/stack_lockfree.h", "src/core/lib/support/string.h", @@ -7883,11 +7905,13 @@ "src/core/lib/support/atomic.h", "src/core/lib/support/atomic_with_atm.h", "src/core/lib/support/atomic_with_std.h", + "src/core/lib/support/debug_location.h", "src/core/lib/support/env.h", "src/core/lib/support/manual_constructor.h", "src/core/lib/support/memory.h", "src/core/lib/support/mpscq.h", "src/core/lib/support/murmur_hash.h", + "src/core/lib/support/reference_counted.h", "src/core/lib/support/spinlock.h", "src/core/lib/support/stack_lockfree.h", "src/core/lib/support/string.h", diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index dfd7bfafe6a..a6b58d8ba65 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -4123,6 +4123,30 @@ ], "uses_polling": true }, + { + "args": [], + "benchmark": false, + "ci_platforms": [ + "linux", + "mac", + "posix", + "windows" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "gtest": true, + "language": "c++", + "name": "reference_counted_test", + "platforms": [ + "linux", + "mac", + "posix", + "windows" + ], + "uses_polling": true + }, { "args": [], "benchmark": false, From 53bbde3c490a6dda7d80aad329df739efb5f1cf5 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 28 Nov 2017 10:27:54 +0100 Subject: [PATCH 46/86] address comments --- src/csharp/Grpc.Core/Internal/DefaultObjectPool.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/csharp/Grpc.Core/Internal/DefaultObjectPool.cs b/src/csharp/Grpc.Core/Internal/DefaultObjectPool.cs index 37c9ae06feb..2f030f3e026 100644 --- a/src/csharp/Grpc.Core/Internal/DefaultObjectPool.cs +++ b/src/csharp/Grpc.Core/Internal/DefaultObjectPool.cs @@ -59,7 +59,7 @@ namespace Grpc.Core.Internal this.sharedCapacity = sharedCapacity; this.threadLocalData = new ThreadLocal(() => new ThreadLocalData(threadLocalCapacity), false); this.threadLocalCapacity = threadLocalCapacity; - this.rentLimit = threadLocalCapacity / 2; + this.rentLimit = threadLocalCapacity != 1 ? threadLocalCapacity / 2 : 1; } /// @@ -104,7 +104,7 @@ namespace Grpc.Core.Internal // next time we try to lease we will just create those // instead of trying to grab them from the shared queue. // This is to guarantee we won't be accessing the shared queue too often. - localData.CreateBudget += rentLimit - itemsMoved; + localData.CreateBudget = rentLimit - itemsMoved; return leasedItem ?? itemFactory(); } @@ -156,7 +156,7 @@ namespace Grpc.Core.Internal // next time we try to return we will just dispose the item // instead of trying to return them to the shared queue. // This is to guarantee we won't be accessing the shared queue too often. - localData.DisposeBudget += returnLimit - itemsReturned; + localData.DisposeBudget = returnLimit - itemsReturned; if (itemsReturned == 0) { From abadc6c5168f9429173751f1fb4ed225942d6f8c Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Tue, 28 Nov 2017 08:24:10 -0800 Subject: [PATCH 47/86] Use New() and Delete() instead of C++ new and delete. --- src/core/lib/support/reference_counted.cc | 4 +++- src/core/lib/support/reference_counted.h | 4 ++++ test/core/support/reference_counted_test.cc | 7 +++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/core/lib/support/reference_counted.cc b/src/core/lib/support/reference_counted.cc index 853a29da2f3..84ede18efe4 100644 --- a/src/core/lib/support/reference_counted.cc +++ b/src/core/lib/support/reference_counted.cc @@ -20,6 +20,8 @@ #include +#include "src/core/lib/support/memory.h" + namespace grpc_core { void ReferenceCounted::Ref(const DebugLocation& location, const char* reason) { @@ -49,7 +51,7 @@ bool ReferenceCounted::Unref(const DebugLocation& location, bool ReferenceCounted::Unref() { if (gpr_unref(&refs_)) { - delete this; + Delete(this); return true; } return false; diff --git a/src/core/lib/support/reference_counted.h b/src/core/lib/support/reference_counted.h index ebd620c5536..e71b4fc5931 100644 --- a/src/core/lib/support/reference_counted.h +++ b/src/core/lib/support/reference_counted.h @@ -39,6 +39,10 @@ class ReferenceCounted { ReferenceCounted& operator=(const ReferenceCounted&) = delete; protected: + // Allow Delete() to access destructor. + template + friend void Delete(T*); + explicit ReferenceCounted(TraceFlag* trace_flag) : trace_flag_(trace_flag) { gpr_ref_init(&refs_, 1); } diff --git a/test/core/support/reference_counted_test.cc b/test/core/support/reference_counted_test.cc index 119fc1b6002..6613f06585c 100644 --- a/test/core/support/reference_counted_test.cc +++ b/test/core/support/reference_counted_test.cc @@ -17,7 +17,10 @@ */ #include "src/core/lib/support/reference_counted.h" + #include + +#include "src/core/lib/support/memory.h" #include "test/core/util/test_config.h" namespace grpc_core { @@ -39,12 +42,12 @@ TEST(ReferenceCounted, StackAllocatedWithExtraRef) { } TEST(ReferenceCounted, HeapAllocated) { - Foo* foo = new Foo(); + Foo* foo = New(); foo->Unref(); } TEST(ReferenceCounted, HeapAllocatedWithExtraRef) { - Foo* foo = new Foo(); + Foo* foo = New(); foo->Ref(); foo->Unref(); foo->Unref(); From cf9ca843eb3dec132195e8a8b21f33a7525d2197 Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Tue, 28 Nov 2017 08:24:35 -0800 Subject: [PATCH 48/86] Add ReferenceCountedPtr class. --- BUILD | 6 + CMakeLists.txt | 41 ++++++ Makefile | 48 +++++++ build.yaml | 15 ++ gRPC-Core.podspec | 2 + grpc.gemspec | 1 + package.xml | 1 + src/core/lib/support/reference_counted_ptr.h | 81 +++++++++++ test/core/support/BUILD | 14 ++ .../support/reference_counted_ptr_test.cc | 135 ++++++++++++++++++ tools/doxygen/Doxyfile.c++.internal | 1 + tools/doxygen/Doxyfile.core.internal | 1 + .../generated/sources_and_headers.json | 21 +++ tools/run_tests/generated/tests.json | 24 ++++ 14 files changed, 391 insertions(+) create mode 100644 src/core/lib/support/reference_counted_ptr.h create mode 100644 test/core/support/reference_counted_ptr_test.cc diff --git a/BUILD b/BUILD index 5289023ef5a..9c93a5c0990 100644 --- a/BUILD +++ b/BUILD @@ -554,6 +554,12 @@ grpc_cc_library( ], ) +grpc_cc_library( + name = "reference_counted_ptr", + public_hdrs = ["src/core/lib/support/reference_counted_ptr.h"], + language = "c++", +) + grpc_cc_library( name = "grpc_base_c", srcs = [ diff --git a/CMakeLists.txt b/CMakeLists.txt index ca59c84e500..7e18465c926 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -739,6 +739,7 @@ endif() add_dependencies(buildtests_cxx qps_worker) add_dependencies(buildtests_cxx reconnect_interop_client) add_dependencies(buildtests_cxx reconnect_interop_server) +add_dependencies(buildtests_cxx reference_counted_ptr_test) add_dependencies(buildtests_cxx reference_counted_test) add_dependencies(buildtests_cxx secure_auth_context_test) if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) @@ -12262,6 +12263,46 @@ target_link_libraries(reconnect_interop_server endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) +add_executable(reference_counted_ptr_test + test/core/support/reference_counted_ptr_test.cc + third_party/googletest/googletest/src/gtest-all.cc + third_party/googletest/googlemock/src/gmock-all.cc +) + + +target_include_directories(reference_counted_ptr_test + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include + PRIVATE ${BORINGSSL_ROOT_DIR}/include + PRIVATE ${PROTOBUF_ROOT_DIR}/src + PRIVATE ${BENCHMARK_ROOT_DIR}/include + PRIVATE ${ZLIB_ROOT_DIR} + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib + PRIVATE ${CARES_INCLUDE_DIR} + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/third_party/abseil-cpp + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest + PRIVATE third_party/googletest/googlemock/include + PRIVATE third_party/googletest/googlemock + PRIVATE ${_gRPC_PROTO_GENS_DIR} +) + +target_link_libraries(reference_counted_ptr_test + ${_gRPC_PROTOBUF_LIBRARIES} + ${_gRPC_ALLTARGETS_LIBRARIES} + grpc_test_util + grpc++ + grpc + gpr_test_util + gpr + ${_gRPC_GFLAGS_LIBRARIES} +) + +endif (gRPC_BUILD_TESTS) +if (gRPC_BUILD_TESTS) + add_executable(reference_counted_test test/core/support/reference_counted_test.cc third_party/googletest/googletest/src/gtest-all.cc diff --git a/Makefile b/Makefile index 0e8437a05cd..848182d1bd1 100644 --- a/Makefile +++ b/Makefile @@ -1165,6 +1165,7 @@ qps_openloop_test: $(BINDIR)/$(CONFIG)/qps_openloop_test qps_worker: $(BINDIR)/$(CONFIG)/qps_worker reconnect_interop_client: $(BINDIR)/$(CONFIG)/reconnect_interop_client reconnect_interop_server: $(BINDIR)/$(CONFIG)/reconnect_interop_server +reference_counted_ptr_test: $(BINDIR)/$(CONFIG)/reference_counted_ptr_test reference_counted_test: $(BINDIR)/$(CONFIG)/reference_counted_test secure_auth_context_test: $(BINDIR)/$(CONFIG)/secure_auth_context_test secure_sync_unary_ping_pong_test: $(BINDIR)/$(CONFIG)/secure_sync_unary_ping_pong_test @@ -1602,6 +1603,7 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/qps_worker \ $(BINDIR)/$(CONFIG)/reconnect_interop_client \ $(BINDIR)/$(CONFIG)/reconnect_interop_server \ + $(BINDIR)/$(CONFIG)/reference_counted_ptr_test \ $(BINDIR)/$(CONFIG)/reference_counted_test \ $(BINDIR)/$(CONFIG)/secure_auth_context_test \ $(BINDIR)/$(CONFIG)/secure_sync_unary_ping_pong_test \ @@ -1729,6 +1731,7 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/qps_worker \ $(BINDIR)/$(CONFIG)/reconnect_interop_client \ $(BINDIR)/$(CONFIG)/reconnect_interop_server \ + $(BINDIR)/$(CONFIG)/reference_counted_ptr_test \ $(BINDIR)/$(CONFIG)/reference_counted_test \ $(BINDIR)/$(CONFIG)/secure_auth_context_test \ $(BINDIR)/$(CONFIG)/secure_sync_unary_ping_pong_test \ @@ -2133,6 +2136,8 @@ test_cxx: buildtests_cxx $(Q) $(BINDIR)/$(CONFIG)/proto_utils_test || ( echo test proto_utils_test failed ; exit 1 ) $(E) "[RUN] Testing qps_openloop_test" $(Q) $(BINDIR)/$(CONFIG)/qps_openloop_test || ( echo test qps_openloop_test failed ; exit 1 ) + $(E) "[RUN] Testing reference_counted_ptr_test" + $(Q) $(BINDIR)/$(CONFIG)/reference_counted_ptr_test || ( echo test reference_counted_ptr_test failed ; exit 1 ) $(E) "[RUN] Testing reference_counted_test" $(Q) $(BINDIR)/$(CONFIG)/reference_counted_test || ( echo test reference_counted_test failed ; exit 1 ) $(E) "[RUN] Testing secure_auth_context_test" @@ -16501,6 +16506,49 @@ endif $(OBJDIR)/$(CONFIG)/test/cpp/interop/reconnect_interop_server.o: $(GENDIR)/src/proto/grpc/testing/empty.pb.cc $(GENDIR)/src/proto/grpc/testing/empty.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/test.pb.cc $(GENDIR)/src/proto/grpc/testing/test.grpc.pb.cc +REFERENCE_COUNTED_PTR_TEST_SRC = \ + test/core/support/reference_counted_ptr_test.cc \ + +REFERENCE_COUNTED_PTR_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(REFERENCE_COUNTED_PTR_TEST_SRC)))) +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL. + +$(BINDIR)/$(CONFIG)/reference_counted_ptr_test: openssl_dep_error + +else + + + + +ifeq ($(NO_PROTOBUF),true) + +# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. + +$(BINDIR)/$(CONFIG)/reference_counted_ptr_test: protobuf_dep_error + +else + +$(BINDIR)/$(CONFIG)/reference_counted_ptr_test: $(PROTOBUF_DEP) $(REFERENCE_COUNTED_PTR_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LDXX) $(LDFLAGS) $(REFERENCE_COUNTED_PTR_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/reference_counted_ptr_test + +endif + +endif + +$(OBJDIR)/$(CONFIG)/test/core/support/reference_counted_ptr_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + +deps_reference_counted_ptr_test: $(REFERENCE_COUNTED_PTR_TEST_OBJS:.o=.dep) + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(REFERENCE_COUNTED_PTR_TEST_OBJS:.o=.dep) +endif +endif + + REFERENCE_COUNTED_TEST_SRC = \ test/core/support/reference_counted_test.cc \ diff --git a/build.yaml b/build.yaml index 2903b866dcf..9ac86eb430b 100644 --- a/build.yaml +++ b/build.yaml @@ -117,6 +117,7 @@ filegroups: - src/core/lib/support/mpscq.h - src/core/lib/support/murmur_hash.h - src/core/lib/support/reference_counted.h + - src/core/lib/support/reference_counted_ptr.h - src/core/lib/support/spinlock.h - src/core/lib/support/stack_lockfree.h - src/core/lib/support/string.h @@ -4544,6 +4545,20 @@ targets: - gpr_test_util - gpr - grpc++_test_config +- name: reference_counted_ptr_test + gtest: true + build: test + language: c++ + src: + - test/core/support/reference_counted_ptr_test.cc + deps: + - grpc_test_util + - grpc++ + - grpc + - gpr_test_util + - gpr + uses: + - grpc++_test - name: reference_counted_test gtest: true build: test diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 71e13633ae8..f623f26831e 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -199,6 +199,7 @@ Pod::Spec.new do |s| 'src/core/lib/support/mpscq.h', 'src/core/lib/support/murmur_hash.h', 'src/core/lib/support/reference_counted.h', + 'src/core/lib/support/reference_counted_ptr.h', 'src/core/lib/support/spinlock.h', 'src/core/lib/support/stack_lockfree.h', 'src/core/lib/support/string.h', @@ -722,6 +723,7 @@ Pod::Spec.new do |s| 'src/core/lib/support/mpscq.h', 'src/core/lib/support/murmur_hash.h', 'src/core/lib/support/reference_counted.h', + 'src/core/lib/support/reference_counted_ptr.h', 'src/core/lib/support/spinlock.h', 'src/core/lib/support/stack_lockfree.h', 'src/core/lib/support/string.h', diff --git a/grpc.gemspec b/grpc.gemspec index 900f4afe7a4..da1b6c0aeff 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -96,6 +96,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/support/mpscq.h ) s.files += %w( src/core/lib/support/murmur_hash.h ) s.files += %w( src/core/lib/support/reference_counted.h ) + s.files += %w( src/core/lib/support/reference_counted_ptr.h ) s.files += %w( src/core/lib/support/spinlock.h ) s.files += %w( src/core/lib/support/stack_lockfree.h ) s.files += %w( src/core/lib/support/string.h ) diff --git a/package.xml b/package.xml index c0d9b498286..92eab40b87b 100644 --- a/package.xml +++ b/package.xml @@ -108,6 +108,7 @@ + diff --git a/src/core/lib/support/reference_counted_ptr.h b/src/core/lib/support/reference_counted_ptr.h new file mode 100644 index 00000000000..48a763ebe0f --- /dev/null +++ b/src/core/lib/support/reference_counted_ptr.h @@ -0,0 +1,81 @@ +/* + * + * Copyright 2017 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPC_CORE_LIB_SUPPORT_REFERENCE_COUNTED_PTR_H +#define GRPC_CORE_LIB_SUPPORT_REFERENCE_COUNTED_PTR_H + +namespace grpc_core { + +// A smart pointer class for objects that provide Ref() and Unref() methods, +// such as those provided by the ReferenceCounted base class. +template +class ReferenceCountedPtr { + public: + ReferenceCountedPtr() {} + + // If value is non-null, we take ownership of a ref to it. + explicit ReferenceCountedPtr(T* value) { + value_ = value; + } + + // Move support. + ReferenceCountedPtr(ReferenceCountedPtr&& other) { + value_ = other.value_; + other.value_ = nullptr; + } + ReferenceCountedPtr& operator=(ReferenceCountedPtr&& other) { + if (value_ != nullptr) value_->Unref(); + value_ = other.value_; + other.value_ = nullptr; + return *this; + } + + // Copy support. + ReferenceCountedPtr(const ReferenceCountedPtr& other) { + if (other.value_ != nullptr) other.value_->Ref(); + value_ = other.value_; + } + ReferenceCountedPtr& operator=(const ReferenceCountedPtr& other) { + if (value_ != nullptr) value_->Unref(); + if (other.value_ != nullptr) other.value_->Ref(); + value_ = other.value_; + return *this; + } + + ~ReferenceCountedPtr() { + if (value_ != nullptr) value_->Unref(); + } + + // If value is non-null, we take ownership of a ref to it. + void reset(T* value = nullptr) { + if (value_ != nullptr) value_->Unref(); + value_ = value; + } + + T* get() const { return value_; } + + T& operator*() const { return *value_; } + T* operator->() const { return value_; } + + private: + T* value_ = nullptr; +}; + +} // namespace grpc_core + +#endif // GRPC_CORE_LIB_SUPPORT_REFERENCE_COUNTED_PTR_H diff --git a/test/core/support/BUILD b/test/core/support/BUILD index ee20ef86925..1a8d2a13592 100644 --- a/test/core/support/BUILD +++ b/test/core/support/BUILD @@ -246,3 +246,17 @@ grpc_cc_test( "gtest", ], ) + +grpc_cc_test( + name = "reference_counted_ptr_test", + srcs = ["reference_counted_ptr_test.cc"], + language = "C++", + deps = [ + "//:reference_counted", + "//:reference_counted_ptr", + "//test/core/util:gpr_test_util", + ], + external_deps = [ + "gtest", + ], +) diff --git a/test/core/support/reference_counted_ptr_test.cc b/test/core/support/reference_counted_ptr_test.cc new file mode 100644 index 00000000000..7347ef5e4b8 --- /dev/null +++ b/test/core/support/reference_counted_ptr_test.cc @@ -0,0 +1,135 @@ +/* + * + * Copyright 2017 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "src/core/lib/support/reference_counted_ptr.h" + +#include + +#include + +#include "src/core/lib/support/memory.h" +#include "src/core/lib/support/reference_counted.h" +#include "test/core/util/test_config.h" + +namespace grpc_core { +namespace testing { + +class Foo : public ReferenceCounted { + public: + Foo() : ReferenceCounted(nullptr) {} + + void log() { + gpr_log(GPR_INFO, "==> log()"); + } +}; + +TEST(ReferenceCountedPtr, DefaultConstructor) { + ReferenceCountedPtr foo; +} + +TEST(ReferenceCountedPtr, ExplicitConstructorEmpty) { + ReferenceCountedPtr foo(nullptr); +} + +TEST(ReferenceCountedPtr, ExplicitConstructor) { + ReferenceCountedPtr foo(New()); +} + +TEST(ReferenceCountedPtr, MoveConstructor) { + ReferenceCountedPtr foo(New()); + ReferenceCountedPtr foo2(std::move(foo)); + EXPECT_EQ(nullptr, foo.get()); + EXPECT_NE(nullptr, foo2.get()); +} + +TEST(ReferenceCountedPtr, MoveAssignment) { + ReferenceCountedPtr foo(New()); + ReferenceCountedPtr foo2 = std::move(foo); + EXPECT_EQ(nullptr, foo.get()); + EXPECT_NE(nullptr, foo2.get()); +} + +TEST(ReferenceCountedPtr, CopyConstructor) { + ReferenceCountedPtr foo(New()); + ReferenceCountedPtr foo2(foo); + EXPECT_NE(nullptr, foo.get()); + EXPECT_EQ(foo.get(), foo2.get()); +} + +TEST(ReferenceCountedPtr, CopyAssignment) { + ReferenceCountedPtr foo(New()); + ReferenceCountedPtr foo2 = foo; + EXPECT_NE(nullptr, foo.get()); + EXPECT_EQ(foo.get(), foo2.get()); +} + +TEST(ReferenceCountedPtr, EnclosedScope) { + ReferenceCountedPtr foo(New()); + { + ReferenceCountedPtr foo2(std::move(foo)); + EXPECT_EQ(nullptr, foo.get()); + EXPECT_NE(nullptr, foo2.get()); + } + EXPECT_EQ(nullptr, foo.get()); +} + +TEST(ReferenceCountedPtr, ResetFromNullToNonNull) { + ReferenceCountedPtr foo; + EXPECT_EQ(nullptr, foo.get()); + foo.reset(New()); + EXPECT_NE(nullptr, foo.get()); +} + +TEST(ReferenceCountedPtr, ResetFromNonNullToNonNull) { + ReferenceCountedPtr foo(New()); + EXPECT_NE(nullptr, foo.get()); + Foo* original = foo.get(); + foo.reset(New()); + EXPECT_NE(nullptr, foo.get()); + EXPECT_NE(original, foo.get()); +} + +TEST(ReferenceCountedPtr, ResetFromNonNullToNull) { + ReferenceCountedPtr foo(New()); + EXPECT_NE(nullptr, foo.get()); + foo.reset(); + EXPECT_EQ(nullptr, foo.get()); +} + +TEST(ReferenceCountedPtr, ResetFromNullToNull) { + ReferenceCountedPtr foo; + EXPECT_EQ(nullptr, foo.get()); + foo.reset(nullptr); + EXPECT_EQ(nullptr, foo.get()); +} + +TEST(ReferenceCountedPtr, DerefernceOperators) { + ReferenceCountedPtr foo(New()); + foo->log(); + Foo& foo_ref = *foo; + foo_ref.log(); +} + +} // namespace testing +} // namespace grpc_core + +int main(int argc, char** argv) { + grpc_test_init(argc, argv); + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 1d84dcba336..078dd7bb87e 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -1038,6 +1038,7 @@ src/core/lib/support/memory.h \ src/core/lib/support/mpscq.h \ src/core/lib/support/murmur_hash.h \ src/core/lib/support/reference_counted.h \ +src/core/lib/support/reference_counted_ptr.h \ src/core/lib/support/spinlock.h \ src/core/lib/support/stack_lockfree.h \ src/core/lib/support/string.h \ diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 5b289e7bc4d..37ffff6b79d 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -1301,6 +1301,7 @@ src/core/lib/support/murmur_hash.cc \ src/core/lib/support/murmur_hash.h \ src/core/lib/support/reference_counted.cc \ src/core/lib/support/reference_counted.h \ +src/core/lib/support/reference_counted_ptr.h \ src/core/lib/support/spinlock.h \ src/core/lib/support/stack_lockfree.cc \ src/core/lib/support/stack_lockfree.h \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 8ec96198748..ed5128d9c12 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -3917,6 +3917,25 @@ "third_party": false, "type": "target" }, + { + "deps": [ + "gpr", + "gpr_test_util", + "grpc", + "grpc++", + "grpc++_test", + "grpc_test_util" + ], + "headers": [], + "is_filegroup": false, + "language": "c++", + "name": "reference_counted_ptr_test", + "src": [ + "test/core/support/reference_counted_ptr_test.cc" + ], + "third_party": false, + "type": "target" + }, { "deps": [ "gpr", @@ -7861,6 +7880,7 @@ "src/core/lib/support/mpscq.h", "src/core/lib/support/murmur_hash.h", "src/core/lib/support/reference_counted.h", + "src/core/lib/support/reference_counted_ptr.h", "src/core/lib/support/spinlock.h", "src/core/lib/support/stack_lockfree.h", "src/core/lib/support/string.h", @@ -7912,6 +7932,7 @@ "src/core/lib/support/mpscq.h", "src/core/lib/support/murmur_hash.h", "src/core/lib/support/reference_counted.h", + "src/core/lib/support/reference_counted_ptr.h", "src/core/lib/support/spinlock.h", "src/core/lib/support/stack_lockfree.h", "src/core/lib/support/string.h", diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index a6b58d8ba65..ba70d56085a 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -4123,6 +4123,30 @@ ], "uses_polling": true }, + { + "args": [], + "benchmark": false, + "ci_platforms": [ + "linux", + "mac", + "posix", + "windows" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "gtest": true, + "language": "c++", + "name": "reference_counted_ptr_test", + "platforms": [ + "linux", + "mac", + "posix", + "windows" + ], + "uses_polling": true + }, { "args": [], "benchmark": false, From 835537fbc78f083e311dfec148d2b25d74af78e8 Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Tue, 28 Nov 2017 08:31:08 -0800 Subject: [PATCH 49/86] Implement MakeReferenceCounted<> helper. --- src/core/lib/support/reference_counted_ptr.h | 9 +++++++ .../support/reference_counted_ptr_test.cc | 25 ++++++++++++++----- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/core/lib/support/reference_counted_ptr.h b/src/core/lib/support/reference_counted_ptr.h index 48a763ebe0f..71d5c36d523 100644 --- a/src/core/lib/support/reference_counted_ptr.h +++ b/src/core/lib/support/reference_counted_ptr.h @@ -19,6 +19,10 @@ #ifndef GRPC_CORE_LIB_SUPPORT_REFERENCE_COUNTED_PTR_H #define GRPC_CORE_LIB_SUPPORT_REFERENCE_COUNTED_PTR_H +#include + +#include "src/core/lib/support/memory.h" + namespace grpc_core { // A smart pointer class for objects that provide Ref() and Unref() methods, @@ -76,6 +80,11 @@ class ReferenceCountedPtr { T* value_ = nullptr; }; +template +inline ReferenceCountedPtr MakeReferenceCounted(Args&&... args) { + return ReferenceCountedPtr(New(std::forward(args)...)); +} + } // namespace grpc_core #endif // GRPC_CORE_LIB_SUPPORT_REFERENCE_COUNTED_PTR_H diff --git a/test/core/support/reference_counted_ptr_test.cc b/test/core/support/reference_counted_ptr_test.cc index 7347ef5e4b8..f491622b695 100644 --- a/test/core/support/reference_counted_ptr_test.cc +++ b/test/core/support/reference_counted_ptr_test.cc @@ -31,11 +31,14 @@ namespace testing { class Foo : public ReferenceCounted { public: - Foo() : ReferenceCounted(nullptr) {} + Foo() : ReferenceCounted(nullptr), value_(0) {} - void log() { - gpr_log(GPR_INFO, "==> log()"); - } + explicit Foo(int value) : ReferenceCounted(nullptr), value_(value) {} + + int value() const { return value_; } + + private: + int value_; }; TEST(ReferenceCountedPtr, DefaultConstructor) { @@ -120,9 +123,19 @@ TEST(ReferenceCountedPtr, ResetFromNullToNull) { TEST(ReferenceCountedPtr, DerefernceOperators) { ReferenceCountedPtr foo(New()); - foo->log(); + foo->value(); Foo& foo_ref = *foo; - foo_ref.log(); + foo_ref.value(); +} + +TEST(MakeReferenceCounted, NoArgs) { + ReferenceCountedPtr foo = MakeReferenceCounted(); + EXPECT_EQ(0, foo->value()); +} + +TEST(MakeReferenceCounted, Args) { + ReferenceCountedPtr foo = MakeReferenceCounted(3); + EXPECT_EQ(3, foo->value()); } } // namespace testing From 3228489f0ba812b4d773136ddc697fb3e6b90bf1 Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Tue, 28 Nov 2017 09:12:16 -0800 Subject: [PATCH 50/86] Fix include guard check. --- src/core/lib/support/debug_location.h | 2 +- src/core/lib/support/reference_counted.h | 2 +- src/core/lib/support/reference_counted_ptr.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/lib/support/debug_location.h b/src/core/lib/support/debug_location.h index 9260752d5e8..0095941ce3e 100644 --- a/src/core/lib/support/debug_location.h +++ b/src/core/lib/support/debug_location.h @@ -45,4 +45,4 @@ class DebugLocation { } // namespace grpc_core -#endif // GRPC_CORE_LIB_SUPPORT_DEBUG_LOCATION_H +#endif /* GRPC_CORE_LIB_SUPPORT_DEBUG_LOCATION_H */ diff --git a/src/core/lib/support/reference_counted.h b/src/core/lib/support/reference_counted.h index e71b4fc5931..0076aa562ce 100644 --- a/src/core/lib/support/reference_counted.h +++ b/src/core/lib/support/reference_counted.h @@ -56,4 +56,4 @@ class ReferenceCounted { } // namespace grpc_core -#endif // GRPC_CORE_LIB_SUPPORT_REFERENCE_COUNTED_H +#endif /* GRPC_CORE_LIB_SUPPORT_REFERENCE_COUNTED_H */ diff --git a/src/core/lib/support/reference_counted_ptr.h b/src/core/lib/support/reference_counted_ptr.h index 71d5c36d523..e4599a59659 100644 --- a/src/core/lib/support/reference_counted_ptr.h +++ b/src/core/lib/support/reference_counted_ptr.h @@ -87,4 +87,4 @@ inline ReferenceCountedPtr MakeReferenceCounted(Args&&... args) { } // namespace grpc_core -#endif // GRPC_CORE_LIB_SUPPORT_REFERENCE_COUNTED_PTR_H +#endif /* GRPC_CORE_LIB_SUPPORT_REFERENCE_COUNTED_PTR_H */ From d3984c32c8e773a4d6caf6e3eb5536cbd7cddf17 Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Tue, 28 Nov 2017 09:13:27 -0800 Subject: [PATCH 51/86] clang-format --- src/core/lib/support/debug_location.h | 1 + src/core/lib/support/reference_counted.cc | 4 +--- src/core/lib/support/reference_counted.h | 2 +- src/core/lib/support/reference_counted_ptr.h | 8 +++----- test/core/support/reference_counted_ptr_test.cc | 4 +--- test/core/support/reference_counted_test.cc | 4 +--- 6 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/core/lib/support/debug_location.h b/src/core/lib/support/debug_location.h index 0095941ce3e..47c5082874c 100644 --- a/src/core/lib/support/debug_location.h +++ b/src/core/lib/support/debug_location.h @@ -28,6 +28,7 @@ class DebugLocation { bool Log() const { return true; } const char* file() const { return file_; } int line() const { return line_; } + private: const char* file_; const int line_; diff --git a/src/core/lib/support/reference_counted.cc b/src/core/lib/support/reference_counted.cc index 84ede18efe4..222628a6fab 100644 --- a/src/core/lib/support/reference_counted.cc +++ b/src/core/lib/support/reference_counted.cc @@ -34,9 +34,7 @@ void ReferenceCounted::Ref(const DebugLocation& location, const char* reason) { Ref(); } -void ReferenceCounted::Ref() { - gpr_ref(&refs_); -} +void ReferenceCounted::Ref() { gpr_ref(&refs_); } bool ReferenceCounted::Unref(const DebugLocation& location, const char* reason) { diff --git a/src/core/lib/support/reference_counted.h b/src/core/lib/support/reference_counted.h index 0076aa562ce..42bedcbd3ad 100644 --- a/src/core/lib/support/reference_counted.h +++ b/src/core/lib/support/reference_counted.h @@ -40,7 +40,7 @@ class ReferenceCounted { protected: // Allow Delete() to access destructor. - template + template friend void Delete(T*); explicit ReferenceCounted(TraceFlag* trace_flag) : trace_flag_(trace_flag) { diff --git a/src/core/lib/support/reference_counted_ptr.h b/src/core/lib/support/reference_counted_ptr.h index e4599a59659..37823809431 100644 --- a/src/core/lib/support/reference_counted_ptr.h +++ b/src/core/lib/support/reference_counted_ptr.h @@ -27,15 +27,13 @@ namespace grpc_core { // A smart pointer class for objects that provide Ref() and Unref() methods, // such as those provided by the ReferenceCounted base class. -template +template class ReferenceCountedPtr { public: ReferenceCountedPtr() {} // If value is non-null, we take ownership of a ref to it. - explicit ReferenceCountedPtr(T* value) { - value_ = value; - } + explicit ReferenceCountedPtr(T* value) { value_ = value; } // Move support. ReferenceCountedPtr(ReferenceCountedPtr&& other) { @@ -80,7 +78,7 @@ class ReferenceCountedPtr { T* value_ = nullptr; }; -template +template inline ReferenceCountedPtr MakeReferenceCounted(Args&&... args) { return ReferenceCountedPtr(New(std::forward(args)...)); } diff --git a/test/core/support/reference_counted_ptr_test.cc b/test/core/support/reference_counted_ptr_test.cc index f491622b695..942c7247245 100644 --- a/test/core/support/reference_counted_ptr_test.cc +++ b/test/core/support/reference_counted_ptr_test.cc @@ -41,9 +41,7 @@ class Foo : public ReferenceCounted { int value_; }; -TEST(ReferenceCountedPtr, DefaultConstructor) { - ReferenceCountedPtr foo; -} +TEST(ReferenceCountedPtr, DefaultConstructor) { ReferenceCountedPtr foo; } TEST(ReferenceCountedPtr, ExplicitConstructorEmpty) { ReferenceCountedPtr foo(nullptr); diff --git a/test/core/support/reference_counted_test.cc b/test/core/support/reference_counted_test.cc index 6613f06585c..c5795429c40 100644 --- a/test/core/support/reference_counted_test.cc +++ b/test/core/support/reference_counted_test.cc @@ -31,9 +31,7 @@ class Foo : public ReferenceCounted { Foo() : ReferenceCounted(nullptr) {} }; -TEST(ReferenceCounted, StackAllocated) { - Foo foo; -} +TEST(ReferenceCounted, StackAllocated) { Foo foo; } TEST(ReferenceCounted, StackAllocatedWithExtraRef) { Foo foo; From 0c81dc40de575804b73ab739c6beb9815121d3b0 Mon Sep 17 00:00:00 2001 From: ncteisen Date: Tue, 28 Nov 2017 11:41:12 -0800 Subject: [PATCH 52/86] Remove uneeded header, fix unused warn --- test/core/end2end/data/client_certs.cc | 10 ++++------ test/core/end2end/data/server1_cert.cc | 4 +--- test/core/end2end/data/server1_key.cc | 4 +--- test/core/end2end/data/test_root_cert.cc | 4 +--- 4 files changed, 7 insertions(+), 15 deletions(-) diff --git a/test/core/end2end/data/client_certs.cc b/test/core/end2end/data/client_certs.cc index 6e61501234e..46fc13927c4 100644 --- a/test/core/end2end/data/client_certs.cc +++ b/test/core/end2end/data/client_certs.cc @@ -16,9 +16,7 @@ * */ -#include "test/core/end2end/data/ssl_test_data.h" - -const char test_self_signed_client_cert[] = { +extern const char test_self_signed_client_cert[] = { 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x43, 0x45, 0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x4d, 0x49, 0x49, 0x43, 0x6f, 0x44, 0x43, 0x43, @@ -102,7 +100,7 @@ const char test_self_signed_client_cert[] = { 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x00}; -const char test_self_signed_client_key[] = { +extern const char test_self_signed_client_key[] = { 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x20, 0x4b, 0x45, 0x59, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x4d, 0x49, 0x49, 0x43, 0x64, 0x77, 0x49, 0x42, @@ -181,7 +179,7 @@ const char test_self_signed_client_key[] = { 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x20, 0x4b, 0x45, 0x59, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x00}; -const char test_signed_client_cert[] = { +extern const char test_signed_client_cert[] = { 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x43, 0x45, 0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x4d, 0x49, 0x49, 0x43, 0x48, 0x7a, 0x43, 0x43, @@ -250,7 +248,7 @@ const char test_signed_client_cert[] = { 0x20, 0x43, 0x45, 0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x00}; -const char test_signed_client_key[] = { +extern const char test_signed_client_key[] = { 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x20, 0x4b, 0x45, 0x59, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x4d, 0x49, 0x49, 0x43, 0x65, 0x51, 0x49, 0x42, diff --git a/test/core/end2end/data/server1_cert.cc b/test/core/end2end/data/server1_cert.cc index 5e017c4da73..0943244ecc8 100644 --- a/test/core/end2end/data/server1_cert.cc +++ b/test/core/end2end/data/server1_cert.cc @@ -16,9 +16,7 @@ * */ -#include "test/core/end2end/data/ssl_test_data.h" - -const char test_server1_cert[] = { +extern const char test_server1_cert[] = { 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x43, 0x45, 0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x4d, 0x49, 0x49, 0x43, 0x6e, 0x44, 0x43, 0x43, diff --git a/test/core/end2end/data/server1_key.cc b/test/core/end2end/data/server1_key.cc index 92a77aa21f0..8f3ad15c266 100644 --- a/test/core/end2end/data/server1_key.cc +++ b/test/core/end2end/data/server1_key.cc @@ -16,9 +16,7 @@ * */ -#include "test/core/end2end/data/ssl_test_data.h" - -const char test_server1_key[] = { +extern const char test_server1_key[] = { 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x52, 0x53, 0x41, 0x20, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x20, 0x4b, 0x45, 0x59, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x4d, 0x49, 0x49, 0x43, diff --git a/test/core/end2end/data/test_root_cert.cc b/test/core/end2end/data/test_root_cert.cc index 81ca410e14c..b4771b2cb8d 100644 --- a/test/core/end2end/data/test_root_cert.cc +++ b/test/core/end2end/data/test_root_cert.cc @@ -16,9 +16,7 @@ * */ -#include "test/core/end2end/data/ssl_test_data.h" - -const char test_root_cert[] = { +extern const char test_root_cert[] = { 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x43, 0x45, 0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x4d, 0x49, 0x49, 0x43, 0x49, 0x7a, 0x43, 0x43, From fe354eb8070ccf34e88ee9e0db3853a38e2fdbcf Mon Sep 17 00:00:00 2001 From: ncteisen Date: Tue, 28 Nov 2017 12:05:14 -0800 Subject: [PATCH 53/86] Fix the fuzzers --- test/core/client_channel/uri_fuzzer_test.cc | 2 +- test/core/end2end/fuzzers/api_fuzzer.cc | 2 +- test/core/end2end/fuzzers/client_fuzzer.cc | 2 +- test/core/end2end/fuzzers/server_fuzzer.cc | 2 +- test/core/http/request_fuzzer.cc | 2 +- test/core/http/response_fuzzer.cc | 2 +- test/core/json/fuzzer.cc | 2 +- test/core/nanopb/fuzzer_response.cc | 2 +- test/core/nanopb/fuzzer_serverlist.cc | 2 +- test/core/security/ssl_server_fuzzer.cc | 2 +- test/core/slice/percent_decode_fuzzer.cc | 2 +- test/core/slice/percent_encode_fuzzer.cc | 2 +- test/core/transport/chttp2/hpack_parser_fuzzer_test.cc | 2 +- test/core/util/fuzzer_corpus_test.cc | 2 +- test/core/util/one_corpus_entry_fuzzer.cc | 2 +- 15 files changed, 15 insertions(+), 15 deletions(-) diff --git a/test/core/client_channel/uri_fuzzer_test.cc b/test/core/client_channel/uri_fuzzer_test.cc index f76c41d4372..ba31793ff3b 100644 --- a/test/core/client_channel/uri_fuzzer_test.cc +++ b/test/core/client_channel/uri_fuzzer_test.cc @@ -28,7 +28,7 @@ bool squelch = true; bool leak_check = true; -int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { char* s = static_cast(gpr_malloc(size + 1)); memcpy(s, data, size); s[size] = 0; diff --git a/test/core/end2end/fuzzers/api_fuzzer.cc b/test/core/end2end/fuzzers/api_fuzzer.cc index 39e18dd121a..0b49b89205a 100644 --- a/test/core/end2end/fuzzers/api_fuzzer.cc +++ b/test/core/end2end/fuzzers/api_fuzzer.cc @@ -740,7 +740,7 @@ static validator* make_finished_batch_validator(call_state* cs, return create_validator(finished_batch, bi); } -int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_test_only_set_slice_hash_seed(0); char* grpc_trace_fuzzer = gpr_getenv("GRPC_TRACE_FUZZER"); if (squelch && grpc_trace_fuzzer == nullptr) gpr_set_log_function(dont_log); diff --git a/test/core/end2end/fuzzers/client_fuzzer.cc b/test/core/end2end/fuzzers/client_fuzzer.cc index 89edaa5ec0f..ebc8c2780d2 100644 --- a/test/core/end2end/fuzzers/client_fuzzer.cc +++ b/test/core/end2end/fuzzers/client_fuzzer.cc @@ -37,7 +37,7 @@ static void* tag(int n) { return (void*)(uintptr_t)n; } static void dont_log(gpr_log_func_args* args) {} -int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_test_only_set_slice_hash_seed(0); struct grpc_memory_counters counters; if (squelch) gpr_set_log_function(dont_log); diff --git a/test/core/end2end/fuzzers/server_fuzzer.cc b/test/core/end2end/fuzzers/server_fuzzer.cc index b0221294dd4..fb6477b5798 100644 --- a/test/core/end2end/fuzzers/server_fuzzer.cc +++ b/test/core/end2end/fuzzers/server_fuzzer.cc @@ -35,7 +35,7 @@ static int detag(void* p) { return (int)(uintptr_t)p; } static void dont_log(gpr_log_func_args* args) {} -int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_test_only_set_slice_hash_seed(0); struct grpc_memory_counters counters; if (squelch) gpr_set_log_function(dont_log); diff --git a/test/core/http/request_fuzzer.cc b/test/core/http/request_fuzzer.cc index 73f366cd9aa..368ac1b49db 100644 --- a/test/core/http/request_fuzzer.cc +++ b/test/core/http/request_fuzzer.cc @@ -27,7 +27,7 @@ bool squelch = true; bool leak_check = true; -int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_http_parser parser; grpc_http_request request; memset(&request, 0, sizeof(request)); diff --git a/test/core/http/response_fuzzer.cc b/test/core/http/response_fuzzer.cc index 6c1fea50ae8..2a793fddd4b 100644 --- a/test/core/http/response_fuzzer.cc +++ b/test/core/http/response_fuzzer.cc @@ -26,7 +26,7 @@ bool squelch = true; bool leak_check = true; -int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_http_parser parser; grpc_http_response response; memset(&response, 0, sizeof(response)); diff --git a/test/core/json/fuzzer.cc b/test/core/json/fuzzer.cc index fd9172ffba6..6dafabb95b3 100644 --- a/test/core/json/fuzzer.cc +++ b/test/core/json/fuzzer.cc @@ -29,7 +29,7 @@ bool squelch = true; bool leak_check = true; -int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { char* s; struct grpc_memory_counters counters; grpc_memory_counters_init(); diff --git a/test/core/nanopb/fuzzer_response.cc b/test/core/nanopb/fuzzer_response.cc index 42826c18f3c..7039c801cb9 100644 --- a/test/core/nanopb/fuzzer_response.cc +++ b/test/core/nanopb/fuzzer_response.cc @@ -28,7 +28,7 @@ bool leak_check = true; static void dont_log(gpr_log_func_args* args) {} -int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { if (squelch) gpr_set_log_function(dont_log); grpc_slice slice = grpc_slice_from_copied_buffer((const char*)data, size); grpc_grpclb_initial_response* response; diff --git a/test/core/nanopb/fuzzer_serverlist.cc b/test/core/nanopb/fuzzer_serverlist.cc index 059e33d584b..0a6b1767a1a 100644 --- a/test/core/nanopb/fuzzer_serverlist.cc +++ b/test/core/nanopb/fuzzer_serverlist.cc @@ -28,7 +28,7 @@ bool leak_check = true; static void dont_log(gpr_log_func_args* args) {} -int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { if (squelch) gpr_set_log_function(dont_log); grpc_slice slice = grpc_slice_from_copied_buffer((const char*)data, size); grpc_grpclb_serverlist* serverlist; diff --git a/test/core/security/ssl_server_fuzzer.cc b/test/core/security/ssl_server_fuzzer.cc index a2d0f14de05..bbb2f6013ee 100644 --- a/test/core/security/ssl_server_fuzzer.cc +++ b/test/core/security/ssl_server_fuzzer.cc @@ -51,7 +51,7 @@ static void on_handshake_done(grpc_exec_ctx* exec_ctx, void* arg, GPR_ASSERT(error != GRPC_ERROR_NONE); } -int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { struct grpc_memory_counters counters; if (squelch) gpr_set_log_function(dont_log); if (leak_check) grpc_memory_counters_init(); diff --git a/test/core/slice/percent_decode_fuzzer.cc b/test/core/slice/percent_decode_fuzzer.cc index e6458736d39..3603177c47f 100644 --- a/test/core/slice/percent_decode_fuzzer.cc +++ b/test/core/slice/percent_decode_fuzzer.cc @@ -29,7 +29,7 @@ bool squelch = true; bool leak_check = true; -int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { struct grpc_memory_counters counters; grpc_memory_counters_init(); grpc_slice input = grpc_slice_from_copied_buffer((const char*)data, size); diff --git a/test/core/slice/percent_encode_fuzzer.cc b/test/core/slice/percent_encode_fuzzer.cc index 776a998e51c..c8e3849fc8e 100644 --- a/test/core/slice/percent_encode_fuzzer.cc +++ b/test/core/slice/percent_encode_fuzzer.cc @@ -51,7 +51,7 @@ static void test(const uint8_t* data, size_t size, const uint8_t* dict) { GPR_ASSERT(counters.total_size_relative == 0); } -int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { test(data, size, grpc_url_percent_encoding_unreserved_bytes); test(data, size, grpc_compatible_percent_encoding_unreserved_bytes); return 0; diff --git a/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc b/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc index 01230eb6759..942f25e0b75 100644 --- a/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc +++ b/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc @@ -34,7 +34,7 @@ static void onhdr(grpc_exec_ctx* exec_ctx, void* ud, grpc_mdelem md) { } static void dont_log(gpr_log_func_args* args) {} -int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_test_only_set_slice_hash_seed(0); if (squelch) gpr_set_log_function(dont_log); grpc_init(); diff --git a/test/core/util/fuzzer_corpus_test.cc b/test/core/util/fuzzer_corpus_test.cc index e2ed301c942..7849321257d 100644 --- a/test/core/util/fuzzer_corpus_test.cc +++ b/test/core/util/fuzzer_corpus_test.cc @@ -28,7 +28,7 @@ #include "src/core/lib/iomgr/load_file.h" #include "test/core/util/test_config.h" -int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size); +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size); extern bool squelch; extern bool leak_check; diff --git a/test/core/util/one_corpus_entry_fuzzer.cc b/test/core/util/one_corpus_entry_fuzzer.cc index a5512636f72..c0b67da1e26 100644 --- a/test/core/util/one_corpus_entry_fuzzer.cc +++ b/test/core/util/one_corpus_entry_fuzzer.cc @@ -21,7 +21,7 @@ #include #include "src/core/lib/iomgr/load_file.h" -int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size); +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size); extern bool squelch; extern bool leak_check; From ba5f5cedd694ce82074d972fca8f964471e25ce7 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 28 Nov 2017 14:28:43 -0800 Subject: [PATCH 54/86] ServerBuilder interface cleanup Nothing is added or removed in this PR. Instead, methods are re-ordered so that important methods are read first, and less important customization methods are seen later. The intent here is to simplify the "I just want to bring a server up" code path. --- include/grpc++/server_builder.h | 144 ++++++++++++++++++-------------- 1 file changed, 81 insertions(+), 63 deletions(-) diff --git a/include/grpc++/server_builder.h b/include/grpc++/server_builder.h index 0888bef0d95..02129b78ef6 100644 --- a/include/grpc++/server_builder.h +++ b/include/grpc++/server_builder.h @@ -55,13 +55,18 @@ class ServerBuilder { ServerBuilder(); ~ServerBuilder(); - /// Options for synchronous servers. - enum SyncServerOption { - NUM_CQS, ///< Number of completion queues. - MIN_POLLERS, ///< Minimum number of polling threads. - MAX_POLLERS, ///< Maximum number of polling threads. - CQ_TIMEOUT_MSEC ///< Completion queue timeout in milliseconds. - }; + ////////////////////////////////////////////////////////////////////////////// + // Primary API's + + /// Return a running server which is ready for processing calls. + /// Before calling, one typically needs to ensure that: + /// 1. a service is registered - so that the server knows what to serve + /// (via RegisterService, or RegisterAsyncGenericService) + /// 2. a listening port has been added - so the server knows where to receive + /// traffic (via AddListeningPort) + /// 3. [for async api only] completion queues have been added via + /// AddCompletionQueue + std::unique_ptr BuildAndStart(); /// Register a service. This call does not take ownership of the service. /// The service must exist for the lifetime of the \a Server instance returned @@ -69,9 +74,60 @@ class ServerBuilder { /// Matches requests with any :authority ServerBuilder& RegisterService(Service* service); - /// Register a generic service. - /// Matches requests with any :authority - ServerBuilder& RegisterAsyncGenericService(AsyncGenericService* service); + /// Enlists an endpoint \a addr (port with an optional IP address) to + /// bind the \a grpc::Server object to be created to. + /// + /// It can be invoked multiple times. + /// + /// \param addr_uri The address to try to bind to the server in URI form. If + /// the scheme name is omitted, "dns:///" is assumed. To bind to any address, + /// please use IPv6 any, i.e., [::]:, which also accepts IPv4 + /// connections. Valid values include dns:///localhost:1234, / + /// 192.168.1.1:31416, dns:///[::1]:27182, etc.). + /// \param creds The credentials associated with the server. + /// \param selected_port[out] If not `nullptr`, gets populated with the port + /// number bound to the \a grpc::Server for the corresponding endpoint after + /// it is successfully bound, 0 otherwise. + /// + ServerBuilder& AddListeningPort(const grpc::string& addr_uri, + std::shared_ptr creds, + int* selected_port = nullptr); + + /// Add a completion queue for handling asynchronous services. + /// + /// Best performance is typically obtained by using one thread per polling + /// completion queue. + /// + /// Caller is required to shutdown the server prior to shutting down the + /// returned completion queue. Caller is also required to drain the + /// completion queue after shutting it down. A typical usage scenario: + /// + /// // While building the server: + /// ServerBuilder builder; + /// ... + /// cq_ = builder.AddCompletionQueue(); + /// server_ = builder.BuildAndStart(); + /// + /// // While shutting down the server; + /// server_->Shutdown(); + /// cq_->Shutdown(); // Always *after* the associated server's Shutdown()! + /// // Drain the cq_ that was created + /// void* ignored_tag; + /// bool ignored_ok; + /// while (cq_->Next(&ignored_tag, &ignored_ok)) { } + /// + /// \param is_frequently_polled This is an optional parameter to inform gRPC + /// library about whether this completion queue would be frequently polled + /// (i.e. by calling \a Next() or \a AsyncNext()). The default value is + /// 'true' and is the recommended setting. Setting this to 'false' (i.e. + /// not polling the completion queue frequently) will have a significantly + /// negative performance impact and hence should not be used in production + /// use cases. + std::unique_ptr AddCompletionQueue( + bool is_frequently_polled = true); + + ////////////////////////////////////////////////////////////////////////////// + // RegisterService variants /// Register a service. This call does not take ownership of the service. /// The service must exist for the lifetime of the \a Server instance returned @@ -79,6 +135,13 @@ class ServerBuilder { /// Only matches requests with :authority \a host ServerBuilder& RegisterService(const grpc::string& host, Service* service); + /// Register a generic service. + /// Matches requests with any :authority + ServerBuilder& RegisterAsyncGenericService(AsyncGenericService* service); + + ////////////////////////////////////////////////////////////////////////////// + // Fine control knobs + /// Set max receive message size in bytes. ServerBuilder& SetMaxReceiveMessageSize(int max_receive_message_size) { max_receive_message_size_ = max_receive_message_size; @@ -119,6 +182,14 @@ class ServerBuilder { ServerBuilder& SetOption(std::unique_ptr option); + /// Options for synchronous servers. + enum SyncServerOption { + NUM_CQS, ///< Number of completion queues. + MIN_POLLERS, ///< Minimum number of polling threads. + MAX_POLLERS, ///< Maximum number of polling threads. + CQ_TIMEOUT_MSEC ///< Completion queue timeout in milliseconds. + }; + /// Only useful if this is a Synchronous server. ServerBuilder& SetSyncServerOption(SyncServerOption option, int value); @@ -129,59 +200,6 @@ class ServerBuilder { return SetOption(MakeChannelArgumentOption(arg, value)); } - /// Enlists an endpoint \a addr (port with an optional IP address) to - /// bind the \a grpc::Server object to be created to. - /// - /// It can be invoked multiple times. - /// - /// \param addr_uri The address to try to bind to the server in URI form. If - /// the scheme name is omitted, "dns:///" is assumed. To bind to any address, - /// please use IPv6 any, i.e., [::]:, which also accepts IPv4 - /// connections. Valid values include dns:///localhost:1234, / - /// 192.168.1.1:31416, dns:///[::1]:27182, etc.). - /// \param creds The credentials associated with the server. - /// \param selected_port[out] If not `nullptr`, gets populated with the port - /// number bound to the \a grpc::Server for the corresponding endpoint after - /// it is successfully bound, 0 otherwise. - /// - // TODO(dgq): the "port" part seems to be a misnomer. - ServerBuilder& AddListeningPort(const grpc::string& addr_uri, - std::shared_ptr creds, - int* selected_port = nullptr); - - /// Add a completion queue for handling asynchronous services. - /// - /// Caller is required to shutdown the server prior to shutting down the - /// returned completion queue. Caller is also required to drain the - /// completion queue after shutting it down. A typical usage scenario: - /// - /// // While building the server: - /// ServerBuilder builder; - /// ... - /// cq_ = builder.AddCompletionQueue(); - /// server_ = builder.BuildAndStart(); - /// - /// // While shutting down the server; - /// server_->Shutdown(); - /// cq_->Shutdown(); // Always *after* the associated server's Shutdown()! - /// // Drain the cq_ that was created - /// void* ignored_tag; - /// bool ignored_ok; - /// while (cq_->Next(&ignored_tag, &ignored_ok)) { } - /// - /// \param is_frequently_polled This is an optional parameter to inform gRPC - /// library about whether this completion queue would be frequently polled - /// (i.e. by calling \a Next() or \a AsyncNext()). The default value is - /// 'true' and is the recommended setting. Setting this to 'false' (i.e. - /// not polling the completion queue frequently) will have a significantly - /// negative performance impact and hence should not be used in production - /// use cases. - std::unique_ptr AddCompletionQueue( - bool is_frequently_polled = true); - - /// Return a running server which is ready for processing calls. - std::unique_ptr BuildAndStart(); - /// For internal use only: Register a ServerBuilderPlugin factory function. static void InternalAddPluginFactory( std::unique_ptr (*CreatePlugin)()); From b319f491ff63a109917d69fc5020aa5c4eb184a7 Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Tue, 28 Nov 2017 14:50:07 -0800 Subject: [PATCH 55/86] Code review changes. --- BUILD | 1 - CMakeLists.txt | 1 - Makefile | 1 - build.yaml | 1 - config.m4 | 1 - config.w32 | 1 - gRPC-Core.podspec | 1 - grpc.gemspec | 1 - grpc.gyp | 1 - package.xml | 1 - src/core/lib/support/debug_location.h | 3 + src/core/lib/support/reference_counted.cc | 58 ------------------- src/core/lib/support/reference_counted.h | 39 +++++++++++-- src/core/lib/support/reference_counted_ptr.h | 4 +- src/python/grpcio/grpc_core_dependencies.py | 1 - .../support/reference_counted_ptr_test.cc | 13 +++++ test/core/support/reference_counted_test.cc | 2 +- tools/doxygen/Doxyfile.core.internal | 1 - .../generated/sources_and_headers.json | 1 - 19 files changed, 54 insertions(+), 78 deletions(-) delete mode 100644 src/core/lib/support/reference_counted.cc diff --git a/BUILD b/BUILD index 9c93a5c0990..6ba5e6f6554 100644 --- a/BUILD +++ b/BUILD @@ -545,7 +545,6 @@ grpc_cc_library( grpc_cc_library( name = "reference_counted", - srcs = ["src/core/lib/support/reference_counted.cc"], public_hdrs = ["src/core/lib/support/reference_counted.h"], language = "c++", deps = [ diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e18465c926..7b214be4352 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -809,7 +809,6 @@ add_library(gpr src/core/lib/support/log_windows.cc src/core/lib/support/mpscq.cc src/core/lib/support/murmur_hash.cc - src/core/lib/support/reference_counted.cc src/core/lib/support/stack_lockfree.cc src/core/lib/support/string.cc src/core/lib/support/string_posix.cc diff --git a/Makefile b/Makefile index 848182d1bd1..a81e62b4409 100644 --- a/Makefile +++ b/Makefile @@ -2846,7 +2846,6 @@ LIBGPR_SRC = \ src/core/lib/support/log_windows.cc \ src/core/lib/support/mpscq.cc \ src/core/lib/support/murmur_hash.cc \ - src/core/lib/support/reference_counted.cc \ src/core/lib/support/stack_lockfree.cc \ src/core/lib/support/string.cc \ src/core/lib/support/string_posix.cc \ diff --git a/build.yaml b/build.yaml index 9ac86eb430b..57a65b37075 100644 --- a/build.yaml +++ b/build.yaml @@ -49,7 +49,6 @@ filegroups: - src/core/lib/support/log_windows.cc - src/core/lib/support/mpscq.cc - src/core/lib/support/murmur_hash.cc - - src/core/lib/support/reference_counted.cc - src/core/lib/support/stack_lockfree.cc - src/core/lib/support/string.cc - src/core/lib/support/string_posix.cc diff --git a/config.m4 b/config.m4 index 9d514c8552b..d2f2520feac 100644 --- a/config.m4 +++ b/config.m4 @@ -62,7 +62,6 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/support/log_windows.cc \ src/core/lib/support/mpscq.cc \ src/core/lib/support/murmur_hash.cc \ - src/core/lib/support/reference_counted.cc \ src/core/lib/support/stack_lockfree.cc \ src/core/lib/support/string.cc \ src/core/lib/support/string_posix.cc \ diff --git a/config.w32 b/config.w32 index 2f24fcd8b01..8a713751dcd 100644 --- a/config.w32 +++ b/config.w32 @@ -39,7 +39,6 @@ if (PHP_GRPC != "no") { "src\\core\\lib\\support\\log_windows.cc " + "src\\core\\lib\\support\\mpscq.cc " + "src\\core\\lib\\support\\murmur_hash.cc " + - "src\\core\\lib\\support\\reference_counted.cc " + "src\\core\\lib\\support\\stack_lockfree.cc " + "src\\core\\lib\\support\\string.cc " + "src\\core\\lib\\support\\string_posix.cc " + diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index f623f26831e..bc500cc0d78 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -229,7 +229,6 @@ Pod::Spec.new do |s| 'src/core/lib/support/log_windows.cc', 'src/core/lib/support/mpscq.cc', 'src/core/lib/support/murmur_hash.cc', - 'src/core/lib/support/reference_counted.cc', 'src/core/lib/support/stack_lockfree.cc', 'src/core/lib/support/string.cc', 'src/core/lib/support/string_posix.cc', diff --git a/grpc.gemspec b/grpc.gemspec index da1b6c0aeff..d1e8b5254dc 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -126,7 +126,6 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/support/log_windows.cc ) s.files += %w( src/core/lib/support/mpscq.cc ) s.files += %w( src/core/lib/support/murmur_hash.cc ) - s.files += %w( src/core/lib/support/reference_counted.cc ) s.files += %w( src/core/lib/support/stack_lockfree.cc ) s.files += %w( src/core/lib/support/string.cc ) s.files += %w( src/core/lib/support/string_posix.cc ) diff --git a/grpc.gyp b/grpc.gyp index 0ee6529013b..fb153915ff0 100644 --- a/grpc.gyp +++ b/grpc.gyp @@ -184,7 +184,6 @@ 'src/core/lib/support/log_windows.cc', 'src/core/lib/support/mpscq.cc', 'src/core/lib/support/murmur_hash.cc', - 'src/core/lib/support/reference_counted.cc', 'src/core/lib/support/stack_lockfree.cc', 'src/core/lib/support/string.cc', 'src/core/lib/support/string_posix.cc', diff --git a/package.xml b/package.xml index 92eab40b87b..6f786a13ad9 100644 --- a/package.xml +++ b/package.xml @@ -138,7 +138,6 @@ - diff --git a/src/core/lib/support/debug_location.h b/src/core/lib/support/debug_location.h index 47c5082874c..0939da595d2 100644 --- a/src/core/lib/support/debug_location.h +++ b/src/core/lib/support/debug_location.h @@ -21,6 +21,9 @@ namespace grpc_core { +// Used for tracking file and line where a call is made for debug builds. +// No-op for non-debug builds. +// Callers can use the DEBUG_LOCATION macro in either case. #ifndef NDEBUG class DebugLocation { public: diff --git a/src/core/lib/support/reference_counted.cc b/src/core/lib/support/reference_counted.cc deleted file mode 100644 index 222628a6fab..00000000000 --- a/src/core/lib/support/reference_counted.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* - * - * Copyright 2017 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include "src/core/lib/support/reference_counted.h" - -#include - -#include "src/core/lib/support/memory.h" - -namespace grpc_core { - -void ReferenceCounted::Ref(const DebugLocation& location, const char* reason) { - if (location.Log() && trace_flag_ != nullptr && trace_flag_->enabled()) { - gpr_atm old_refs = gpr_atm_no_barrier_load(&refs_.count); - gpr_log(GPR_DEBUG, "%s:%p %s:%d ref %" PRIdPTR " -> %" PRIdPTR " %s", - trace_flag_->name(), this, location.file(), location.line(), - old_refs, old_refs + 1, reason); - } - Ref(); -} - -void ReferenceCounted::Ref() { gpr_ref(&refs_); } - -bool ReferenceCounted::Unref(const DebugLocation& location, - const char* reason) { - if (location.Log() && trace_flag_ != nullptr && trace_flag_->enabled()) { - gpr_atm old_refs = gpr_atm_no_barrier_load(&refs_.count); - gpr_log(GPR_DEBUG, "%s:%p %s:%d unref %" PRIdPTR " -> %" PRIdPTR " %s", - trace_flag_->name(), this, location.file(), location.line(), - old_refs, old_refs - 1, reason); - } - return Unref(); -} - -bool ReferenceCounted::Unref() { - if (gpr_unref(&refs_)) { - Delete(this); - return true; - } - return false; -} - -} // namespace grpc_core diff --git a/src/core/lib/support/reference_counted.h b/src/core/lib/support/reference_counted.h index 42bedcbd3ad..ff74de082c7 100644 --- a/src/core/lib/support/reference_counted.h +++ b/src/core/lib/support/reference_counted.h @@ -20,19 +20,46 @@ #define GRPC_CORE_LIB_SUPPORT_REFERENCE_COUNTED_H #include +#include #include "src/core/lib/debug/trace.h" #include "src/core/lib/support/debug_location.h" +#include "src/core/lib/support/memory.h" namespace grpc_core { +// A base class for reference-counted objects. +// New objects should be created via New() and start with a refcount of 1. +// When the refcount reaches 0, the object will be deleted via Delete(). class ReferenceCounted { public: - void Ref(); - void Ref(const DebugLocation& location, const char* reason); + void Ref() { gpr_ref(&refs_); } - bool Unref(); - bool Unref(const DebugLocation& location, const char* reason); + void Ref(const DebugLocation& location, const char* reason) { + if (location.Log() && trace_flag_ != nullptr && trace_flag_->enabled()) { + gpr_atm old_refs = gpr_atm_no_barrier_load(&refs_.count); + gpr_log(GPR_DEBUG, "%s:%p %s:%d ref %" PRIdPTR " -> %" PRIdPTR " %s", + trace_flag_->name(), this, location.file(), location.line(), + old_refs, old_refs + 1, reason); + } + Ref(); + } + + void Unref() { + if (gpr_unref(&refs_)) { + Delete(this); + } + } + + void Unref(const DebugLocation& location, const char* reason) { + if (location.Log() && trace_flag_ != nullptr && trace_flag_->enabled()) { + gpr_atm old_refs = gpr_atm_no_barrier_load(&refs_.count); + gpr_log(GPR_DEBUG, "%s:%p %s:%d unref %" PRIdPTR " -> %" PRIdPTR " %s", + trace_flag_->name(), this, location.file(), location.line(), + old_refs, old_refs - 1, reason); + } + Unref(); + } // Not copyable nor movable. ReferenceCounted(const ReferenceCounted&) = delete; @@ -43,6 +70,8 @@ class ReferenceCounted { template friend void Delete(T*); + ReferenceCounted() : ReferenceCounted(nullptr) {} + explicit ReferenceCounted(TraceFlag* trace_flag) : trace_flag_(trace_flag) { gpr_ref_init(&refs_, 1); } @@ -50,7 +79,7 @@ class ReferenceCounted { virtual ~ReferenceCounted() {} private: - TraceFlag* trace_flag_; + TraceFlag* trace_flag_ = nullptr; gpr_refcount refs_; }; diff --git a/src/core/lib/support/reference_counted_ptr.h b/src/core/lib/support/reference_counted_ptr.h index 37823809431..1590549bfbb 100644 --- a/src/core/lib/support/reference_counted_ptr.h +++ b/src/core/lib/support/reference_counted_ptr.h @@ -53,8 +53,10 @@ class ReferenceCountedPtr { value_ = other.value_; } ReferenceCountedPtr& operator=(const ReferenceCountedPtr& other) { - if (value_ != nullptr) value_->Unref(); + // Note: Order of reffing and unreffing is important here in case value_ + // and other.value_ are the same object. if (other.value_ != nullptr) other.value_->Ref(); + if (value_ != nullptr) value_->Unref(); value_ = other.value_; return *this; } diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 38f2a401330..330c4185c61 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -38,7 +38,6 @@ CORE_SOURCE_FILES = [ 'src/core/lib/support/log_windows.cc', 'src/core/lib/support/mpscq.cc', 'src/core/lib/support/murmur_hash.cc', - 'src/core/lib/support/reference_counted.cc', 'src/core/lib/support/stack_lockfree.cc', 'src/core/lib/support/string.cc', 'src/core/lib/support/string_posix.cc', diff --git a/test/core/support/reference_counted_ptr_test.cc b/test/core/support/reference_counted_ptr_test.cc index 942c7247245..14dd620887c 100644 --- a/test/core/support/reference_counted_ptr_test.cc +++ b/test/core/support/reference_counted_ptr_test.cc @@ -79,6 +79,19 @@ TEST(ReferenceCountedPtr, CopyAssignment) { EXPECT_EQ(foo.get(), foo2.get()); } +TEST(ReferenceCountedPtr, CopyAssignmentWhenEmpty) { + ReferenceCountedPtr foo; + ReferenceCountedPtr foo2; + foo2 = foo; + EXPECT_EQ(nullptr, foo.get()); + EXPECT_EQ(nullptr, foo2.get()); +} + +TEST(ReferenceCountedPtr, CopyAssignmentToSelf) { + ReferenceCountedPtr foo(New()); + foo = foo; +} + TEST(ReferenceCountedPtr, EnclosedScope) { ReferenceCountedPtr foo(New()); { diff --git a/test/core/support/reference_counted_test.cc b/test/core/support/reference_counted_test.cc index c5795429c40..b1f79e61e6d 100644 --- a/test/core/support/reference_counted_test.cc +++ b/test/core/support/reference_counted_test.cc @@ -28,7 +28,7 @@ namespace testing { class Foo : public ReferenceCounted { public: - Foo() : ReferenceCounted(nullptr) {} + Foo() {} }; TEST(ReferenceCounted, StackAllocated) { Foo foo; } diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 37ffff6b79d..8343f88a374 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -1299,7 +1299,6 @@ src/core/lib/support/mpscq.cc \ src/core/lib/support/mpscq.h \ src/core/lib/support/murmur_hash.cc \ src/core/lib/support/murmur_hash.h \ -src/core/lib/support/reference_counted.cc \ src/core/lib/support/reference_counted.h \ src/core/lib/support/reference_counted_ptr.h \ src/core/lib/support/spinlock.h \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index ed5128d9c12..284a2098e3e 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -7808,7 +7808,6 @@ "src/core/lib/support/log_windows.cc", "src/core/lib/support/mpscq.cc", "src/core/lib/support/murmur_hash.cc", - "src/core/lib/support/reference_counted.cc", "src/core/lib/support/stack_lockfree.cc", "src/core/lib/support/string.cc", "src/core/lib/support/string_posix.cc", From 18d332d8ba1eb1077653ade055363081210e03a1 Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Tue, 28 Nov 2017 15:01:58 -0800 Subject: [PATCH 56/86] Remove incorrect tests for stack allocation. --- test/core/support/reference_counted_test.cc | 8 -------- 1 file changed, 8 deletions(-) diff --git a/test/core/support/reference_counted_test.cc b/test/core/support/reference_counted_test.cc index b1f79e61e6d..f6d2a2c3090 100644 --- a/test/core/support/reference_counted_test.cc +++ b/test/core/support/reference_counted_test.cc @@ -31,14 +31,6 @@ class Foo : public ReferenceCounted { Foo() {} }; -TEST(ReferenceCounted, StackAllocated) { Foo foo; } - -TEST(ReferenceCounted, StackAllocatedWithExtraRef) { - Foo foo; - foo.Ref(); - foo.Unref(); -} - TEST(ReferenceCounted, HeapAllocated) { Foo* foo = New(); foo->Unref(); From 2e1912374057355de4f4e0ceaff02c89d45f43e5 Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Tue, 28 Nov 2017 15:18:28 -0800 Subject: [PATCH 57/86] Add tests for tracing versions of Ref() and Unref(). --- test/core/support/reference_counted_test.cc | 23 +++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/test/core/support/reference_counted_test.cc b/test/core/support/reference_counted_test.cc index f6d2a2c3090..778556d999a 100644 --- a/test/core/support/reference_counted_test.cc +++ b/test/core/support/reference_counted_test.cc @@ -25,24 +25,43 @@ namespace grpc_core { namespace testing { +namespace { class Foo : public ReferenceCounted { public: Foo() {} }; -TEST(ReferenceCounted, HeapAllocated) { +TEST(ReferenceCounted, Basic) { Foo* foo = New(); foo->Unref(); } -TEST(ReferenceCounted, HeapAllocatedWithExtraRef) { +TEST(ReferenceCounted, ExtraRef) { Foo* foo = New(); foo->Ref(); foo->Unref(); foo->Unref(); } +TraceFlag foo_tracer(true, "foo"); + +class FooWithTracing : public ReferenceCounted { + public: + FooWithTracing() : ReferenceCounted(&foo_tracer) {} +}; + +TEST(ReferenceCounted, WithTracing) { + FooWithTracing* foo = New(); + foo->Ref(DEBUG_LOCATION, "extra_ref"); + foo->Unref(DEBUG_LOCATION, "extra_ref"); + // Can use the no-argument methods, too. + foo->Ref(); + foo->Unref(); + foo->Unref(DEBUG_LOCATION, "original_ref"); +} + +} // namespace } // namespace testing } // namespace grpc_core From a9209ae39c0984936404c6ceb221774682d544b0 Mon Sep 17 00:00:00 2001 From: Chad Kunde Date: Tue, 28 Nov 2017 21:05:47 -0800 Subject: [PATCH 58/86] Updated CLA link to reflect migration to Linux Foundation. --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e9c5fe20141..af462468225 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,7 +7,7 @@ If you are new to github, please start by reading [Pull Request howto](https://h ## Legal requirements In order to protect both you and ourselves, you will need to sign the -[Contributor License Agreement](https://cla.developers.google.com/clas). +[Contributor License Agreement](https://identity.linuxfoundation.org/projects/cncf). ## Running tests From 853fff8d085e60ca56dca834c962e840fe5ad50a Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Wed, 29 Nov 2017 07:37:41 -0800 Subject: [PATCH 59/86] Split tracing code into its own class. --- src/core/lib/support/reference_counted.h | 47 ++++++++++++++++--- .../support/reference_counted_ptr_test.cc | 19 +++++++- test/core/support/reference_counted_test.cc | 6 +-- 3 files changed, 61 insertions(+), 11 deletions(-) diff --git a/src/core/lib/support/reference_counted.h b/src/core/lib/support/reference_counted.h index ff74de082c7..3858d61b72d 100644 --- a/src/core/lib/support/reference_counted.h +++ b/src/core/lib/support/reference_counted.h @@ -19,8 +19,8 @@ #ifndef GRPC_CORE_LIB_SUPPORT_REFERENCE_COUNTED_H #define GRPC_CORE_LIB_SUPPORT_REFERENCE_COUNTED_H -#include #include +#include #include "src/core/lib/debug/trace.h" #include "src/core/lib/support/debug_location.h" @@ -32,6 +32,39 @@ namespace grpc_core { // New objects should be created via New() and start with a refcount of 1. // When the refcount reaches 0, the object will be deleted via Delete(). class ReferenceCounted { + public: + void Ref() { gpr_ref(&refs_); } + + void Unref() { + if (gpr_unref(&refs_)) { + Delete(this); + } + } + + // Not copyable nor movable. + ReferenceCounted(const ReferenceCounted&) = delete; + ReferenceCounted& operator=(const ReferenceCounted&) = delete; + + protected: + // Allow Delete() to access destructor. + template + friend void Delete(T*); + + ReferenceCounted() { gpr_ref_init(&refs_, 1); } + + virtual ~ReferenceCounted() {} + + private: + gpr_refcount refs_; +}; + +// An alternative version of the ReferenceCounted base class that +// supports tracing. This is intended to be used in cases where the +// object will be handled both by idiomatic C++ code using smart +// pointers and legacy code that is manually calling Ref() and Unref(). +// Once all of our code is converted to idiomatic C++, we may be able to +// eliminate this class. +class ReferenceCountedWithTracing { public: void Ref() { gpr_ref(&refs_); } @@ -62,21 +95,23 @@ class ReferenceCounted { } // Not copyable nor movable. - ReferenceCounted(const ReferenceCounted&) = delete; - ReferenceCounted& operator=(const ReferenceCounted&) = delete; + ReferenceCountedWithTracing(const ReferenceCountedWithTracing&) = delete; + ReferenceCountedWithTracing& operator=(const ReferenceCountedWithTracing&) = + delete; protected: // Allow Delete() to access destructor. template friend void Delete(T*); - ReferenceCounted() : ReferenceCounted(nullptr) {} + ReferenceCountedWithTracing() : ReferenceCountedWithTracing(nullptr) {} - explicit ReferenceCounted(TraceFlag* trace_flag) : trace_flag_(trace_flag) { + explicit ReferenceCountedWithTracing(TraceFlag* trace_flag) + : trace_flag_(trace_flag) { gpr_ref_init(&refs_, 1); } - virtual ~ReferenceCounted() {} + virtual ~ReferenceCountedWithTracing() {} private: TraceFlag* trace_flag_ = nullptr; diff --git a/test/core/support/reference_counted_ptr_test.cc b/test/core/support/reference_counted_ptr_test.cc index 14dd620887c..45c552a1bcc 100644 --- a/test/core/support/reference_counted_ptr_test.cc +++ b/test/core/support/reference_counted_ptr_test.cc @@ -28,12 +28,13 @@ namespace grpc_core { namespace testing { +namespace { class Foo : public ReferenceCounted { public: - Foo() : ReferenceCounted(nullptr), value_(0) {} + Foo() : value_(0) {} - explicit Foo(int value) : ReferenceCounted(nullptr), value_(value) {} + explicit Foo(int value) : value_(value) {} int value() const { return value_; } @@ -149,6 +150,20 @@ TEST(MakeReferenceCounted, Args) { EXPECT_EQ(3, foo->value()); } +TraceFlag foo_tracer(true, "foo"); + +class FooWithTracing : public ReferenceCountedWithTracing { + public: + FooWithTracing() : ReferenceCountedWithTracing(&foo_tracer) {} +}; + +TEST(ReferenceCountedPtr, ReferenceCountedWithTracing) { + ReferenceCountedPtr foo(New()); + foo->Ref(DEBUG_LOCATION, "foo"); + foo->Unref(DEBUG_LOCATION, "foo"); +} + +} // namespace } // namespace testing } // namespace grpc_core diff --git a/test/core/support/reference_counted_test.cc b/test/core/support/reference_counted_test.cc index 778556d999a..88ee5d8e557 100644 --- a/test/core/support/reference_counted_test.cc +++ b/test/core/support/reference_counted_test.cc @@ -46,12 +46,12 @@ TEST(ReferenceCounted, ExtraRef) { TraceFlag foo_tracer(true, "foo"); -class FooWithTracing : public ReferenceCounted { +class FooWithTracing : public ReferenceCountedWithTracing { public: - FooWithTracing() : ReferenceCounted(&foo_tracer) {} + FooWithTracing() : ReferenceCountedWithTracing(&foo_tracer) {} }; -TEST(ReferenceCounted, WithTracing) { +TEST(ReferenceCountedWithTracing, Basic) { FooWithTracing* foo = New(); foo->Ref(DEBUG_LOCATION, "extra_ref"); foo->Unref(DEBUG_LOCATION, "extra_ref"); From 25fd9fbc4e0919e02394cb1e9127b7458696de26 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 29 Nov 2017 17:49:04 +0100 Subject: [PATCH 60/86] Improvements to windows build instructions --- INSTALL.md | 45 +++++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index a18f5690a4f..5d03c43ebec 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -94,42 +94,51 @@ on experience with the tools involved. ### Building using CMake (RECOMMENDED) Builds gRPC C and C++ with boringssl. -- Install [Git](https://git-scm.com/). - Install Visual Studio 2015 or 2017 (Visual C++ compiler will be used). +- Install [Git](https://git-scm.com/). - Install [CMake](https://cmake.org/download/). -- Install [Active State Perl](https://www.activestate.com/activeperl/) (`choco install activeperl`) -- Install [Ninja](https://ninja-build.org/) (`choco install ninja`) -- Install [Go](https://golang.org/dl/) (`choco install golang`) -- Install [yasm](http://yasm.tortall.net/) and add it to `PATH` (`choco install yasm`) -- Run these commands in the repo root directory - -#### cmake: Using Ninja (faster build, supports boringssl's assembly optimizations). -Please note that when using Ninja, you'll still need Visual C++ (part of Visual Studio) -installed to be able to compile the C/C++ sources. +- Install [Active State Perl](https://www.activestate.com/activeperl/) (`choco install activeperl`) - *required by boringssl* +- Install [Go](https://golang.org/dl/) (`choco install golang`) - *required by boringssl* +- Install [yasm](http://yasm.tortall.net/) and add it to `PATH` (`choco install yasm`) - *required by boringssl* +- (Optional) Install [Ninja](https://ninja-build.org/) (`choco install ninja`) + +#### Clone grpc sources including submodules +Before building, you need to clone the gRPC github repository and download submodules containing source code +for gRPC's dependencies (that's done by the `submodule` command). ``` -> powershell git clone --recursive -b ((New-Object System.Net.WebClient).DownloadString(\"https://grpc.io/release\").Trim()) https://github.com/grpc/grpc +> @rem You can also do just "git clone -b THE_BRANCH_YOU_WANT https://github.com/grpc/grpc" +> powershell git clone -b ((New-Object System.Net.WebClient).DownloadString(\"https://grpc.io/release\").Trim()) https://github.com/grpc/grpc > cd grpc -> md .build -> cd .build -> call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" x64 -> cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release -> cmake --build . -> ninja +> git submodule update --init ``` -#### cmake: Using Visual Studio 2015 (can only build with OPENSSL_NO_ASM). +#### cmake: Using Visual Studio 2015 or 2017 (can only build with OPENSSL_NO_ASM). When using the "Visual Studio" generator, cmake will generate a solution (`grpc.sln`) that contains a VS project for every target defined in `CMakeLists.txt` (+ few extra convenience projects added automatically by cmake). After opening the solution with Visual Studio you will be able to browse and build the code as usual. ``` +> @rem Run from grpc directory after cloning the repo and submodules. > md .build > cd .build > cmake .. -G "Visual Studio 14 2015" -DCMAKE_BUILD_TYPE=Release > cmake --build . ``` +#### cmake: Using Ninja (faster build, supports boringssl's assembly optimizations). +Please note that when using Ninja, you'll still need Visual C++ (part of Visual Studio) +installed to be able to compile the C/C++ sources. +``` +> @rem Run from grpc directory after cloning the repo and submodules. +> md .build +> cd .build +> call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" x64 +> cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release +> cmake --build . +> ninja +``` + ### msys2 (with mingw) The Makefile (and source code) should support msys2's mingw32 and mingw64 From e8c47036fbbde2cd4470663ce8d4d7b0e327a188 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 29 Nov 2017 09:37:51 -0800 Subject: [PATCH 61/86] Update comments --- include/grpc++/server_builder.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/grpc++/server_builder.h b/include/grpc++/server_builder.h index 02129b78ef6..e2bae4b41fa 100644 --- a/include/grpc++/server_builder.h +++ b/include/grpc++/server_builder.h @@ -127,7 +127,7 @@ class ServerBuilder { bool is_frequently_polled = true); ////////////////////////////////////////////////////////////////////////////// - // RegisterService variants + // Less commonly used RegisterService variants /// Register a service. This call does not take ownership of the service. /// The service must exist for the lifetime of the \a Server instance returned @@ -137,6 +137,8 @@ class ServerBuilder { /// Register a generic service. /// Matches requests with any :authority + /// This is mostly useful for writing generic gRPC Proxies where the exact + /// serialization format is unknown ServerBuilder& RegisterAsyncGenericService(AsyncGenericService* service); ////////////////////////////////////////////////////////////////////////////// From 65dbb9df6485bd0c48718c00b8e05e1a7ca18345 Mon Sep 17 00:00:00 2001 From: ncteisen Date: Wed, 29 Nov 2017 10:06:30 -0800 Subject: [PATCH 62/86] Add test for RecvStatus error_string API --- test/core/end2end/tests/simple_request.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/core/end2end/tests/simple_request.cc b/test/core/end2end/tests/simple_request.cc index ec7425aa09c..86fe5d1e208 100644 --- a/test/core/end2end/tests/simple_request.cc +++ b/test/core/end2end/tests/simple_request.cc @@ -99,6 +99,7 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_metadata_array request_metadata_recv; grpc_call_details call_details; grpc_status_code status; + const char* error_string; grpc_call_error error; grpc_slice details; int was_cancelled = 2; @@ -148,6 +149,7 @@ static void simple_request_body(grpc_end2end_test_config config, op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; + op->data.recv_status_on_client.error_string = &error_string; op->flags = 0; op->reserved = nullptr; op++; @@ -199,6 +201,16 @@ static void simple_request_body(grpc_end2end_test_config config, GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); + // the following sanity check makes sure that the requested error string is + // correctly populated by the core. It looks for certain substrings that are + // not likely to change much. Some parts of the error, like time created, + // obviously are not checked. + GPR_ASSERT(nullptr != strstr(error_string, "xyz")); + GPR_ASSERT(nullptr != strstr(error_string, "description")); + GPR_ASSERT(nullptr != strstr(error_string, "Error received from peer")); + GPR_ASSERT(nullptr != strstr(error_string, "src/core/lib/surface/call.cc")); + GPR_ASSERT(nullptr != strstr(error_string, "grpc_message")); + GPR_ASSERT(nullptr != strstr(error_string, "grpc_status")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); @@ -206,6 +218,7 @@ static void simple_request_body(grpc_end2end_test_config config, GPR_ASSERT(was_cancelled == 1); grpc_slice_unref(details); + gpr_free((void*)error_string); grpc_metadata_array_destroy(&initial_metadata_recv); grpc_metadata_array_destroy(&trailing_metadata_recv); grpc_metadata_array_destroy(&request_metadata_recv); From 3b9ac296708be160b289d38ea8b8905795874676 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Wed, 29 Nov 2017 10:34:23 -0800 Subject: [PATCH 63/86] Improve unsecure sanity test --- tools/run_tests/sanity/check_unsecure.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tools/run_tests/sanity/check_unsecure.sh b/tools/run_tests/sanity/check_unsecure.sh index aabafedfb86..8584cbe36bc 100755 --- a/tools/run_tests/sanity/check_unsecure.sh +++ b/tools/run_tests/sanity/check_unsecure.sh @@ -13,12 +13,15 @@ # See the License for the specific language governing permissions and # limitations under the License. - set -e -# Make sure that there is no path from a known unsecure target -# to an SSL library +# Make sure that there is no path from known unsecure libraries and targets +# to an SSL library. Any failure among these will make the script fail. + +test `bazel query 'somepath("//:grpc_unsecure", "//external:libssl")' 2>/dev/null | wc -l` -eq 0 || exit 1 +test `bazel query 'somepath("//:grpc++_unsecure", "//external:libssl")' 2>/dev/null | wc -l` -eq 0 || exit 1 +test `bazel query 'somepath("//:grpc++_codegen_proto", "//external:libssl")' 2>/dev/null | wc -l` -eq 0 || exit 1 +test `bazel query 'somepath("//test/cpp/microbenchmarks:helpers", "//external:libssl")' 2>/dev/null | wc -l` -eq 0 || exit 1 -test `bazel query "somepath(//test/cpp/microbenchmarks:helpers, //external:libssl)" 2>/dev/null | wc -l` -eq 0 +exit 0 -# Fall through with the exit code of that command From 240bad3d2d15628ccf13dddfc143e226fc4d9874 Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Wed, 29 Nov 2017 10:50:45 -0800 Subject: [PATCH 64/86] Fix check_sources_and_headers. --- build.yaml | 6 +++--- gRPC-Core.podspec | 12 ++++++------ grpc.gemspec | 6 +++--- package.xml | 6 +++--- tools/run_tests/generated/sources_and_headers.json | 12 ++++++------ 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/build.yaml b/build.yaml index 57a65b37075..c41bf193e6b 100644 --- a/build.yaml +++ b/build.yaml @@ -109,14 +109,11 @@ filegroups: - src/core/lib/support/atomic.h - src/core/lib/support/atomic_with_atm.h - src/core/lib/support/atomic_with_std.h - - src/core/lib/support/debug_location.h - src/core/lib/support/env.h - src/core/lib/support/manual_constructor.h - src/core/lib/support/memory.h - src/core/lib/support/mpscq.h - src/core/lib/support/murmur_hash.h - - src/core/lib/support/reference_counted.h - - src/core/lib/support/reference_counted_ptr.h - src/core/lib/support/spinlock.h - src/core/lib/support/stack_lockfree.h - src/core/lib/support/string.h @@ -396,6 +393,9 @@ filegroups: - src/core/lib/slice/slice_hash_table.h - src/core/lib/slice/slice_internal.h - src/core/lib/slice/slice_string_helpers.h + - src/core/lib/support/debug_location.h + - src/core/lib/support/reference_counted.h + - src/core/lib/support/reference_counted_ptr.h - src/core/lib/support/vector.h - src/core/lib/surface/alarm_internal.h - src/core/lib/surface/api_trace.h diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index bc500cc0d78..e90e356aaa8 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -192,14 +192,11 @@ Pod::Spec.new do |s| 'src/core/lib/support/atomic.h', 'src/core/lib/support/atomic_with_atm.h', 'src/core/lib/support/atomic_with_std.h', - 'src/core/lib/support/debug_location.h', 'src/core/lib/support/env.h', 'src/core/lib/support/manual_constructor.h', 'src/core/lib/support/memory.h', 'src/core/lib/support/mpscq.h', 'src/core/lib/support/murmur_hash.h', - 'src/core/lib/support/reference_counted.h', - 'src/core/lib/support/reference_counted_ptr.h', 'src/core/lib/support/spinlock.h', 'src/core/lib/support/stack_lockfree.h', 'src/core/lib/support/string.h', @@ -416,6 +413,9 @@ Pod::Spec.new do |s| 'src/core/lib/slice/slice_hash_table.h', 'src/core/lib/slice/slice_internal.h', 'src/core/lib/slice/slice_string_helpers.h', + 'src/core/lib/support/debug_location.h', + 'src/core/lib/support/reference_counted.h', + 'src/core/lib/support/reference_counted_ptr.h', 'src/core/lib/support/vector.h', 'src/core/lib/surface/alarm_internal.h', 'src/core/lib/surface/api_trace.h', @@ -715,14 +715,11 @@ Pod::Spec.new do |s| 'src/core/lib/support/atomic.h', 'src/core/lib/support/atomic_with_atm.h', 'src/core/lib/support/atomic_with_std.h', - 'src/core/lib/support/debug_location.h', 'src/core/lib/support/env.h', 'src/core/lib/support/manual_constructor.h', 'src/core/lib/support/memory.h', 'src/core/lib/support/mpscq.h', 'src/core/lib/support/murmur_hash.h', - 'src/core/lib/support/reference_counted.h', - 'src/core/lib/support/reference_counted_ptr.h', 'src/core/lib/support/spinlock.h', 'src/core/lib/support/stack_lockfree.h', 'src/core/lib/support/string.h', @@ -894,6 +891,9 @@ Pod::Spec.new do |s| 'src/core/lib/slice/slice_hash_table.h', 'src/core/lib/slice/slice_internal.h', 'src/core/lib/slice/slice_string_helpers.h', + 'src/core/lib/support/debug_location.h', + 'src/core/lib/support/reference_counted.h', + 'src/core/lib/support/reference_counted_ptr.h', 'src/core/lib/support/vector.h', 'src/core/lib/surface/alarm_internal.h', 'src/core/lib/surface/api_trace.h', diff --git a/grpc.gemspec b/grpc.gemspec index d1e8b5254dc..a58c73a59d6 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -89,14 +89,11 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/support/atomic.h ) s.files += %w( src/core/lib/support/atomic_with_atm.h ) s.files += %w( src/core/lib/support/atomic_with_std.h ) - s.files += %w( src/core/lib/support/debug_location.h ) s.files += %w( src/core/lib/support/env.h ) s.files += %w( src/core/lib/support/manual_constructor.h ) s.files += %w( src/core/lib/support/memory.h ) s.files += %w( src/core/lib/support/mpscq.h ) s.files += %w( src/core/lib/support/murmur_hash.h ) - s.files += %w( src/core/lib/support/reference_counted.h ) - s.files += %w( src/core/lib/support/reference_counted_ptr.h ) s.files += %w( src/core/lib/support/spinlock.h ) s.files += %w( src/core/lib/support/stack_lockfree.h ) s.files += %w( src/core/lib/support/string.h ) @@ -347,6 +344,9 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/slice/slice_hash_table.h ) s.files += %w( src/core/lib/slice/slice_internal.h ) s.files += %w( src/core/lib/slice/slice_string_helpers.h ) + s.files += %w( src/core/lib/support/debug_location.h ) + s.files += %w( src/core/lib/support/reference_counted.h ) + s.files += %w( src/core/lib/support/reference_counted_ptr.h ) s.files += %w( src/core/lib/support/vector.h ) s.files += %w( src/core/lib/surface/alarm_internal.h ) s.files += %w( src/core/lib/surface/api_trace.h ) diff --git a/package.xml b/package.xml index 6f786a13ad9..0036481bd17 100644 --- a/package.xml +++ b/package.xml @@ -101,14 +101,11 @@ - - - @@ -359,6 +356,9 @@ + + + diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 284a2098e3e..091aa171417 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -7872,14 +7872,11 @@ "src/core/lib/support/atomic.h", "src/core/lib/support/atomic_with_atm.h", "src/core/lib/support/atomic_with_std.h", - "src/core/lib/support/debug_location.h", "src/core/lib/support/env.h", "src/core/lib/support/manual_constructor.h", "src/core/lib/support/memory.h", "src/core/lib/support/mpscq.h", "src/core/lib/support/murmur_hash.h", - "src/core/lib/support/reference_counted.h", - "src/core/lib/support/reference_counted_ptr.h", "src/core/lib/support/spinlock.h", "src/core/lib/support/stack_lockfree.h", "src/core/lib/support/string.h", @@ -7924,14 +7921,11 @@ "src/core/lib/support/atomic.h", "src/core/lib/support/atomic_with_atm.h", "src/core/lib/support/atomic_with_std.h", - "src/core/lib/support/debug_location.h", "src/core/lib/support/env.h", "src/core/lib/support/manual_constructor.h", "src/core/lib/support/memory.h", "src/core/lib/support/mpscq.h", "src/core/lib/support/murmur_hash.h", - "src/core/lib/support/reference_counted.h", - "src/core/lib/support/reference_counted_ptr.h", "src/core/lib/support/spinlock.h", "src/core/lib/support/stack_lockfree.h", "src/core/lib/support/string.h", @@ -8264,6 +8258,9 @@ "src/core/lib/slice/slice_hash_table.h", "src/core/lib/slice/slice_internal.h", "src/core/lib/slice/slice_string_helpers.h", + "src/core/lib/support/debug_location.h", + "src/core/lib/support/reference_counted.h", + "src/core/lib/support/reference_counted_ptr.h", "src/core/lib/support/vector.h", "src/core/lib/surface/alarm_internal.h", "src/core/lib/surface/api_trace.h", @@ -8400,6 +8397,9 @@ "src/core/lib/slice/slice_hash_table.h", "src/core/lib/slice/slice_internal.h", "src/core/lib/slice/slice_string_helpers.h", + "src/core/lib/support/debug_location.h", + "src/core/lib/support/reference_counted.h", + "src/core/lib/support/reference_counted_ptr.h", "src/core/lib/support/vector.h", "src/core/lib/surface/alarm_internal.h", "src/core/lib/surface/api_trace.h", From 86e1ebc4bb20c2be628dd0b5e0b6bd27c0c18435 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 29 Nov 2017 10:54:24 -0800 Subject: [PATCH 65/86] Add Bazel configurations for sanitizers Usage example: bazel test -c dbg --config asan test/whatever-you-want --- tools/bazel.rc | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 tools/bazel.rc diff --git a/tools/bazel.rc b/tools/bazel.rc new file mode 100644 index 00000000000..c554f039713 --- /dev/null +++ b/tools/bazel.rc @@ -0,0 +1,48 @@ +build --client_env=CC=clang + +build:asan --strip=never +build:asan --copt -fsanitize-coverage=edge +build:asan --copt -fsanitize=address +build:asan --copt -O0 +build:asan --copt -fno-omit-frame-pointer +build:asan --copt -DGPR_NO_DIRECT_SYSCALLS +build:asan --linkopt -fsanitize=address +build:asan --action_env=ASAN_OPTIONS=detect_leaks=1:color=always +build:asan --action_env=LSAN_OPTIONS=suppressions=lsan_suppressions.txt:report_objects=1 + +build:msan --strip=never +build:msan --copt -fsanitize-coverage=edge +build:msan --copt -fsanitize=memory +build:msan --copt -O0 +build:msan --copt -fsanitize-memory-track-origins +build:msan --copt -fsanitize-memory-use-after-dtor +build:msan --copt -fno-omit-frame-pointer +build:msan --copt -fPIE +build:msan --copt -DGPR_NO_DIRECT_SYSCALLS +build:msan --linkopt -fsanitize=memory +build:msan --linkopt -fPIE +build:msan --action_env=MSAN_OPTIONS=poison_in_dtor=1 + +build:tsan --strip=never +build:tsan --copt -fsanitize=thread +build:tsan --copt -fno-omit-frame-pointer +build:tsan --copt -DGPR_NO_DIRECT_SYSCALLS +build:tsan --copt -DGRPC_TSAN +build:tsan --linkopt -fsanitize=thread +build:tsan --action_env=TSAN_OPTIONS=suppressions=tools/tsan_suppressions.txt:halt_on_error=1:second_deadlock_stack=1 + +build:ubsan --strip=never +build:ubsan --copt -fsanitize-coverage=edge +build:ubsan --copt -fsanitize=undefined +build:ubsan --copt -fno-omit-frame-pointer +build:ubsan --copt -DGRPC_UBSAN +build:ubsan --copt -DNDEBUG +build:ubsan --copt -fno-sanitize=function,vptr +build:ubsan --linkopt -fsanitize=undefined +build:ubsan --action_env=UBSAN_OPTIONS=halt_on_error=1:print_stacktrace=1:suppressions=tools/ubsan_suppressions.txt + +build:basicprof --strip=never +build:basicprof --copt -DNDEBUG +build:basicprof --copt -O2 +build:basicprof --copt -DGRPC_BASIC_PROFILER +build:basicprof --copt -DGRPC_TIMERS_RDTSC From d49e100354dbaa580afc46a5ebd0d56ffb85d566 Mon Sep 17 00:00:00 2001 From: Mehrdad Afshari Date: Wed, 29 Nov 2017 11:01:36 -0800 Subject: [PATCH 66/86] clang-format code --- src/compiler/objective_c_generator.cc | 2 +- src/compiler/objective_c_generator.h | 2 +- src/core/lib/support/fork.cc | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compiler/objective_c_generator.cc b/src/compiler/objective_c_generator.cc index 369afc1e775..ab7d8697589 100644 --- a/src/compiler/objective_c_generator.cc +++ b/src/compiler/objective_c_generator.cc @@ -28,10 +28,10 @@ using ::google::protobuf::compiler::objectivec::ClassName; using ::grpc::protobuf::FileDescriptor; +using ::grpc::protobuf::FileDescriptor; using ::grpc::protobuf::MethodDescriptor; using ::grpc::protobuf::ServiceDescriptor; using ::grpc::protobuf::io::Printer; -using ::grpc::protobuf::FileDescriptor; using ::std::map; using ::std::set; diff --git a/src/compiler/objective_c_generator.h b/src/compiler/objective_c_generator.h index 700c9c496e9..d3aed76c4f4 100644 --- a/src/compiler/objective_c_generator.h +++ b/src/compiler/objective_c_generator.h @@ -24,8 +24,8 @@ namespace grpc_objective_c_generator { using ::grpc::protobuf::FileDescriptor; -using ::grpc::protobuf::ServiceDescriptor; using ::grpc::protobuf::FileDescriptor; +using ::grpc::protobuf::ServiceDescriptor; using ::grpc::string; // Returns forward declaration of classes in the generated header file. diff --git a/src/core/lib/support/fork.cc b/src/core/lib/support/fork.cc index 2f29af899dd..d59ca5584cb 100644 --- a/src/core/lib/support/fork.cc +++ b/src/core/lib/support/fork.cc @@ -38,9 +38,9 @@ void grpc_fork_support_init() { fork_support_enabled = 1; #else fork_support_enabled = 0; - char *env = gpr_getenv("GRPC_ENABLE_FORK_SUPPORT"); + char* env = gpr_getenv("GRPC_ENABLE_FORK_SUPPORT"); if (env != NULL) { - static const char *truthy[] = {"yes", "Yes", "YES", "true", + static const char* truthy[] = {"yes", "Yes", "YES", "true", "True", "TRUE", "1"}; for (size_t i = 0; i < GPR_ARRAY_SIZE(truthy); i++) { if (0 == strcmp(env, truthy[i])) { From fcc796c699961e3ffa5b2c3aa9b2bdf1f189500a Mon Sep 17 00:00:00 2001 From: Mehrdad Afshari Date: Wed, 29 Nov 2017 11:07:37 -0800 Subject: [PATCH 67/86] Remove duplicate headers in BUILD file entry --- BUILD | 2 -- 1 file changed, 2 deletions(-) diff --git a/BUILD b/BUILD index 3513416b373..df334cd322f 100644 --- a/BUILD +++ b/BUILD @@ -486,8 +486,6 @@ grpc_cc_library( "src/core/lib/support/atomic_with_std.h", "src/core/lib/support/env.h", "src/core/lib/support/fork.h", - "src/core/lib/support/memory.h", - "src/core/lib/support/vector.h", "src/core/lib/support/manual_constructor.h", "src/core/lib/support/memory.h", "src/core/lib/support/mpscq.h", From bf816d325e4281804c3f75e63c2c1f7827176300 Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Wed, 29 Nov 2017 11:25:34 -0800 Subject: [PATCH 68/86] Shorted "reference" to "ref". --- BUILD | 8 +- CMakeLists.txt | 20 ++-- Makefile | 60 ++++++------ build.yaml | 12 +-- gRPC-Core.podspec | 8 +- grpc.gemspec | 4 +- package.xml | 4 +- .../{reference_counted.h => ref_counted.h} | 31 +++---- ...erence_counted_ptr.h => ref_counted_ptr.h} | 28 +++--- test/core/support/BUILD | 14 +-- ...ed_ptr_test.cc => ref_counted_ptr_test.cc} | 92 +++++++++---------- ...ce_counted_test.cc => ref_counted_test.cc} | 14 +-- tools/doxygen/Doxyfile.c++.internal | 4 +- tools/doxygen/Doxyfile.core.internal | 4 +- .../generated/sources_and_headers.json | 16 ++-- tools/run_tests/generated/tests.json | 4 +- 16 files changed, 161 insertions(+), 162 deletions(-) rename src/core/lib/support/{reference_counted.h => ref_counted.h} (77%) rename src/core/lib/support/{reference_counted_ptr.h => ref_counted_ptr.h} (71%) rename test/core/support/{reference_counted_ptr_test.cc => ref_counted_ptr_test.cc} (51%) rename test/core/support/{reference_counted_test.cc => ref_counted_test.cc} (81%) diff --git a/BUILD b/BUILD index 6ba5e6f6554..e88cdfedc59 100644 --- a/BUILD +++ b/BUILD @@ -544,8 +544,8 @@ grpc_cc_library( ) grpc_cc_library( - name = "reference_counted", - public_hdrs = ["src/core/lib/support/reference_counted.h"], + name = "ref_counted", + public_hdrs = ["src/core/lib/support/ref_counted.h"], language = "c++", deps = [ "grpc_trace", @@ -554,8 +554,8 @@ grpc_cc_library( ) grpc_cc_library( - name = "reference_counted_ptr", - public_hdrs = ["src/core/lib/support/reference_counted_ptr.h"], + name = "ref_counted_ptr", + public_hdrs = ["src/core/lib/support/ref_counted_ptr.h"], language = "c++", ) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b214be4352..f77b650a486 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -739,8 +739,8 @@ endif() add_dependencies(buildtests_cxx qps_worker) add_dependencies(buildtests_cxx reconnect_interop_client) add_dependencies(buildtests_cxx reconnect_interop_server) -add_dependencies(buildtests_cxx reference_counted_ptr_test) -add_dependencies(buildtests_cxx reference_counted_test) +add_dependencies(buildtests_cxx ref_counted_ptr_test) +add_dependencies(buildtests_cxx ref_counted_test) add_dependencies(buildtests_cxx secure_auth_context_test) if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_dependencies(buildtests_cxx secure_sync_unary_ping_pong_test) @@ -12262,14 +12262,14 @@ target_link_libraries(reconnect_interop_server endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) -add_executable(reference_counted_ptr_test - test/core/support/reference_counted_ptr_test.cc +add_executable(ref_counted_ptr_test + test/core/support/ref_counted_ptr_test.cc third_party/googletest/googletest/src/gtest-all.cc third_party/googletest/googlemock/src/gmock-all.cc ) -target_include_directories(reference_counted_ptr_test +target_include_directories(ref_counted_ptr_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include @@ -12288,7 +12288,7 @@ target_include_directories(reference_counted_ptr_test PRIVATE ${_gRPC_PROTO_GENS_DIR} ) -target_link_libraries(reference_counted_ptr_test +target_link_libraries(ref_counted_ptr_test ${_gRPC_PROTOBUF_LIBRARIES} ${_gRPC_ALLTARGETS_LIBRARIES} grpc_test_util @@ -12302,14 +12302,14 @@ target_link_libraries(reference_counted_ptr_test endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) -add_executable(reference_counted_test - test/core/support/reference_counted_test.cc +add_executable(ref_counted_test + test/core/support/ref_counted_test.cc third_party/googletest/googletest/src/gtest-all.cc third_party/googletest/googlemock/src/gmock-all.cc ) -target_include_directories(reference_counted_test +target_include_directories(ref_counted_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${BORINGSSL_ROOT_DIR}/include @@ -12328,7 +12328,7 @@ target_include_directories(reference_counted_test PRIVATE ${_gRPC_PROTO_GENS_DIR} ) -target_link_libraries(reference_counted_test +target_link_libraries(ref_counted_test ${_gRPC_PROTOBUF_LIBRARIES} ${_gRPC_ALLTARGETS_LIBRARIES} grpc_test_util diff --git a/Makefile b/Makefile index a81e62b4409..ef6006c6240 100644 --- a/Makefile +++ b/Makefile @@ -1165,8 +1165,8 @@ qps_openloop_test: $(BINDIR)/$(CONFIG)/qps_openloop_test qps_worker: $(BINDIR)/$(CONFIG)/qps_worker reconnect_interop_client: $(BINDIR)/$(CONFIG)/reconnect_interop_client reconnect_interop_server: $(BINDIR)/$(CONFIG)/reconnect_interop_server -reference_counted_ptr_test: $(BINDIR)/$(CONFIG)/reference_counted_ptr_test -reference_counted_test: $(BINDIR)/$(CONFIG)/reference_counted_test +ref_counted_ptr_test: $(BINDIR)/$(CONFIG)/ref_counted_ptr_test +ref_counted_test: $(BINDIR)/$(CONFIG)/ref_counted_test secure_auth_context_test: $(BINDIR)/$(CONFIG)/secure_auth_context_test secure_sync_unary_ping_pong_test: $(BINDIR)/$(CONFIG)/secure_sync_unary_ping_pong_test server_builder_plugin_test: $(BINDIR)/$(CONFIG)/server_builder_plugin_test @@ -1603,8 +1603,8 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/qps_worker \ $(BINDIR)/$(CONFIG)/reconnect_interop_client \ $(BINDIR)/$(CONFIG)/reconnect_interop_server \ - $(BINDIR)/$(CONFIG)/reference_counted_ptr_test \ - $(BINDIR)/$(CONFIG)/reference_counted_test \ + $(BINDIR)/$(CONFIG)/ref_counted_ptr_test \ + $(BINDIR)/$(CONFIG)/ref_counted_test \ $(BINDIR)/$(CONFIG)/secure_auth_context_test \ $(BINDIR)/$(CONFIG)/secure_sync_unary_ping_pong_test \ $(BINDIR)/$(CONFIG)/server_builder_plugin_test \ @@ -1731,8 +1731,8 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/qps_worker \ $(BINDIR)/$(CONFIG)/reconnect_interop_client \ $(BINDIR)/$(CONFIG)/reconnect_interop_server \ - $(BINDIR)/$(CONFIG)/reference_counted_ptr_test \ - $(BINDIR)/$(CONFIG)/reference_counted_test \ + $(BINDIR)/$(CONFIG)/ref_counted_ptr_test \ + $(BINDIR)/$(CONFIG)/ref_counted_test \ $(BINDIR)/$(CONFIG)/secure_auth_context_test \ $(BINDIR)/$(CONFIG)/secure_sync_unary_ping_pong_test \ $(BINDIR)/$(CONFIG)/server_builder_plugin_test \ @@ -2136,10 +2136,10 @@ test_cxx: buildtests_cxx $(Q) $(BINDIR)/$(CONFIG)/proto_utils_test || ( echo test proto_utils_test failed ; exit 1 ) $(E) "[RUN] Testing qps_openloop_test" $(Q) $(BINDIR)/$(CONFIG)/qps_openloop_test || ( echo test qps_openloop_test failed ; exit 1 ) - $(E) "[RUN] Testing reference_counted_ptr_test" - $(Q) $(BINDIR)/$(CONFIG)/reference_counted_ptr_test || ( echo test reference_counted_ptr_test failed ; exit 1 ) - $(E) "[RUN] Testing reference_counted_test" - $(Q) $(BINDIR)/$(CONFIG)/reference_counted_test || ( echo test reference_counted_test failed ; exit 1 ) + $(E) "[RUN] Testing ref_counted_ptr_test" + $(Q) $(BINDIR)/$(CONFIG)/ref_counted_ptr_test || ( echo test ref_counted_ptr_test failed ; exit 1 ) + $(E) "[RUN] Testing ref_counted_test" + $(Q) $(BINDIR)/$(CONFIG)/ref_counted_test || ( echo test ref_counted_test failed ; exit 1 ) $(E) "[RUN] Testing secure_auth_context_test" $(Q) $(BINDIR)/$(CONFIG)/secure_auth_context_test || ( echo test secure_auth_context_test failed ; exit 1 ) $(E) "[RUN] Testing secure_sync_unary_ping_pong_test" @@ -16505,15 +16505,15 @@ endif $(OBJDIR)/$(CONFIG)/test/cpp/interop/reconnect_interop_server.o: $(GENDIR)/src/proto/grpc/testing/empty.pb.cc $(GENDIR)/src/proto/grpc/testing/empty.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/test.pb.cc $(GENDIR)/src/proto/grpc/testing/test.grpc.pb.cc -REFERENCE_COUNTED_PTR_TEST_SRC = \ - test/core/support/reference_counted_ptr_test.cc \ +REF_COUNTED_PTR_TEST_SRC = \ + test/core/support/ref_counted_ptr_test.cc \ -REFERENCE_COUNTED_PTR_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(REFERENCE_COUNTED_PTR_TEST_SRC)))) +REF_COUNTED_PTR_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(REF_COUNTED_PTR_TEST_SRC)))) ifeq ($(NO_SECURE),true) # You can't build secure targets if you don't have OpenSSL. -$(BINDIR)/$(CONFIG)/reference_counted_ptr_test: openssl_dep_error +$(BINDIR)/$(CONFIG)/ref_counted_ptr_test: openssl_dep_error else @@ -16524,39 +16524,39 @@ ifeq ($(NO_PROTOBUF),true) # You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. -$(BINDIR)/$(CONFIG)/reference_counted_ptr_test: protobuf_dep_error +$(BINDIR)/$(CONFIG)/ref_counted_ptr_test: protobuf_dep_error else -$(BINDIR)/$(CONFIG)/reference_counted_ptr_test: $(PROTOBUF_DEP) $(REFERENCE_COUNTED_PTR_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a +$(BINDIR)/$(CONFIG)/ref_counted_ptr_test: $(PROTOBUF_DEP) $(REF_COUNTED_PTR_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(REFERENCE_COUNTED_PTR_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/reference_counted_ptr_test + $(Q) $(LDXX) $(LDFLAGS) $(REF_COUNTED_PTR_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/ref_counted_ptr_test endif endif -$(OBJDIR)/$(CONFIG)/test/core/support/reference_counted_ptr_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a +$(OBJDIR)/$(CONFIG)/test/core/support/ref_counted_ptr_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a -deps_reference_counted_ptr_test: $(REFERENCE_COUNTED_PTR_TEST_OBJS:.o=.dep) +deps_ref_counted_ptr_test: $(REF_COUNTED_PTR_TEST_OBJS:.o=.dep) ifneq ($(NO_SECURE),true) ifneq ($(NO_DEPS),true) --include $(REFERENCE_COUNTED_PTR_TEST_OBJS:.o=.dep) +-include $(REF_COUNTED_PTR_TEST_OBJS:.o=.dep) endif endif -REFERENCE_COUNTED_TEST_SRC = \ - test/core/support/reference_counted_test.cc \ +REF_COUNTED_TEST_SRC = \ + test/core/support/ref_counted_test.cc \ -REFERENCE_COUNTED_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(REFERENCE_COUNTED_TEST_SRC)))) +REF_COUNTED_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(REF_COUNTED_TEST_SRC)))) ifeq ($(NO_SECURE),true) # You can't build secure targets if you don't have OpenSSL. -$(BINDIR)/$(CONFIG)/reference_counted_test: openssl_dep_error +$(BINDIR)/$(CONFIG)/ref_counted_test: openssl_dep_error else @@ -16567,26 +16567,26 @@ ifeq ($(NO_PROTOBUF),true) # You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. -$(BINDIR)/$(CONFIG)/reference_counted_test: protobuf_dep_error +$(BINDIR)/$(CONFIG)/ref_counted_test: protobuf_dep_error else -$(BINDIR)/$(CONFIG)/reference_counted_test: $(PROTOBUF_DEP) $(REFERENCE_COUNTED_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a +$(BINDIR)/$(CONFIG)/ref_counted_test: $(PROTOBUF_DEP) $(REF_COUNTED_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(REFERENCE_COUNTED_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/reference_counted_test + $(Q) $(LDXX) $(LDFLAGS) $(REF_COUNTED_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/ref_counted_test endif endif -$(OBJDIR)/$(CONFIG)/test/core/support/reference_counted_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a +$(OBJDIR)/$(CONFIG)/test/core/support/ref_counted_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a -deps_reference_counted_test: $(REFERENCE_COUNTED_TEST_OBJS:.o=.dep) +deps_ref_counted_test: $(REF_COUNTED_TEST_OBJS:.o=.dep) ifneq ($(NO_SECURE),true) ifneq ($(NO_DEPS),true) --include $(REFERENCE_COUNTED_TEST_OBJS:.o=.dep) +-include $(REF_COUNTED_TEST_OBJS:.o=.dep) endif endif diff --git a/build.yaml b/build.yaml index c41bf193e6b..bfb847e748a 100644 --- a/build.yaml +++ b/build.yaml @@ -394,8 +394,8 @@ filegroups: - src/core/lib/slice/slice_internal.h - src/core/lib/slice/slice_string_helpers.h - src/core/lib/support/debug_location.h - - src/core/lib/support/reference_counted.h - - src/core/lib/support/reference_counted_ptr.h + - src/core/lib/support/ref_counted.h + - src/core/lib/support/ref_counted_ptr.h - src/core/lib/support/vector.h - src/core/lib/surface/alarm_internal.h - src/core/lib/surface/api_trace.h @@ -4544,12 +4544,12 @@ targets: - gpr_test_util - gpr - grpc++_test_config -- name: reference_counted_ptr_test +- name: ref_counted_ptr_test gtest: true build: test language: c++ src: - - test/core/support/reference_counted_ptr_test.cc + - test/core/support/ref_counted_ptr_test.cc deps: - grpc_test_util - grpc++ @@ -4558,12 +4558,12 @@ targets: - gpr uses: - grpc++_test -- name: reference_counted_test +- name: ref_counted_test gtest: true build: test language: c++ src: - - test/core/support/reference_counted_test.cc + - test/core/support/ref_counted_test.cc deps: - grpc_test_util - grpc++ diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index e90e356aaa8..d6aa1fd6c04 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -414,8 +414,8 @@ Pod::Spec.new do |s| 'src/core/lib/slice/slice_internal.h', 'src/core/lib/slice/slice_string_helpers.h', 'src/core/lib/support/debug_location.h', - 'src/core/lib/support/reference_counted.h', - 'src/core/lib/support/reference_counted_ptr.h', + 'src/core/lib/support/ref_counted.h', + 'src/core/lib/support/ref_counted_ptr.h', 'src/core/lib/support/vector.h', 'src/core/lib/surface/alarm_internal.h', 'src/core/lib/surface/api_trace.h', @@ -892,8 +892,8 @@ Pod::Spec.new do |s| 'src/core/lib/slice/slice_internal.h', 'src/core/lib/slice/slice_string_helpers.h', 'src/core/lib/support/debug_location.h', - 'src/core/lib/support/reference_counted.h', - 'src/core/lib/support/reference_counted_ptr.h', + 'src/core/lib/support/ref_counted.h', + 'src/core/lib/support/ref_counted_ptr.h', 'src/core/lib/support/vector.h', 'src/core/lib/surface/alarm_internal.h', 'src/core/lib/surface/api_trace.h', diff --git a/grpc.gemspec b/grpc.gemspec index a58c73a59d6..7c04356cc77 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -345,8 +345,8 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/slice/slice_internal.h ) s.files += %w( src/core/lib/slice/slice_string_helpers.h ) s.files += %w( src/core/lib/support/debug_location.h ) - s.files += %w( src/core/lib/support/reference_counted.h ) - s.files += %w( src/core/lib/support/reference_counted_ptr.h ) + s.files += %w( src/core/lib/support/ref_counted.h ) + s.files += %w( src/core/lib/support/ref_counted_ptr.h ) s.files += %w( src/core/lib/support/vector.h ) s.files += %w( src/core/lib/surface/alarm_internal.h ) s.files += %w( src/core/lib/surface/api_trace.h ) diff --git a/package.xml b/package.xml index 0036481bd17..68e37b6280d 100644 --- a/package.xml +++ b/package.xml @@ -357,8 +357,8 @@ - - + + diff --git a/src/core/lib/support/reference_counted.h b/src/core/lib/support/ref_counted.h similarity index 77% rename from src/core/lib/support/reference_counted.h rename to src/core/lib/support/ref_counted.h index 3858d61b72d..4c662f91190 100644 --- a/src/core/lib/support/reference_counted.h +++ b/src/core/lib/support/ref_counted.h @@ -16,8 +16,8 @@ * */ -#ifndef GRPC_CORE_LIB_SUPPORT_REFERENCE_COUNTED_H -#define GRPC_CORE_LIB_SUPPORT_REFERENCE_COUNTED_H +#ifndef GRPC_CORE_LIB_SUPPORT_REF_COUNTED_H +#define GRPC_CORE_LIB_SUPPORT_REF_COUNTED_H #include #include @@ -31,7 +31,7 @@ namespace grpc_core { // A base class for reference-counted objects. // New objects should be created via New() and start with a refcount of 1. // When the refcount reaches 0, the object will be deleted via Delete(). -class ReferenceCounted { +class RefCounted { public: void Ref() { gpr_ref(&refs_); } @@ -42,29 +42,29 @@ class ReferenceCounted { } // Not copyable nor movable. - ReferenceCounted(const ReferenceCounted&) = delete; - ReferenceCounted& operator=(const ReferenceCounted&) = delete; + RefCounted(const RefCounted&) = delete; + RefCounted& operator=(const RefCounted&) = delete; protected: // Allow Delete() to access destructor. template friend void Delete(T*); - ReferenceCounted() { gpr_ref_init(&refs_, 1); } + RefCounted() { gpr_ref_init(&refs_, 1); } - virtual ~ReferenceCounted() {} + virtual ~RefCounted() {} private: gpr_refcount refs_; }; -// An alternative version of the ReferenceCounted base class that +// An alternative version of the RefCounted base class that // supports tracing. This is intended to be used in cases where the // object will be handled both by idiomatic C++ code using smart // pointers and legacy code that is manually calling Ref() and Unref(). // Once all of our code is converted to idiomatic C++, we may be able to // eliminate this class. -class ReferenceCountedWithTracing { +class RefCountedWithTracing { public: void Ref() { gpr_ref(&refs_); } @@ -95,23 +95,22 @@ class ReferenceCountedWithTracing { } // Not copyable nor movable. - ReferenceCountedWithTracing(const ReferenceCountedWithTracing&) = delete; - ReferenceCountedWithTracing& operator=(const ReferenceCountedWithTracing&) = - delete; + RefCountedWithTracing(const RefCountedWithTracing&) = delete; + RefCountedWithTracing& operator=(const RefCountedWithTracing&) = delete; protected: // Allow Delete() to access destructor. template friend void Delete(T*); - ReferenceCountedWithTracing() : ReferenceCountedWithTracing(nullptr) {} + RefCountedWithTracing() : RefCountedWithTracing(nullptr) {} - explicit ReferenceCountedWithTracing(TraceFlag* trace_flag) + explicit RefCountedWithTracing(TraceFlag* trace_flag) : trace_flag_(trace_flag) { gpr_ref_init(&refs_, 1); } - virtual ~ReferenceCountedWithTracing() {} + virtual ~RefCountedWithTracing() {} private: TraceFlag* trace_flag_ = nullptr; @@ -120,4 +119,4 @@ class ReferenceCountedWithTracing { } // namespace grpc_core -#endif /* GRPC_CORE_LIB_SUPPORT_REFERENCE_COUNTED_H */ +#endif /* GRPC_CORE_LIB_SUPPORT_REF_COUNTED_H */ diff --git a/src/core/lib/support/reference_counted_ptr.h b/src/core/lib/support/ref_counted_ptr.h similarity index 71% rename from src/core/lib/support/reference_counted_ptr.h rename to src/core/lib/support/ref_counted_ptr.h index 1590549bfbb..dc2385e369c 100644 --- a/src/core/lib/support/reference_counted_ptr.h +++ b/src/core/lib/support/ref_counted_ptr.h @@ -16,8 +16,8 @@ * */ -#ifndef GRPC_CORE_LIB_SUPPORT_REFERENCE_COUNTED_PTR_H -#define GRPC_CORE_LIB_SUPPORT_REFERENCE_COUNTED_PTR_H +#ifndef GRPC_CORE_LIB_SUPPORT_REF_COUNTED_PTR_H +#define GRPC_CORE_LIB_SUPPORT_REF_COUNTED_PTR_H #include @@ -26,21 +26,21 @@ namespace grpc_core { // A smart pointer class for objects that provide Ref() and Unref() methods, -// such as those provided by the ReferenceCounted base class. +// such as those provided by the RefCounted base class. template -class ReferenceCountedPtr { +class RefCountedPtr { public: - ReferenceCountedPtr() {} + RefCountedPtr() {} // If value is non-null, we take ownership of a ref to it. - explicit ReferenceCountedPtr(T* value) { value_ = value; } + explicit RefCountedPtr(T* value) { value_ = value; } // Move support. - ReferenceCountedPtr(ReferenceCountedPtr&& other) { + RefCountedPtr(RefCountedPtr&& other) { value_ = other.value_; other.value_ = nullptr; } - ReferenceCountedPtr& operator=(ReferenceCountedPtr&& other) { + RefCountedPtr& operator=(RefCountedPtr&& other) { if (value_ != nullptr) value_->Unref(); value_ = other.value_; other.value_ = nullptr; @@ -48,11 +48,11 @@ class ReferenceCountedPtr { } // Copy support. - ReferenceCountedPtr(const ReferenceCountedPtr& other) { + RefCountedPtr(const RefCountedPtr& other) { if (other.value_ != nullptr) other.value_->Ref(); value_ = other.value_; } - ReferenceCountedPtr& operator=(const ReferenceCountedPtr& other) { + RefCountedPtr& operator=(const RefCountedPtr& other) { // Note: Order of reffing and unreffing is important here in case value_ // and other.value_ are the same object. if (other.value_ != nullptr) other.value_->Ref(); @@ -61,7 +61,7 @@ class ReferenceCountedPtr { return *this; } - ~ReferenceCountedPtr() { + ~RefCountedPtr() { if (value_ != nullptr) value_->Unref(); } @@ -81,10 +81,10 @@ class ReferenceCountedPtr { }; template -inline ReferenceCountedPtr MakeReferenceCounted(Args&&... args) { - return ReferenceCountedPtr(New(std::forward(args)...)); +inline RefCountedPtr MakeRefCounted(Args&&... args) { + return RefCountedPtr(New(std::forward(args)...)); } } // namespace grpc_core -#endif /* GRPC_CORE_LIB_SUPPORT_REFERENCE_COUNTED_PTR_H */ +#endif /* GRPC_CORE_LIB_SUPPORT_REF_COUNTED_PTR_H */ diff --git a/test/core/support/BUILD b/test/core/support/BUILD index 1a8d2a13592..0e5a31c7d27 100644 --- a/test/core/support/BUILD +++ b/test/core/support/BUILD @@ -235,11 +235,11 @@ grpc_cc_test( ) grpc_cc_test( - name = "reference_counted_test", - srcs = ["reference_counted_test.cc"], + name = "ref_counted_test", + srcs = ["ref_counted_test.cc"], language = "C++", deps = [ - "//:reference_counted", + "//:ref_counted", "//test/core/util:gpr_test_util", ], external_deps = [ @@ -248,12 +248,12 @@ grpc_cc_test( ) grpc_cc_test( - name = "reference_counted_ptr_test", - srcs = ["reference_counted_ptr_test.cc"], + name = "ref_counted_ptr_test", + srcs = ["ref_counted_ptr_test.cc"], language = "C++", deps = [ - "//:reference_counted", - "//:reference_counted_ptr", + "//:ref_counted", + "//:ref_counted_ptr", "//test/core/util:gpr_test_util", ], external_deps = [ diff --git a/test/core/support/reference_counted_ptr_test.cc b/test/core/support/ref_counted_ptr_test.cc similarity index 51% rename from test/core/support/reference_counted_ptr_test.cc rename to test/core/support/ref_counted_ptr_test.cc index 45c552a1bcc..fdf5e0e8d66 100644 --- a/test/core/support/reference_counted_ptr_test.cc +++ b/test/core/support/ref_counted_ptr_test.cc @@ -16,21 +16,21 @@ * */ -#include "src/core/lib/support/reference_counted_ptr.h" +#include "src/core/lib/support/ref_counted_ptr.h" #include #include #include "src/core/lib/support/memory.h" -#include "src/core/lib/support/reference_counted.h" +#include "src/core/lib/support/ref_counted.h" #include "test/core/util/test_config.h" namespace grpc_core { namespace testing { namespace { -class Foo : public ReferenceCounted { +class Foo : public RefCounted { public: Foo() : value_(0) {} @@ -42,76 +42,76 @@ class Foo : public ReferenceCounted { int value_; }; -TEST(ReferenceCountedPtr, DefaultConstructor) { ReferenceCountedPtr foo; } +TEST(RefCountedPtr, DefaultConstructor) { RefCountedPtr foo; } -TEST(ReferenceCountedPtr, ExplicitConstructorEmpty) { - ReferenceCountedPtr foo(nullptr); +TEST(RefCountedPtr, ExplicitConstructorEmpty) { + RefCountedPtr foo(nullptr); } -TEST(ReferenceCountedPtr, ExplicitConstructor) { - ReferenceCountedPtr foo(New()); +TEST(RefCountedPtr, ExplicitConstructor) { + RefCountedPtr foo(New()); } -TEST(ReferenceCountedPtr, MoveConstructor) { - ReferenceCountedPtr foo(New()); - ReferenceCountedPtr foo2(std::move(foo)); +TEST(RefCountedPtr, MoveConstructor) { + RefCountedPtr foo(New()); + RefCountedPtr foo2(std::move(foo)); EXPECT_EQ(nullptr, foo.get()); EXPECT_NE(nullptr, foo2.get()); } -TEST(ReferenceCountedPtr, MoveAssignment) { - ReferenceCountedPtr foo(New()); - ReferenceCountedPtr foo2 = std::move(foo); +TEST(RefCountedPtr, MoveAssignment) { + RefCountedPtr foo(New()); + RefCountedPtr foo2 = std::move(foo); EXPECT_EQ(nullptr, foo.get()); EXPECT_NE(nullptr, foo2.get()); } -TEST(ReferenceCountedPtr, CopyConstructor) { - ReferenceCountedPtr foo(New()); - ReferenceCountedPtr foo2(foo); +TEST(RefCountedPtr, CopyConstructor) { + RefCountedPtr foo(New()); + RefCountedPtr foo2(foo); EXPECT_NE(nullptr, foo.get()); EXPECT_EQ(foo.get(), foo2.get()); } -TEST(ReferenceCountedPtr, CopyAssignment) { - ReferenceCountedPtr foo(New()); - ReferenceCountedPtr foo2 = foo; +TEST(RefCountedPtr, CopyAssignment) { + RefCountedPtr foo(New()); + RefCountedPtr foo2 = foo; EXPECT_NE(nullptr, foo.get()); EXPECT_EQ(foo.get(), foo2.get()); } -TEST(ReferenceCountedPtr, CopyAssignmentWhenEmpty) { - ReferenceCountedPtr foo; - ReferenceCountedPtr foo2; +TEST(RefCountedPtr, CopyAssignmentWhenEmpty) { + RefCountedPtr foo; + RefCountedPtr foo2; foo2 = foo; EXPECT_EQ(nullptr, foo.get()); EXPECT_EQ(nullptr, foo2.get()); } -TEST(ReferenceCountedPtr, CopyAssignmentToSelf) { - ReferenceCountedPtr foo(New()); +TEST(RefCountedPtr, CopyAssignmentToSelf) { + RefCountedPtr foo(New()); foo = foo; } -TEST(ReferenceCountedPtr, EnclosedScope) { - ReferenceCountedPtr foo(New()); +TEST(RefCountedPtr, EnclosedScope) { + RefCountedPtr foo(New()); { - ReferenceCountedPtr foo2(std::move(foo)); + RefCountedPtr foo2(std::move(foo)); EXPECT_EQ(nullptr, foo.get()); EXPECT_NE(nullptr, foo2.get()); } EXPECT_EQ(nullptr, foo.get()); } -TEST(ReferenceCountedPtr, ResetFromNullToNonNull) { - ReferenceCountedPtr foo; +TEST(RefCountedPtr, ResetFromNullToNonNull) { + RefCountedPtr foo; EXPECT_EQ(nullptr, foo.get()); foo.reset(New()); EXPECT_NE(nullptr, foo.get()); } -TEST(ReferenceCountedPtr, ResetFromNonNullToNonNull) { - ReferenceCountedPtr foo(New()); +TEST(RefCountedPtr, ResetFromNonNullToNonNull) { + RefCountedPtr foo(New()); EXPECT_NE(nullptr, foo.get()); Foo* original = foo.get(); foo.reset(New()); @@ -119,46 +119,46 @@ TEST(ReferenceCountedPtr, ResetFromNonNullToNonNull) { EXPECT_NE(original, foo.get()); } -TEST(ReferenceCountedPtr, ResetFromNonNullToNull) { - ReferenceCountedPtr foo(New()); +TEST(RefCountedPtr, ResetFromNonNullToNull) { + RefCountedPtr foo(New()); EXPECT_NE(nullptr, foo.get()); foo.reset(); EXPECT_EQ(nullptr, foo.get()); } -TEST(ReferenceCountedPtr, ResetFromNullToNull) { - ReferenceCountedPtr foo; +TEST(RefCountedPtr, ResetFromNullToNull) { + RefCountedPtr foo; EXPECT_EQ(nullptr, foo.get()); foo.reset(nullptr); EXPECT_EQ(nullptr, foo.get()); } -TEST(ReferenceCountedPtr, DerefernceOperators) { - ReferenceCountedPtr foo(New()); +TEST(RefCountedPtr, DerefernceOperators) { + RefCountedPtr foo(New()); foo->value(); Foo& foo_ref = *foo; foo_ref.value(); } -TEST(MakeReferenceCounted, NoArgs) { - ReferenceCountedPtr foo = MakeReferenceCounted(); +TEST(MakeRefCounted, NoArgs) { + RefCountedPtr foo = MakeRefCounted(); EXPECT_EQ(0, foo->value()); } -TEST(MakeReferenceCounted, Args) { - ReferenceCountedPtr foo = MakeReferenceCounted(3); +TEST(MakeRefCounted, Args) { + RefCountedPtr foo = MakeRefCounted(3); EXPECT_EQ(3, foo->value()); } TraceFlag foo_tracer(true, "foo"); -class FooWithTracing : public ReferenceCountedWithTracing { +class FooWithTracing : public RefCountedWithTracing { public: - FooWithTracing() : ReferenceCountedWithTracing(&foo_tracer) {} + FooWithTracing() : RefCountedWithTracing(&foo_tracer) {} }; -TEST(ReferenceCountedPtr, ReferenceCountedWithTracing) { - ReferenceCountedPtr foo(New()); +TEST(RefCountedPtr, RefCountedWithTracing) { + RefCountedPtr foo(New()); foo->Ref(DEBUG_LOCATION, "foo"); foo->Unref(DEBUG_LOCATION, "foo"); } diff --git a/test/core/support/reference_counted_test.cc b/test/core/support/ref_counted_test.cc similarity index 81% rename from test/core/support/reference_counted_test.cc rename to test/core/support/ref_counted_test.cc index 88ee5d8e557..be9b6ff7c2d 100644 --- a/test/core/support/reference_counted_test.cc +++ b/test/core/support/ref_counted_test.cc @@ -16,7 +16,7 @@ * */ -#include "src/core/lib/support/reference_counted.h" +#include "src/core/lib/support/ref_counted.h" #include @@ -27,17 +27,17 @@ namespace grpc_core { namespace testing { namespace { -class Foo : public ReferenceCounted { +class Foo : public RefCounted { public: Foo() {} }; -TEST(ReferenceCounted, Basic) { +TEST(RefCounted, Basic) { Foo* foo = New(); foo->Unref(); } -TEST(ReferenceCounted, ExtraRef) { +TEST(RefCounted, ExtraRef) { Foo* foo = New(); foo->Ref(); foo->Unref(); @@ -46,12 +46,12 @@ TEST(ReferenceCounted, ExtraRef) { TraceFlag foo_tracer(true, "foo"); -class FooWithTracing : public ReferenceCountedWithTracing { +class FooWithTracing : public RefCountedWithTracing { public: - FooWithTracing() : ReferenceCountedWithTracing(&foo_tracer) {} + FooWithTracing() : RefCountedWithTracing(&foo_tracer) {} }; -TEST(ReferenceCountedWithTracing, Basic) { +TEST(RefCountedWithTracing, Basic) { FooWithTracing* foo = New(); foo->Ref(DEBUG_LOCATION, "extra_ref"); foo->Unref(DEBUG_LOCATION, "extra_ref"); diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 078dd7bb87e..a7979f87a88 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -1037,8 +1037,8 @@ src/core/lib/support/manual_constructor.h \ src/core/lib/support/memory.h \ src/core/lib/support/mpscq.h \ src/core/lib/support/murmur_hash.h \ -src/core/lib/support/reference_counted.h \ -src/core/lib/support/reference_counted_ptr.h \ +src/core/lib/support/ref_counted.h \ +src/core/lib/support/ref_counted_ptr.h \ src/core/lib/support/spinlock.h \ src/core/lib/support/stack_lockfree.h \ src/core/lib/support/string.h \ diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 8343f88a374..827b3382ab9 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -1299,8 +1299,8 @@ src/core/lib/support/mpscq.cc \ src/core/lib/support/mpscq.h \ src/core/lib/support/murmur_hash.cc \ src/core/lib/support/murmur_hash.h \ -src/core/lib/support/reference_counted.h \ -src/core/lib/support/reference_counted_ptr.h \ +src/core/lib/support/ref_counted.h \ +src/core/lib/support/ref_counted_ptr.h \ src/core/lib/support/spinlock.h \ src/core/lib/support/stack_lockfree.cc \ src/core/lib/support/stack_lockfree.h \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 091aa171417..9e70297825f 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -3929,9 +3929,9 @@ "headers": [], "is_filegroup": false, "language": "c++", - "name": "reference_counted_ptr_test", + "name": "ref_counted_ptr_test", "src": [ - "test/core/support/reference_counted_ptr_test.cc" + "test/core/support/ref_counted_ptr_test.cc" ], "third_party": false, "type": "target" @@ -3948,9 +3948,9 @@ "headers": [], "is_filegroup": false, "language": "c++", - "name": "reference_counted_test", + "name": "ref_counted_test", "src": [ - "test/core/support/reference_counted_test.cc" + "test/core/support/ref_counted_test.cc" ], "third_party": false, "type": "target" @@ -8259,8 +8259,8 @@ "src/core/lib/slice/slice_internal.h", "src/core/lib/slice/slice_string_helpers.h", "src/core/lib/support/debug_location.h", - "src/core/lib/support/reference_counted.h", - "src/core/lib/support/reference_counted_ptr.h", + "src/core/lib/support/ref_counted.h", + "src/core/lib/support/ref_counted_ptr.h", "src/core/lib/support/vector.h", "src/core/lib/surface/alarm_internal.h", "src/core/lib/surface/api_trace.h", @@ -8398,8 +8398,8 @@ "src/core/lib/slice/slice_internal.h", "src/core/lib/slice/slice_string_helpers.h", "src/core/lib/support/debug_location.h", - "src/core/lib/support/reference_counted.h", - "src/core/lib/support/reference_counted_ptr.h", + "src/core/lib/support/ref_counted.h", + "src/core/lib/support/ref_counted_ptr.h", "src/core/lib/support/vector.h", "src/core/lib/surface/alarm_internal.h", "src/core/lib/surface/api_trace.h", diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index ba70d56085a..0a49f3adf9e 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -4138,7 +4138,7 @@ "flaky": false, "gtest": true, "language": "c++", - "name": "reference_counted_ptr_test", + "name": "ref_counted_ptr_test", "platforms": [ "linux", "mac", @@ -4162,7 +4162,7 @@ "flaky": false, "gtest": true, "language": "c++", - "name": "reference_counted_test", + "name": "ref_counted_test", "platforms": [ "linux", "mac", From 0f2a71907059938970d1eeb4b63f874a225de352 Mon Sep 17 00:00:00 2001 From: ncteisen Date: Wed, 29 Nov 2017 11:22:44 -0800 Subject: [PATCH 69/86] Add missing semicolons --- src/core/ext/filters/max_age/max_age_filter.cc | 4 ++-- src/core/lib/surface/server.cc | 2 +- src/core/lib/transport/transport.cc | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/ext/filters/max_age/max_age_filter.cc b/src/core/ext/filters/max_age/max_age_filter.cc index 001f9f39062..1387e0f88df 100644 --- a/src/core/ext/filters/max_age/max_age_filter.cc +++ b/src/core/ext/filters/max_age/max_age_filter.cc @@ -127,7 +127,7 @@ static void start_max_age_timer_after_init(grpc_exec_ctx* exec_ctx, void* arg, &chand->close_max_age_channel); gpr_mu_unlock(&chand->max_age_timer_mu); grpc_transport_op* op = grpc_make_transport_op(nullptr); - op->on_connectivity_state_change = &chand->channel_connectivity_changed, + op->on_connectivity_state_change = &chand->channel_connectivity_changed; op->connectivity_state = &chand->connectivity_state; grpc_channel_next_op(exec_ctx, grpc_channel_stack_element(chand->channel_stack, 0), op); @@ -222,7 +222,7 @@ static void channel_connectivity_changed(grpc_exec_ctx* exec_ctx, void* arg, channel_data* chand = (channel_data*)arg; if (chand->connectivity_state != GRPC_CHANNEL_SHUTDOWN) { grpc_transport_op* op = grpc_make_transport_op(nullptr); - op->on_connectivity_state_change = &chand->channel_connectivity_changed, + op->on_connectivity_state_change = &chand->channel_connectivity_changed; op->connectivity_state = &chand->connectivity_state; grpc_channel_next_op( exec_ctx, grpc_channel_stack_element(chand->channel_stack, 0), op); diff --git a/src/core/lib/surface/server.cc b/src/core/lib/surface/server.cc index 57bb6cc18bf..0f8a057f315 100644 --- a/src/core/lib/surface/server.cc +++ b/src/core/lib/surface/server.cc @@ -832,7 +832,7 @@ static void channel_connectivity_changed(grpc_exec_ctx* exec_ctx, void* cd, grpc_server* server = chand->server; if (chand->connectivity_state != GRPC_CHANNEL_SHUTDOWN) { grpc_transport_op* op = grpc_make_transport_op(nullptr); - op->on_connectivity_state_change = &chand->channel_connectivity_changed, + op->on_connectivity_state_change = &chand->channel_connectivity_changed; op->connectivity_state = &chand->connectivity_state; grpc_channel_next_op(exec_ctx, grpc_channel_stack_element( diff --git a/src/core/lib/transport/transport.cc b/src/core/lib/transport/transport.cc index ac99814d70e..5bda1541a6d 100644 --- a/src/core/lib/transport/transport.cc +++ b/src/core/lib/transport/transport.cc @@ -101,7 +101,7 @@ grpc_slice grpc_slice_from_stream_owned_buffer(grpc_stream_refcount* refcount, void* buffer, size_t length) { slice_stream_ref(&refcount->slice_refcount); grpc_slice res; - res.refcount = &refcount->slice_refcount, + res.refcount = &refcount->slice_refcount; res.data.refcounted.bytes = (uint8_t*)buffer; res.data.refcounted.length = length; return res; From 9aea2573913e504375e667d9f4500faa505b5abe Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Wed, 29 Nov 2017 12:06:36 -0800 Subject: [PATCH 70/86] clang-format --- test/core/support/ref_counted_ptr_test.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/core/support/ref_counted_ptr_test.cc b/test/core/support/ref_counted_ptr_test.cc index fdf5e0e8d66..1830edc4e59 100644 --- a/test/core/support/ref_counted_ptr_test.cc +++ b/test/core/support/ref_counted_ptr_test.cc @@ -48,9 +48,7 @@ TEST(RefCountedPtr, ExplicitConstructorEmpty) { RefCountedPtr foo(nullptr); } -TEST(RefCountedPtr, ExplicitConstructor) { - RefCountedPtr foo(New()); -} +TEST(RefCountedPtr, ExplicitConstructor) { RefCountedPtr foo(New()); } TEST(RefCountedPtr, MoveConstructor) { RefCountedPtr foo(New()); From 6ab0ba8df5ada5f39dc5a828d6f433cb170a0941 Mon Sep 17 00:00:00 2001 From: ncteisen Date: Wed, 29 Nov 2017 13:32:46 -0800 Subject: [PATCH 71/86] clang fmt --- test/core/end2end/tests/simple_request.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/core/end2end/tests/simple_request.cc b/test/core/end2end/tests/simple_request.cc index 86fe5d1e208..2ff54348133 100644 --- a/test/core/end2end/tests/simple_request.cc +++ b/test/core/end2end/tests/simple_request.cc @@ -201,7 +201,7 @@ static void simple_request_body(grpc_end2end_test_config config, GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); - // the following sanity check makes sure that the requested error string is + // the following sanity check makes sure that the requested error string is // correctly populated by the core. It looks for certain substrings that are // not likely to change much. Some parts of the error, like time created, // obviously are not checked. @@ -210,7 +210,7 @@ static void simple_request_body(grpc_end2end_test_config config, GPR_ASSERT(nullptr != strstr(error_string, "Error received from peer")); GPR_ASSERT(nullptr != strstr(error_string, "src/core/lib/surface/call.cc")); GPR_ASSERT(nullptr != strstr(error_string, "grpc_message")); - GPR_ASSERT(nullptr != strstr(error_string, "grpc_status")); + GPR_ASSERT(nullptr != strstr(error_string, "grpc_status")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); From c7d1f93e7695d5de2a4fccef93e81471d05b64a8 Mon Sep 17 00:00:00 2001 From: ncteisen Date: Wed, 29 Nov 2017 14:05:33 -0800 Subject: [PATCH 72/86] Fix windows --- test/core/end2end/tests/simple_request.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/test/core/end2end/tests/simple_request.cc b/test/core/end2end/tests/simple_request.cc index 2ff54348133..7eb74679816 100644 --- a/test/core/end2end/tests/simple_request.cc +++ b/test/core/end2end/tests/simple_request.cc @@ -208,7 +208,6 @@ static void simple_request_body(grpc_end2end_test_config config, GPR_ASSERT(nullptr != strstr(error_string, "xyz")); GPR_ASSERT(nullptr != strstr(error_string, "description")); GPR_ASSERT(nullptr != strstr(error_string, "Error received from peer")); - GPR_ASSERT(nullptr != strstr(error_string, "src/core/lib/surface/call.cc")); GPR_ASSERT(nullptr != strstr(error_string, "grpc_message")); GPR_ASSERT(nullptr != strstr(error_string, "grpc_status")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); From 9b6283a95223546805ea794d3b7b4126b104f0eb Mon Sep 17 00:00:00 2001 From: ncteisen Date: Wed, 29 Nov 2017 14:06:17 -0800 Subject: [PATCH 73/86] Make API comment more specific: --- include/grpc/impl/codegen/grpc_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h index c8c1437c915..ad668b4f11f 100644 --- a/include/grpc/impl/codegen/grpc_types.h +++ b/include/grpc/impl/codegen/grpc_types.h @@ -560,7 +560,7 @@ typedef struct grpc_op { grpc_slice* status_details; /** If this is not nullptr, it will be populated with the full fidelity * error string for debugging purposes. The application is responsible - * for freeing the data. */ + * for freeing the data by using gpr_free(). */ const char** error_string; } recv_status_on_client; struct grpc_op_recv_close_on_server { From 78683f700d6ad423b846fb2c6125cb9848ca1874 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Wed, 29 Nov 2017 18:08:22 -0800 Subject: [PATCH 74/86] Fix ObjC++ build error --- src/objective-c/tests/CronetUnitTests/CronetUnitTests.m | 8 ++++---- src/objective-c/tests/Tests.xcodeproj/project.pbxproj | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m b/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m index 0d295fb3c0b..92bc20e5b92 100644 --- a/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m +++ b/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m @@ -56,7 +56,7 @@ static void drain_cq(grpc_completion_queue *cq) { + (void)setUp { [super setUp]; - char *argv[] = {"CoreCronetEnd2EndTests"}; + char *argv[] = {(char *)"CoreCronetEnd2EndTests"}; grpc_test_init(1, argv); grpc_init(); @@ -100,7 +100,7 @@ void init_ctx(SSL_CTX *ctx) { // Install server certificate BIO *pem = BIO_new_mem_buf((void *)test_server1_cert, (int)strlen(test_server1_cert)); - X509 *cert = PEM_read_bio_X509_AUX(pem, NULL, NULL, ""); + X509 *cert = PEM_read_bio_X509_AUX(pem, NULL, NULL, (char *)""); SSL_CTX_use_certificate(ctx, cert); X509_free(cert); BIO_free(pem); @@ -108,7 +108,7 @@ void init_ctx(SSL_CTX *ctx) { // Install server private key pem = BIO_new_mem_buf((void *)test_server1_key, (int)strlen(test_server1_key)); - EVP_PKEY *key = PEM_read_bio_PrivateKey(pem, NULL, NULL, ""); + EVP_PKEY *key = PEM_read_bio_PrivateKey(pem, NULL, NULL, (char *)""); SSL_CTX_use_PrivateKey(ctx, key); EVP_PKEY_free(key); BIO_free(pem); @@ -258,7 +258,7 @@ unsigned int parse_h2_length(const char *field) { - (void)packetCoalescing:(BOOL)useCoalescing { grpc_arg arg; - arg.key = GRPC_ARG_USE_CRONET_PACKET_COALESCING; + arg.key = (char *)GRPC_ARG_USE_CRONET_PACKET_COALESCING; arg.type = GRPC_ARG_INTEGER; arg.value.integer = useCoalescing ? 1 : 0; grpc_channel_args *args = grpc_channel_args_copy_and_add(NULL, &arg, 1); diff --git a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj index 52631b4dce9..9a6cb0e7d73 100644 --- a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj +++ b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj @@ -1518,6 +1518,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_TESTABILITY = YES; + GCC_INPUT_FILETYPE = sourcecode.cpp.objcpp; INFOPLIST_FILE = CronetUnitTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.3; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; @@ -1567,6 +1568,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_TESTABILITY = YES; + GCC_INPUT_FILETYPE = sourcecode.cpp.objcpp; INFOPLIST_FILE = CronetUnitTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.3; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; @@ -1582,6 +1584,7 @@ buildSettings = { CLANG_ANALYZER_NONNULL = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + GCC_INPUT_FILETYPE = sourcecode.cpp.objcpp; INFOPLIST_FILE = CronetUnitTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.3; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; @@ -1597,6 +1600,7 @@ buildSettings = { CLANG_ANALYZER_NONNULL = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + GCC_INPUT_FILETYPE = sourcecode.cpp.objcpp; INFOPLIST_FILE = CronetUnitTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.3; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; From 81f8be347e70cf729e03d5191d08a9d4fe1b82ac Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Wed, 29 Nov 2017 18:15:20 -0800 Subject: [PATCH 75/86] Upgrade protobuf version in podspec --- src/objective-c/!ProtoCompiler.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/objective-c/!ProtoCompiler.podspec b/src/objective-c/!ProtoCompiler.podspec index 25c437911f6..12598e616a6 100644 --- a/src/objective-c/!ProtoCompiler.podspec +++ b/src/objective-c/!ProtoCompiler.podspec @@ -36,7 +36,7 @@ Pod::Spec.new do |s| # exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed # before them. s.name = '!ProtoCompiler' - v = '3.4.0' + v = '3.5.0' s.version = v s.summary = 'The Protobuf Compiler (protoc) generates Objective-C files from .proto files' s.description = <<-DESC From e641196e45486215b4ddd3c17ed6c0a6d465a9b0 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Wed, 29 Nov 2017 18:22:01 -0800 Subject: [PATCH 76/86] Fix in one more file --- src/objective-c/!ProtoCompiler-gRPCPlugin.podspec | 2 +- .../src/objective-c/!ProtoCompiler-gRPCPlugin.podspec.template | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec index 80e1069dddf..22501765f9d 100644 --- a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec +++ b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec @@ -101,7 +101,7 @@ Pod::Spec.new do |s| s.preserve_paths = plugin # Restrict the protoc version to the one supported by this plugin. - s.dependency '!ProtoCompiler', '3.4.0' + s.dependency '!ProtoCompiler', '3.5.0' # For the Protobuf dependency not to complain: s.ios.deployment_target = '7.0' s.osx.deployment_target = '10.9' diff --git a/templates/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec.template b/templates/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec.template index 196c4054686..5c1358f7c37 100644 --- a/templates/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec.template +++ b/templates/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec.template @@ -103,7 +103,7 @@ s.preserve_paths = plugin # Restrict the protoc version to the one supported by this plugin. - s.dependency '!ProtoCompiler', '3.4.0' + s.dependency '!ProtoCompiler', '3.5.0' # For the Protobuf dependency not to complain: s.ios.deployment_target = '7.0' s.osx.deployment_target = '10.9' From b75db422bdca7a15a10372d660448cb7e15be5ca Mon Sep 17 00:00:00 2001 From: Matt Kwong Date: Mon, 9 Oct 2017 17:53:05 -0700 Subject: [PATCH 77/86] Add multi-vm performance tests to Kokoro --- .gitignore | 1 + .../linux_kokoro_performance_worker_init.sh | 13 ++++ .../prepare_build_linux_perf_multilang_rc | 40 +++++++++++++ .../linux/grpc_full_performance_master.cfg | 25 ++++++++ .../linux/grpc_full_performance_master.sh | 59 +++++++++++++++++++ tools/run_tests/run_performance_tests.py | 12 +++- 6 files changed, 148 insertions(+), 2 deletions(-) create mode 100644 tools/internal_ci/helper_scripts/prepare_build_linux_perf_multilang_rc create mode 100644 tools/internal_ci/linux/grpc_full_performance_master.cfg create mode 100755 tools/internal_ci/linux/grpc_full_performance_master.sh diff --git a/.gitignore b/.gitignore index 5ccad2e4f2f..151bbbde130 100644 --- a/.gitignore +++ b/.gitignore @@ -56,6 +56,7 @@ Gemfile.lock # Temporary test reports report.xml +*/sponge_log.xml latency_trace.txt latency_trace.*.txt diff --git a/tools/gce/linux_kokoro_performance_worker_init.sh b/tools/gce/linux_kokoro_performance_worker_init.sh index ac3d39383bb..460f639f9f0 100755 --- a/tools/gce/linux_kokoro_performance_worker_init.sh +++ b/tools/gce/linux_kokoro_performance_worker_init.sh @@ -114,6 +114,19 @@ sudo apt-get update sudo apt-get install -y dotnet-dev-1.0.0-preview2.1-003155 sudo apt-get install -y dotnet-dev-1.0.1 +# C# 1.0.4 SDK +curl -O https://download.microsoft.com/download/2/4/A/24A06858-E8AC-469B-8AE6-D0CEC9BA982A/dotnet-ubuntu.16.04-x64.1.0.5.tar.gz +sudo mkdir -p /opt/dotnet +sudo tar zxf dotnet-ubuntu.16.04-x64.1.0.5.tar.gz -C /opt/dotnet +sudo ln -s /opt/dotnet/dotnet /usr/local/bin + +# C# .NET dependencies +wget http://security.ubuntu.com/ubuntu/pool/main/i/icu/libicu52_52.1-8ubuntu0.2_amd64.deb +sudo dpkg -i libicu52_52.1-8ubuntu0.2_amd64.deb +wget http://security.ubuntu.com/ubuntu/pool/main/i/icu/libicu55_55.1-7ubuntu0.3_amd64.deb +sudo dpkg -i libicu55_55.1-7ubuntu0.3_amd64.deb +sudo apt-get update && sudo apt-get install -y libicu55 + # Ruby dependencies gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 curl -sSL https://get.rvm.io | bash -s stable --ruby diff --git a/tools/internal_ci/helper_scripts/prepare_build_linux_perf_multilang_rc b/tools/internal_ci/helper_scripts/prepare_build_linux_perf_multilang_rc new file mode 100644 index 00000000000..f1031aedf39 --- /dev/null +++ b/tools/internal_ci/helper_scripts/prepare_build_linux_perf_multilang_rc @@ -0,0 +1,40 @@ +#!/bin/bash +# Copyright 2017 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Source this rc script to prepare the environment for linux perf builds + +# Need to increase open files limit and size for perf test +ulimit -n 32768 +ulimit -c unlimited + +# Download non-core gRPC repos +git clone --recursive https://github.com/grpc/grpc-go ./../grpc-go +git clone --recursive https://github.com/grpc/grpc-java ./../grpc-java +git clone --recursive https://github.com/grpc/grpc-node ./../grpc-node + +sudo pip install tabulate + +# Set up Ruby +export PATH="$HOME/.rbenv/bin:$PATH" +eval "$(rbenv init -)" +gem list bundler +gem install bundler --no-ri --no-rdoc + +# Allow SSH to Kokoro performance workers without explicit key verification +gsutil cp gs://grpc-testing-secrets/grpc_kokoro_performance_ssh_keys/id_rsa ~/.ssh +echo -e 'Host grpc-kokoro-performance*\n\tStrictHostKeyChecking no' >> ~/.ssh/config +chmod 600 ~/.ssh/id_rsa ~/.ssh/config + +git submodule update --init diff --git a/tools/internal_ci/linux/grpc_full_performance_master.cfg b/tools/internal_ci/linux/grpc_full_performance_master.cfg new file mode 100644 index 00000000000..8852130a139 --- /dev/null +++ b/tools/internal_ci/linux/grpc_full_performance_master.cfg @@ -0,0 +1,25 @@ +# Copyright 2017 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Config file for the internal CI (in protobuf text format) + +# Location of the continuous shell script in repository. +build_file: "grpc/tools/internal_ci/linux/grpc_full_performance_master.sh" +timeout_mins: 600 +action { + define_artifacts { + regex: "**/*sponge_log.xml" + regex: "**/perf_reports/**" + } +} diff --git a/tools/internal_ci/linux/grpc_full_performance_master.sh b/tools/internal_ci/linux/grpc_full_performance_master.sh new file mode 100755 index 00000000000..2ba23cbd006 --- /dev/null +++ b/tools/internal_ci/linux/grpc_full_performance_master.sh @@ -0,0 +1,59 @@ +#!/usr/bin/env bash +# Copyright 2017 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +set -ex + +# Enter the gRPC repo root +cd $(dirname $0)/../../.. + +source tools/internal_ci/helper_scripts/prepare_build_linux_perf_multilang_rc + +# run 8core client vs 8core server +tools/run_tests/run_performance_tests.py \ + -l c++ csharp ruby java python go php7 php7_protobuf_c \ + --netperf \ + --category scalable \ + --remote_worker_host grpc-kokoro-performance-server-8core grpc-kokoro-performance-client-8core grpc-kokoro-performance-client2-8core \ + -u kbuilder \ + --bq_result_table performance_test.kokoro_performance_experiment \ + --xml_report reports/8core/sponge_log.xml \ + || EXIT_CODE=1 + +# prevent pushing leftover build files to remote hosts in the next step. +git clean -fdxq --exclude=\!sponge_log.xml + +# scalability with 32cores (and upload to a different BQ table) +tools/run_tests/run_performance_tests.py \ + -l c++ java csharp go \ + --netperf \ + --category scalable \ + --remote_worker_host grpc-kokoro-performance-server-32core grpc-kokoro-performance-client-32core grpc-kokoro-performance-client2-32core \ + -u kbuilder \ + --bq_result_table performance_test.kokoro_performance_experiment_32core \ + --xml_report reports/32core/sponge_log.xml \ + || EXIT_CODE=1 + +# prevent pushing leftover build files to remote hosts in the next step. +git clean -fdxq --exclude=\!sponge_log.xml + +# selected scenarios on Windows +tools/run_tests/run_performance_tests.py \ + -l csharp \ + --category scalable \ + --remote_worker_host grpc-kokoro-performance-windows1 grpc-kokoro-performance-windows2 \ + --bq_result_table performance_test.kokoro_performance_experiment_windows \ + --xml_report reports/windows/sponge_log.xml \ + || EXIT_CODE=1 + +exit $EXIT_CODE diff --git a/tools/run_tests/run_performance_tests.py b/tools/run_tests/run_performance_tests.py index 1bbab9e894f..aa305be4660 100755 --- a/tools/run_tests/run_performance_tests.py +++ b/tools/run_tests/run_performance_tests.py @@ -196,7 +196,7 @@ def archive_repo(languages): def prepare_remote_hosts(hosts, prepare_local=False): """Prepares remote hosts (and maybe prepare localhost as well).""" - prepare_timeout = 5*60 + prepare_timeout = 10*60 prepare_jobs = [] for host in hosts: user_at_host = '%s@%s' % (_REMOTE_HOST_USERNAME, host) @@ -229,6 +229,8 @@ def prepare_remote_hosts(hosts, prepare_local=False): def build_on_remote_hosts(hosts, languages=scenario_config.LANGUAGES.keys(), build_local=False): """Builds performance worker on remote hosts (and maybe also locally).""" build_timeout = 15*60 + # Kokoro VMs (which are local only) do not have caching, so they need more time to build + local_build_timeout = 30*60 build_jobs = [] for host in hosts: user_at_host = '%s@%s' % (_REMOTE_HOST_USERNAME, host) @@ -245,7 +247,7 @@ def build_on_remote_hosts(hosts, languages=scenario_config.LANGUAGES.keys(), bui cmdline=['tools/run_tests/performance/build_performance.sh'] + languages, shortname='local_build', environ = {'CONFIG': 'opt'}, - timeout_seconds=build_timeout)) + timeout_seconds=local_build_timeout)) jobset.message('START', 'Building.', do_newline=True) num_failures, _ = jobset.run( build_jobs, newline_on_success=True, maxjobs=10) @@ -483,9 +485,15 @@ def main(): 'generating flamegraphs (e.g., "--perf_args=stat ...")')) argp.add_argument('-f', '--flame_graph_reports', default='perf_reports', type=str, help='Name of directory to output flame graph profiles to, if any are created.') + argp.add_argument('-u', '--remote_host_username', default='', type=str, + help='Use a username that isn\'t "Jenkins" to SSH into remote workers.') args = argp.parse_args() + global _REMOTE_HOST_USERNAME + if args.remote_host_username: + _REMOTE_HOST_USERNAME = args.remote_host_username + languages = set(scenario_config.LANGUAGES[l] for l in itertools.chain.from_iterable( six.iterkeys(scenario_config.LANGUAGES) if x == 'all' From 3267108e5253f43b22cca1061ba9816c0d345b38 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 30 Nov 2017 09:06:20 +0100 Subject: [PATCH 78/86] C# benchmarks provide userTime and systemTime info --- .../Grpc.IntegrationTesting/ClientRunners.cs | 13 ++- .../Grpc.IntegrationTesting/ServerRunners.cs | 13 ++- .../StressTestClient.cs | 6 +- .../Grpc.IntegrationTesting/TimeStats.cs | 90 +++++++++++++++++++ .../WallClockStopwatch.cs | 63 ------------- 5 files changed, 105 insertions(+), 80 deletions(-) create mode 100644 src/csharp/Grpc.IntegrationTesting/TimeStats.cs delete mode 100644 src/csharp/Grpc.IntegrationTesting/WallClockStopwatch.cs diff --git a/src/csharp/Grpc.IntegrationTesting/ClientRunners.cs b/src/csharp/Grpc.IntegrationTesting/ClientRunners.cs index 48905a27154..9d41d34414a 100644 --- a/src/csharp/Grpc.IntegrationTesting/ClientRunners.cs +++ b/src/csharp/Grpc.IntegrationTesting/ClientRunners.cs @@ -131,7 +131,7 @@ namespace Grpc.IntegrationTesting readonly List runnerTasks; readonly CancellationTokenSource stoppedCts = new CancellationTokenSource(); - readonly WallClockStopwatch wallClockStopwatch = new WallClockStopwatch(); + readonly TimeStats timeStats = new TimeStats(); readonly AtomicCounter statsResetCount = new AtomicCounter(); public ClientRunnerImpl(List channels, ClientType clientType, RpcType rpcType, int outstandingRpcsPerChannel, LoadParams loadParams, PayloadConfig payloadConfig, HistogramParams histogramParams, Func profilerFactory) @@ -165,7 +165,7 @@ namespace Grpc.IntegrationTesting hist.GetSnapshot(histogramData, reset); } - var secondsElapsed = wallClockStopwatch.GetElapsedSnapshot(reset).TotalSeconds; + var timeSnapshot = timeStats.GetSnapshot(reset); if (reset) { @@ -173,15 +173,14 @@ namespace Grpc.IntegrationTesting } GrpcEnvironment.Logger.Info("[ClientRunnerImpl.GetStats] GC collection counts: gen0 {0}, gen1 {1}, gen2 {2}, (histogram reset count:{3}, seconds since reset: {4})", - GC.CollectionCount(0), GC.CollectionCount(1), GC.CollectionCount(2), statsResetCount.Count, secondsElapsed); + GC.CollectionCount(0), GC.CollectionCount(1), GC.CollectionCount(2), statsResetCount.Count, timeSnapshot.WallClockTime.TotalSeconds); - // TODO: populate user time and system time return new ClientStats { Latencies = histogramData, - TimeElapsed = secondsElapsed, - TimeUser = 0, - TimeSystem = 0 + TimeElapsed = timeSnapshot.WallClockTime.TotalSeconds, + TimeUser = timeSnapshot.UserProcessorTime.TotalSeconds, + TimeSystem = timeSnapshot.PrivilegedProcessorTime.TotalSeconds }; } diff --git a/src/csharp/Grpc.IntegrationTesting/ServerRunners.cs b/src/csharp/Grpc.IntegrationTesting/ServerRunners.cs index e1b47744d50..ea29bd74e50 100644 --- a/src/csharp/Grpc.IntegrationTesting/ServerRunners.cs +++ b/src/csharp/Grpc.IntegrationTesting/ServerRunners.cs @@ -117,7 +117,7 @@ namespace Grpc.IntegrationTesting public class ServerRunnerImpl : IServerRunner { readonly Server server; - readonly WallClockStopwatch wallClockStopwatch = new WallClockStopwatch(); + readonly TimeStats timeStats = new TimeStats(); public ServerRunnerImpl(Server server) { @@ -138,17 +138,16 @@ namespace Grpc.IntegrationTesting /// The stats. public ServerStats GetStats(bool reset) { - var secondsElapsed = wallClockStopwatch.GetElapsedSnapshot(reset).TotalSeconds; + var timeSnapshot = timeStats.GetSnapshot(reset); GrpcEnvironment.Logger.Info("[ServerRunner.GetStats] GC collection counts: gen0 {0}, gen1 {1}, gen2 {2}, (seconds since last reset {3})", - GC.CollectionCount(0), GC.CollectionCount(1), GC.CollectionCount(2), secondsElapsed); + GC.CollectionCount(0), GC.CollectionCount(1), GC.CollectionCount(2), timeSnapshot.WallClockTime.TotalSeconds); - // TODO: populate user time and system time return new ServerStats { - TimeElapsed = secondsElapsed, - TimeUser = 0, - TimeSystem = 0 + TimeElapsed = timeSnapshot.WallClockTime.TotalSeconds, + TimeUser = timeSnapshot.UserProcessorTime.TotalSeconds, + TimeSystem = timeSnapshot.PrivilegedProcessorTime.TotalSeconds }; } diff --git a/src/csharp/Grpc.IntegrationTesting/StressTestClient.cs b/src/csharp/Grpc.IntegrationTesting/StressTestClient.cs index 11956e4ac8f..0c623807681 100644 --- a/src/csharp/Grpc.IntegrationTesting/StressTestClient.cs +++ b/src/csharp/Grpc.IntegrationTesting/StressTestClient.cs @@ -243,7 +243,7 @@ namespace Grpc.IntegrationTesting const string GaugeName = "csharp_overall_qps"; readonly Histogram histogram; - readonly WallClockStopwatch wallClockStopwatch = new WallClockStopwatch(); + readonly TimeStats timeStats = new TimeStats(); public MetricsServiceImpl(Histogram histogram) { @@ -280,9 +280,9 @@ namespace Grpc.IntegrationTesting long GetQpsAndReset() { var snapshot = histogram.GetSnapshot(true); - var elapsedSnapshot = wallClockStopwatch.GetElapsedSnapshot(true); + var timeSnapshot = timeStats.GetSnapshot(true); - return (long) (snapshot.Count / elapsedSnapshot.TotalSeconds); + return (long) (snapshot.Count / timeSnapshot.WallClockTime.TotalSeconds); } } } diff --git a/src/csharp/Grpc.IntegrationTesting/TimeStats.cs b/src/csharp/Grpc.IntegrationTesting/TimeStats.cs new file mode 100644 index 00000000000..6aba04c1949 --- /dev/null +++ b/src/csharp/Grpc.IntegrationTesting/TimeStats.cs @@ -0,0 +1,90 @@ +#region Copyright notice and license + +// Copyright 2015 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#endregion + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Text.RegularExpressions; +using System.Threading; +using System.Threading.Tasks; +using Google.Protobuf; +using Grpc.Core; +using Grpc.Core.Utils; +using NUnit.Framework; +using Grpc.Testing; + +namespace Grpc.IntegrationTesting +{ + /// + /// Snapshottable time statistics. + /// + public class TimeStats + { + readonly object myLock = new object(); + DateTime lastWallClock; + TimeSpan lastUserTime; + TimeSpan lastPrivilegedTime; + + public TimeStats() + { + lastWallClock = DateTime.UtcNow; + lastUserTime = Process.GetCurrentProcess().UserProcessorTime; + lastPrivilegedTime = Process.GetCurrentProcess().PrivilegedProcessorTime; + } + + public Snapshot GetSnapshot(bool reset) + { + lock (myLock) + { + var wallClock = DateTime.UtcNow; + var userTime = Process.GetCurrentProcess().UserProcessorTime; + var privilegedTime = Process.GetCurrentProcess().PrivilegedProcessorTime; + var snapshot = new Snapshot(wallClock - lastWallClock, userTime - lastUserTime, privilegedTime - lastPrivilegedTime); + + if (reset) + { + lastWallClock = wallClock; + lastUserTime = userTime; + lastPrivilegedTime = privilegedTime; + } + return snapshot; + } + } + + public class Snapshot + { + public TimeSpan WallClockTime { get; } + public TimeSpan UserProcessorTime { get; } + public TimeSpan PrivilegedProcessorTime { get; } + + public Snapshot(TimeSpan wallClockTime, TimeSpan userProcessorTime, TimeSpan privilegedProcessorTime) + { + this.WallClockTime = wallClockTime; + this.UserProcessorTime = userProcessorTime; + this.PrivilegedProcessorTime = privilegedProcessorTime; + } + + public override string ToString() + { + return string.Format("[TimeStats.Snapshot: wallClock {0}, userProcessor {1}, privilegedProcessor {2}]", WallClockTime, UserProcessorTime, PrivilegedProcessorTime); + } + } + } +} diff --git a/src/csharp/Grpc.IntegrationTesting/WallClockStopwatch.cs b/src/csharp/Grpc.IntegrationTesting/WallClockStopwatch.cs deleted file mode 100644 index 38b58f296c0..00000000000 --- a/src/csharp/Grpc.IntegrationTesting/WallClockStopwatch.cs +++ /dev/null @@ -1,63 +0,0 @@ -#region Copyright notice and license - -// Copyright 2015 gRPC authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#endregion - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Text.RegularExpressions; -using System.Threading; -using System.Threading.Tasks; -using Google.Protobuf; -using Grpc.Core; -using Grpc.Core.Utils; -using NUnit.Framework; -using Grpc.Testing; - -namespace Grpc.IntegrationTesting -{ - /// - /// Snapshottable wall clock stopwatch. - /// - public class WallClockStopwatch - { - long startTicks; - - public WallClockStopwatch() - { - this.startTicks = DateTime.UtcNow.Ticks; - } - - public TimeSpan GetElapsedSnapshot(bool reset) - { - var utcNow = DateTime.UtcNow; - - long oldStartTicks; - if (reset) - { - oldStartTicks = Interlocked.Exchange(ref this.startTicks, utcNow.Ticks); - } - else - { - oldStartTicks = this.startTicks; - } - return utcNow - new DateTime(oldStartTicks, DateTimeKind.Utc); - } - } -} From cf6c2ed5c47cbb078a179e967d420a6b47cbf93d Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 30 Nov 2017 10:41:01 +0100 Subject: [PATCH 79/86] address comments --- INSTALL.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 5d03c43ebec..430fd71989e 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -106,10 +106,10 @@ Builds gRPC C and C++ with boringssl. Before building, you need to clone the gRPC github repository and download submodules containing source code for gRPC's dependencies (that's done by the `submodule` command). ``` -> @rem You can also do just "git clone -b THE_BRANCH_YOU_WANT https://github.com/grpc/grpc" -> powershell git clone -b ((New-Object System.Net.WebClient).DownloadString(\"https://grpc.io/release\").Trim()) https://github.com/grpc/grpc +> @rem You can also do just "git clone --recursive -b THE_BRANCH_YOU_WANT https://github.com/grpc/grpc" +> powershell git clone --recursive -b ((New-Object System.Net.WebClient).DownloadString(\"https://grpc.io/release\").Trim()) https://github.com/grpc/grpc > cd grpc -> git submodule update --init +> @rem To update submodules at later time, run "git submodule update --init" ``` #### cmake: Using Visual Studio 2015 or 2017 (can only build with OPENSSL_NO_ASM). @@ -119,7 +119,7 @@ every target defined in `CMakeLists.txt` (+ few extra convenience projects added automatically by cmake). After opening the solution with Visual Studio you will be able to browse and build the code as usual. ``` -> @rem Run from grpc directory after cloning the repo and submodules. +> @rem Run from grpc directory after cloning the repo with --recursive or updating submodules. > md .build > cd .build > cmake .. -G "Visual Studio 14 2015" -DCMAKE_BUILD_TYPE=Release @@ -130,7 +130,7 @@ you will be able to browse and build the code as usual. Please note that when using Ninja, you'll still need Visual C++ (part of Visual Studio) installed to be able to compile the C/C++ sources. ``` -> @rem Run from grpc directory after cloning the repo and submodules. +> @rem Run from grpc directory after cloning the repo with --recursive or updating submodules. > md .build > cd .build > call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" x64 From 4f25daa7aff614fe820eb4d7432b0c8658bef81d Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 30 Nov 2017 17:09:30 +0100 Subject: [PATCH 80/86] dont let server shutdown run forever --- test/core/surface/concurrent_connectivity_test.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/core/surface/concurrent_connectivity_test.cc b/test/core/surface/concurrent_connectivity_test.cc index 8fa15ab3313..c7611b0dd14 100644 --- a/test/core/surface/concurrent_connectivity_test.cc +++ b/test/core/surface/concurrent_connectivity_test.cc @@ -49,10 +49,11 @@ #define NUM_OUTER_LOOPS_SHORT_TIMEOUTS 10 #define NUM_INNER_LOOPS_SHORT_TIMEOUTS 100 #define DELAY_MILLIS_SHORT_TIMEOUTS 1 -// in a successful test run, POLL_MILLIS should never be reached beause all runs -// should -// end after the shorter delay_millis +// in a successful test run, POLL_MILLIS should never be reached because all +// runs should end after the shorter delay_millis #define POLL_MILLIS_SHORT_TIMEOUTS 30000 +// it should never take longer that this to shutdown the server +#define SERVER_SHUTDOWN_TIMEOUT 30000 static void* tag(int n) { return (void*)(uintptr_t)n; } static int detag(void* p) { return (int)(uintptr_t)p; } @@ -95,7 +96,8 @@ struct server_thread_args { void server_thread(void* vargs) { struct server_thread_args* args = (struct server_thread_args*)vargs; grpc_event ev; - gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); + gpr_timespec deadline = + grpc_timeout_milliseconds_to_deadline(SERVER_SHUTDOWN_TIMEOUT); ev = grpc_completion_queue_next(args->cq, deadline, nullptr); GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); GPR_ASSERT(detag(ev.tag) == 0xd1e); From 4b947d3b165ad4e02326b03d03035bebfed529fe Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Thu, 30 Nov 2017 09:36:29 -0800 Subject: [PATCH 81/86] Verbose log of start of each test suite --- src/objective-c/tests/GRPCClientTests.m | 4 ++++ src/objective-c/tests/InteropTests.m | 1 + src/objective-c/tests/RxLibraryUnitTests.m | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/src/objective-c/tests/GRPCClientTests.m b/src/objective-c/tests/GRPCClientTests.m index 5672bdad4c1..3bab7f66711 100644 --- a/src/objective-c/tests/GRPCClientTests.m +++ b/src/objective-c/tests/GRPCClientTests.m @@ -95,6 +95,10 @@ static GRPCProtoMethod *kFullDuplexCallMethod; @implementation GRPCClientTests ++ (void)setUp { + NSLog(@"GRPCClientTests Started"); +} + - (void)setUp { // Add a custom user agent prefix that will be used in test [GRPCCall setUserAgentPrefix:@"Foo" forHost:kHostAddress]; diff --git a/src/objective-c/tests/InteropTests.m b/src/objective-c/tests/InteropTests.m index e5fcab26d86..0be8669aa2f 100644 --- a/src/objective-c/tests/InteropTests.m +++ b/src/objective-c/tests/InteropTests.m @@ -86,6 +86,7 @@ } + (void)setUp { + NSLog(@"InteropTest Started, class: %@", [[self class] description]); #ifdef GRPC_COMPILE_WITH_CRONET // Cronet setup [Cronet setHttp2Enabled:YES]; diff --git a/src/objective-c/tests/RxLibraryUnitTests.m b/src/objective-c/tests/RxLibraryUnitTests.m index 3a5adbbf378..aa178f8d454 100644 --- a/src/objective-c/tests/RxLibraryUnitTests.m +++ b/src/objective-c/tests/RxLibraryUnitTests.m @@ -58,6 +58,10 @@ @implementation RxLibraryUnitTests ++ (void)setUp { + NSLog(@"GRPCClientTests Started"); +} + #pragma mark Writeable - (void)testWriteableSingleHandlerIsCalledForValue { From 01bc32c5003ffb745a2e98b07f43fb94b6ac7d26 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Thu, 30 Nov 2017 09:49:50 -0800 Subject: [PATCH 82/86] Fine tune test output better --- src/objective-c/tests/run_tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/objective-c/tests/run_tests.sh b/src/objective-c/tests/run_tests.sh index 608ae6884b6..62c4e10b993 100755 --- a/src/objective-c/tests/run_tests.sh +++ b/src/objective-c/tests/run_tests.sh @@ -38,7 +38,7 @@ trap 'kill -9 `jobs -p` ; echo "EXIT TIME: $(date)"' EXIT # element of the pipe fails. # TODO(jcanizales): Use xctool instead? Issue #2540. set -o pipefail -XCODEBUILD_FILTER='(^CompileC |^Ld |^.*clang |^ *cd |^ *export |^Libtool |^.*libtool |^CpHeader |^ *builtin-copy )' +XCODEBUILD_FILTER='(^CompileC |^Ld |^ *[^ ]*clang |^ *cd |^ *export |^Libtool |^ *[^ ]*libtool |^CpHeader |^ *builtin-copy )' echo "TIME: $(date)" xcodebuild \ -workspace Tests.xcworkspace \ From d4a3bb817df4f1bfdf3872288fe238c4b9e70bb4 Mon Sep 17 00:00:00 2001 From: Alexander Polcyn Date: Thu, 30 Nov 2017 09:27:16 -0800 Subject: [PATCH 83/86] Allow compiling grpc without use of pthread_atfork --- setup.py | 1 + src/core/lib/iomgr/fork_posix.cc | 2 ++ 2 files changed, 3 insertions(+) diff --git a/setup.py b/setup.py index 821fda504af..73af9ebc4af 100644 --- a/setup.py +++ b/setup.py @@ -181,6 +181,7 @@ if "linux" in sys.platform or "darwin" in sys.platform: pymodinit_type = 'PyObject*' if PY3 else 'void' pymodinit = '__attribute__((visibility ("default"))) {}'.format(pymodinit_type) DEFINE_MACROS += (('PyMODINIT_FUNC', pymodinit),) + DEFINE_MACROS += (('GRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK', 1),) # By default, Python3 distutils enforces compatibility of # c plugins (.so files) with the OSX version Python3 was built with. diff --git a/src/core/lib/iomgr/fork_posix.cc b/src/core/lib/iomgr/fork_posix.cc index a55b3a349a2..f3cfd141b6a 100644 --- a/src/core/lib/iomgr/fork_posix.cc +++ b/src/core/lib/iomgr/fork_posix.cc @@ -81,7 +81,9 @@ void grpc_postfork_child() { void grpc_fork_handlers_auto_register() { if (grpc_fork_support_enabled()) { +#ifdef GRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK pthread_atfork(grpc_prefork, grpc_postfork_parent, grpc_postfork_child); +#endif // GRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK } } From 36481f5bae42724bd75089a7db2fc682f8ce3f05 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Thu, 30 Nov 2017 11:05:15 -0800 Subject: [PATCH 84/86] Somehow fork.h got omitted from BUILD --- BUILD | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/BUILD b/BUILD index d904a1ec6ee..30b410a2bd1 100644 --- a/BUILD +++ b/BUILD @@ -79,10 +79,11 @@ GRPC_PUBLIC_HDRS = [ "include/grpc/byte_buffer.h", "include/grpc/byte_buffer_reader.h", "include/grpc/compression.h", - "include/grpc/load_reporting.h", + "include/grpc/fork.h", "include/grpc/grpc.h", "include/grpc/grpc_posix.h", "include/grpc/grpc_security_constants.h", + "include/grpc/load_reporting.h", "include/grpc/slice.h", "include/grpc/slice_buffer.h", "include/grpc/status.h", From a6bdf450fdedf470dbe0e7bbdd9dc49ffbe37aab Mon Sep 17 00:00:00 2001 From: Matt Kwong Date: Thu, 30 Nov 2017 14:49:26 -0800 Subject: [PATCH 85/86] Properly preserve sponge_log.xml between performance tests --- tools/internal_ci/linux/grpc_full_performance_master.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/internal_ci/linux/grpc_full_performance_master.sh b/tools/internal_ci/linux/grpc_full_performance_master.sh index 2ba23cbd006..18468395f6f 100755 --- a/tools/internal_ci/linux/grpc_full_performance_master.sh +++ b/tools/internal_ci/linux/grpc_full_performance_master.sh @@ -31,7 +31,7 @@ tools/run_tests/run_performance_tests.py \ || EXIT_CODE=1 # prevent pushing leftover build files to remote hosts in the next step. -git clean -fdxq --exclude=\!sponge_log.xml +git clean -fdxq -e reports # scalability with 32cores (and upload to a different BQ table) tools/run_tests/run_performance_tests.py \ @@ -45,7 +45,7 @@ tools/run_tests/run_performance_tests.py \ || EXIT_CODE=1 # prevent pushing leftover build files to remote hosts in the next step. -git clean -fdxq --exclude=\!sponge_log.xml +git clean -fdxq -e reports # selected scenarios on Windows tools/run_tests/run_performance_tests.py \ From 195cf1ebfd5e3ab12d8271e116e1f022a9b23ef6 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Thu, 30 Nov 2017 10:56:06 -0800 Subject: [PATCH 86/86] Move histogram to test/core/util --- BUILD | 5 +- CMakeLists.txt | 63 ++++--- Makefile | 79 ++++----- build.yaml | 22 +-- config.m4 | 1 - config.w32 | 1 - gRPC-Core.podspec | 2 - grpc.def | 15 -- grpc.gemspec | 2 - grpc.gyp | 3 +- include/grpc/module.modulemap | 1 - include/grpc/support/histogram.h | 64 ------- package.xml | 2 - src/python/grpcio/grpc_core_dependencies.py | 1 - src/ruby/ext/grpc/rb_grpc_imports.generated.c | 30 ---- src/ruby/ext/grpc/rb_grpc_imports.generated.h | 46 ----- test/core/fling/client.cc | 18 +- .../network_benchmarks/low_level_ping_pong.cc | 18 +- test/core/support/BUILD | 10 -- test/core/support/histogram_test.cc | 163 ------------------ .../core/surface/public_headers_must_be_c89.c | 16 -- test/core/util/BUILD | 25 ++- .../support => test/core/util}/histogram.cc | 62 +++---- test/core/util/histogram.h | 62 +++++++ test/core/util/histogram_test.cc | 163 ++++++++++++++++++ test/cpp/qps/BUILD | 2 +- test/cpp/qps/histogram.h | 36 ++-- test/cpp/qps/qps_interarrival_test.cc | 10 +- test/cpp/qps/qps_worker.cc | 2 +- tools/doxygen/Doxyfile.c++ | 1 - tools/doxygen/Doxyfile.c++.internal | 1 - tools/doxygen/Doxyfile.core | 1 - tools/doxygen/Doxyfile.core.internal | 2 - .../generated/sources_and_headers.json | 36 ++-- tools/run_tests/generated/tests.json | 48 +++--- 35 files changed, 444 insertions(+), 569 deletions(-) delete mode 100644 include/grpc/support/histogram.h delete mode 100644 test/core/support/histogram_test.cc rename {src/core/lib/support => test/core/util}/histogram.cc (72%) create mode 100644 test/core/util/histogram.h create mode 100644 test/core/util/histogram_test.cc diff --git a/BUILD b/BUILD index d904a1ec6ee..82ac73f0147 100644 --- a/BUILD +++ b/BUILD @@ -54,7 +54,6 @@ GPR_PUBLIC_HDRS = [ "include/grpc/support/avl.h", "include/grpc/support/cmdline.h", "include/grpc/support/cpu.h", - "include/grpc/support/histogram.h", "include/grpc/support/host_port.h", "include/grpc/support/log.h", "include/grpc/support/log_windows.h", @@ -79,10 +78,11 @@ GRPC_PUBLIC_HDRS = [ "include/grpc/byte_buffer.h", "include/grpc/byte_buffer_reader.h", "include/grpc/compression.h", - "include/grpc/load_reporting.h", + "include/grpc/fork.h", "include/grpc/grpc.h", "include/grpc/grpc_posix.h", "include/grpc/grpc_security_constants.h", + "include/grpc/load_reporting.h", "include/grpc/slice.h", "include/grpc/slice_buffer.h", "include/grpc/status.h", @@ -446,7 +446,6 @@ grpc_cc_library( "src/core/lib/support/env_posix.cc", "src/core/lib/support/env_windows.cc", "src/core/lib/support/fork.cc", - "src/core/lib/support/histogram.cc", "src/core/lib/support/host_port.cc", "src/core/lib/support/log.cc", "src/core/lib/support/log_android.cc", diff --git a/CMakeLists.txt b/CMakeLists.txt index 760e4fa5852..ab57f662cf2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -427,7 +427,6 @@ add_dependencies(buildtests_c gpr_avl_test) add_dependencies(buildtests_c gpr_cmdline_test) add_dependencies(buildtests_c gpr_cpu_test) add_dependencies(buildtests_c gpr_env_test) -add_dependencies(buildtests_c gpr_histogram_test) add_dependencies(buildtests_c gpr_host_port_test) add_dependencies(buildtests_c gpr_log_test) add_dependencies(buildtests_c gpr_manual_constructor_test) @@ -465,6 +464,7 @@ endif() if(_gRPC_PLATFORM_LINUX) add_dependencies(buildtests_c handshake_server_with_readahead_handshaker) endif() +add_dependencies(buildtests_c histogram_test) add_dependencies(buildtests_c hpack_parser_test) add_dependencies(buildtests_c hpack_table_test) add_dependencies(buildtests_c http_parser_test) @@ -799,7 +799,6 @@ add_library(gpr src/core/lib/support/env_posix.cc src/core/lib/support/env_windows.cc src/core/lib/support/fork.cc - src/core/lib/support/histogram.cc src/core/lib/support/host_port.cc src/core/lib/support/log.cc src/core/lib/support/log_android.cc @@ -869,7 +868,6 @@ foreach(_hdr include/grpc/support/avl.h include/grpc/support/cmdline.h include/grpc/support/cpu.h - include/grpc/support/histogram.h include/grpc/support/host_port.h include/grpc/support/log.h include/grpc/support/log_windows.h @@ -1617,6 +1615,7 @@ add_library(grpc_test_util test/core/iomgr/endpoint_tests.cc test/core/util/debugger_macros.cc test/core/util/grpc_profiler.cc + test/core/util/histogram.cc test/core/util/memory_counters.cc test/core/util/mock_endpoint.cc test/core/util/parse_hexstring.cc @@ -1885,6 +1884,7 @@ add_library(grpc_test_util_unsecure test/core/iomgr/endpoint_tests.cc test/core/util/debugger_macros.cc test/core/util/grpc_profiler.cc + test/core/util/histogram.cc test/core/util/memory_counters.cc test/core/util/mock_endpoint.cc test/core/util/parse_hexstring.cc @@ -2671,7 +2671,6 @@ foreach(_hdr include/grpc/support/avl.h include/grpc/support/cmdline.h include/grpc/support/cpu.h - include/grpc/support/histogram.h include/grpc/support/host_port.h include/grpc/support/log.h include/grpc/support/log_windows.h @@ -3158,7 +3157,6 @@ foreach(_hdr include/grpc/support/avl.h include/grpc/support/cmdline.h include/grpc/support/cpu.h - include/grpc/support/histogram.h include/grpc/support/host_port.h include/grpc/support/log.h include/grpc/support/log_windows.h @@ -3905,7 +3903,6 @@ foreach(_hdr include/grpc/support/avl.h include/grpc/support/cmdline.h include/grpc/support/cpu.h - include/grpc/support/histogram.h include/grpc/support/host_port.h include/grpc/support/log.h include/grpc/support/log_windows.h @@ -6259,33 +6256,6 @@ target_link_libraries(gpr_env_test endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) -add_executable(gpr_histogram_test - test/core/support/histogram_test.cc -) - - -target_include_directories(gpr_histogram_test - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${BORINGSSL_ROOT_DIR}/include - PRIVATE ${PROTOBUF_ROOT_DIR}/src - PRIVATE ${BENCHMARK_ROOT_DIR}/include - PRIVATE ${ZLIB_ROOT_DIR} - PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib - PRIVATE ${CARES_INCLUDE_DIR} - PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares - PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include -) - -target_link_libraries(gpr_histogram_test - ${_gRPC_ALLTARGETS_LIBRARIES} - gpr_test_util - gpr -) - -endif (gRPC_BUILD_TESTS) -if (gRPC_BUILD_TESTS) - add_executable(gpr_host_port_test test/core/support/host_port_test.cc ) @@ -7221,6 +7191,33 @@ endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) +add_executable(histogram_test + test/core/util/histogram_test.cc +) + + +target_include_directories(histogram_test + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include + PRIVATE ${BORINGSSL_ROOT_DIR}/include + PRIVATE ${PROTOBUF_ROOT_DIR}/src + PRIVATE ${BENCHMARK_ROOT_DIR}/include + PRIVATE ${ZLIB_ROOT_DIR} + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib + PRIVATE ${CARES_INCLUDE_DIR} + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include +) + +target_link_libraries(histogram_test + ${_gRPC_ALLTARGETS_LIBRARIES} + grpc_test_util + gpr +) + +endif (gRPC_BUILD_TESTS) +if (gRPC_BUILD_TESTS) + add_executable(hpack_parser_test test/core/transport/chttp2/hpack_parser_test.cc ) diff --git a/Makefile b/Makefile index 3ce30059241..bd83244a616 100644 --- a/Makefile +++ b/Makefile @@ -988,7 +988,6 @@ gpr_avl_test: $(BINDIR)/$(CONFIG)/gpr_avl_test gpr_cmdline_test: $(BINDIR)/$(CONFIG)/gpr_cmdline_test gpr_cpu_test: $(BINDIR)/$(CONFIG)/gpr_cpu_test gpr_env_test: $(BINDIR)/$(CONFIG)/gpr_env_test -gpr_histogram_test: $(BINDIR)/$(CONFIG)/gpr_histogram_test gpr_host_port_test: $(BINDIR)/$(CONFIG)/gpr_host_port_test gpr_log_test: $(BINDIR)/$(CONFIG)/gpr_log_test gpr_manual_constructor_test: $(BINDIR)/$(CONFIG)/gpr_manual_constructor_test @@ -1021,6 +1020,7 @@ grpc_verify_jwt: $(BINDIR)/$(CONFIG)/grpc_verify_jwt handshake_client: $(BINDIR)/$(CONFIG)/handshake_client handshake_server: $(BINDIR)/$(CONFIG)/handshake_server handshake_server_with_readahead_handshaker: $(BINDIR)/$(CONFIG)/handshake_server_with_readahead_handshaker +histogram_test: $(BINDIR)/$(CONFIG)/histogram_test hpack_parser_fuzzer_test: $(BINDIR)/$(CONFIG)/hpack_parser_fuzzer_test hpack_parser_test: $(BINDIR)/$(CONFIG)/hpack_parser_test hpack_table_test: $(BINDIR)/$(CONFIG)/hpack_table_test @@ -1383,7 +1383,6 @@ buildtests_c: privatelibs_c \ $(BINDIR)/$(CONFIG)/gpr_cmdline_test \ $(BINDIR)/$(CONFIG)/gpr_cpu_test \ $(BINDIR)/$(CONFIG)/gpr_env_test \ - $(BINDIR)/$(CONFIG)/gpr_histogram_test \ $(BINDIR)/$(CONFIG)/gpr_host_port_test \ $(BINDIR)/$(CONFIG)/gpr_log_test \ $(BINDIR)/$(CONFIG)/gpr_manual_constructor_test \ @@ -1413,6 +1412,7 @@ buildtests_c: privatelibs_c \ $(BINDIR)/$(CONFIG)/handshake_client \ $(BINDIR)/$(CONFIG)/handshake_server \ $(BINDIR)/$(CONFIG)/handshake_server_with_readahead_handshaker \ + $(BINDIR)/$(CONFIG)/histogram_test \ $(BINDIR)/$(CONFIG)/hpack_parser_test \ $(BINDIR)/$(CONFIG)/hpack_table_test \ $(BINDIR)/$(CONFIG)/http_parser_test \ @@ -1829,8 +1829,6 @@ test_c: buildtests_c $(Q) $(BINDIR)/$(CONFIG)/gpr_cpu_test || ( echo test gpr_cpu_test failed ; exit 1 ) $(E) "[RUN] Testing gpr_env_test" $(Q) $(BINDIR)/$(CONFIG)/gpr_env_test || ( echo test gpr_env_test failed ; exit 1 ) - $(E) "[RUN] Testing gpr_histogram_test" - $(Q) $(BINDIR)/$(CONFIG)/gpr_histogram_test || ( echo test gpr_histogram_test failed ; exit 1 ) $(E) "[RUN] Testing gpr_host_port_test" $(Q) $(BINDIR)/$(CONFIG)/gpr_host_port_test || ( echo test gpr_host_port_test failed ; exit 1 ) $(E) "[RUN] Testing gpr_log_test" @@ -1887,6 +1885,8 @@ test_c: buildtests_c $(Q) $(BINDIR)/$(CONFIG)/handshake_server || ( echo test handshake_server failed ; exit 1 ) $(E) "[RUN] Testing handshake_server_with_readahead_handshaker" $(Q) $(BINDIR)/$(CONFIG)/handshake_server_with_readahead_handshaker || ( echo test handshake_server_with_readahead_handshaker failed ; exit 1 ) + $(E) "[RUN] Testing histogram_test" + $(Q) $(BINDIR)/$(CONFIG)/histogram_test || ( echo test histogram_test failed ; exit 1 ) $(E) "[RUN] Testing hpack_parser_test" $(Q) $(BINDIR)/$(CONFIG)/hpack_parser_test || ( echo test hpack_parser_test failed ; exit 1 ) $(E) "[RUN] Testing hpack_table_test" @@ -2829,7 +2829,6 @@ LIBGPR_SRC = \ src/core/lib/support/env_posix.cc \ src/core/lib/support/env_windows.cc \ src/core/lib/support/fork.cc \ - src/core/lib/support/histogram.cc \ src/core/lib/support/host_port.cc \ src/core/lib/support/log.cc \ src/core/lib/support/log_android.cc \ @@ -2869,7 +2868,6 @@ PUBLIC_HEADERS_C += \ include/grpc/support/avl.h \ include/grpc/support/cmdline.h \ include/grpc/support/cpu.h \ - include/grpc/support/histogram.h \ include/grpc/support/host_port.h \ include/grpc/support/log.h \ include/grpc/support/log_windows.h \ @@ -3623,6 +3621,7 @@ LIBGRPC_TEST_UTIL_SRC = \ test/core/iomgr/endpoint_tests.cc \ test/core/util/debugger_macros.cc \ test/core/util/grpc_profiler.cc \ + test/core/util/histogram.cc \ test/core/util/memory_counters.cc \ test/core/util/mock_endpoint.cc \ test/core/util/parse_hexstring.cc \ @@ -3882,6 +3881,7 @@ LIBGRPC_TEST_UTIL_UNSECURE_SRC = \ test/core/iomgr/endpoint_tests.cc \ test/core/util/debugger_macros.cc \ test/core/util/grpc_profiler.cc \ + test/core/util/histogram.cc \ test/core/util/memory_counters.cc \ test/core/util/mock_endpoint.cc \ test/core/util/parse_hexstring.cc \ @@ -4591,7 +4591,6 @@ PUBLIC_HEADERS_CXX += \ include/grpc/support/avl.h \ include/grpc/support/cmdline.h \ include/grpc/support/cpu.h \ - include/grpc/support/histogram.h \ include/grpc/support/host_port.h \ include/grpc/support/log.h \ include/grpc/support/log_windows.h \ @@ -5079,7 +5078,6 @@ PUBLIC_HEADERS_CXX += \ include/grpc/support/avl.h \ include/grpc/support/cmdline.h \ include/grpc/support/cpu.h \ - include/grpc/support/histogram.h \ include/grpc/support/host_port.h \ include/grpc/support/log.h \ include/grpc/support/log_windows.h \ @@ -5801,7 +5799,6 @@ PUBLIC_HEADERS_CXX += \ include/grpc/support/avl.h \ include/grpc/support/cmdline.h \ include/grpc/support/cpu.h \ - include/grpc/support/histogram.h \ include/grpc/support/host_port.h \ include/grpc/support/log.h \ include/grpc/support/log_windows.h \ @@ -10095,38 +10092,6 @@ endif endif -GPR_HISTOGRAM_TEST_SRC = \ - test/core/support/histogram_test.cc \ - -GPR_HISTOGRAM_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GPR_HISTOGRAM_TEST_SRC)))) -ifeq ($(NO_SECURE),true) - -# You can't build secure targets if you don't have OpenSSL. - -$(BINDIR)/$(CONFIG)/gpr_histogram_test: openssl_dep_error - -else - - - -$(BINDIR)/$(CONFIG)/gpr_histogram_test: $(GPR_HISTOGRAM_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a - $(E) "[LD] Linking $@" - $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(GPR_HISTOGRAM_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gpr_histogram_test - -endif - -$(OBJDIR)/$(CONFIG)/test/core/support/histogram_test.o: $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a - -deps_gpr_histogram_test: $(GPR_HISTOGRAM_TEST_OBJS:.o=.dep) - -ifneq ($(NO_SECURE),true) -ifneq ($(NO_DEPS),true) --include $(GPR_HISTOGRAM_TEST_OBJS:.o=.dep) -endif -endif - - GPR_HOST_PORT_TEST_SRC = \ test/core/support/host_port_test.cc \ @@ -11157,6 +11122,38 @@ endif endif +HISTOGRAM_TEST_SRC = \ + test/core/util/histogram_test.cc \ + +HISTOGRAM_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(HISTOGRAM_TEST_SRC)))) +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL. + +$(BINDIR)/$(CONFIG)/histogram_test: openssl_dep_error + +else + + + +$(BINDIR)/$(CONFIG)/histogram_test: $(HISTOGRAM_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LD) $(LDFLAGS) $(HISTOGRAM_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/histogram_test + +endif + +$(OBJDIR)/$(CONFIG)/test/core/util/histogram_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + +deps_histogram_test: $(HISTOGRAM_TEST_OBJS:.o=.dep) + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(HISTOGRAM_TEST_OBJS:.o=.dep) +endif +endif + + HPACK_PARSER_FUZZER_TEST_SRC = \ test/core/transport/chttp2/hpack_parser_fuzzer_test.cc \ diff --git a/build.yaml b/build.yaml index 0908f7efd23..40c37dc53f7 100644 --- a/build.yaml +++ b/build.yaml @@ -41,7 +41,6 @@ filegroups: - src/core/lib/support/env_posix.cc - src/core/lib/support/env_windows.cc - src/core/lib/support/fork.cc - - src/core/lib/support/histogram.cc - src/core/lib/support/host_port.cc - src/core/lib/support/log.cc - src/core/lib/support/log_android.cc @@ -83,7 +82,6 @@ filegroups: - include/grpc/support/avl.h - include/grpc/support/cmdline.h - include/grpc/support/cpu.h - - include/grpc/support/histogram.h - include/grpc/support/host_port.h - include/grpc/support/log.h - include/grpc/support/log_windows.h @@ -714,6 +712,7 @@ filegroups: - test/core/iomgr/endpoint_tests.h - test/core/util/debugger_macros.h - test/core/util/grpc_profiler.h + - test/core/util/histogram.h - test/core/util/memory_counters.h - test/core/util/mock_endpoint.h - test/core/util/parse_hexstring.h @@ -731,6 +730,7 @@ filegroups: - test/core/iomgr/endpoint_tests.cc - test/core/util/debugger_macros.cc - test/core/util/grpc_profiler.cc + - test/core/util/histogram.cc - test/core/util/memory_counters.cc - test/core/util/mock_endpoint.cc - test/core/util/parse_hexstring.cc @@ -2196,15 +2196,6 @@ targets: - gpr_test_util - gpr uses_polling: false -- name: gpr_histogram_test - build: test - language: c - src: - - test/core/support/histogram_test.cc - deps: - - gpr_test_util - - gpr - uses_polling: false - name: gpr_host_port_test build: test language: c @@ -2553,6 +2544,15 @@ targets: platforms: - linux secure: true +- name: histogram_test + build: test + language: c + src: + - test/core/util/histogram_test.cc + deps: + - grpc_test_util + - gpr + uses_polling: false - name: hpack_parser_fuzzer_test build: fuzzer language: c diff --git a/config.m4 b/config.m4 index 6fe897f4d51..c026b83f359 100644 --- a/config.m4 +++ b/config.m4 @@ -54,7 +54,6 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/support/env_posix.cc \ src/core/lib/support/env_windows.cc \ src/core/lib/support/fork.cc \ - src/core/lib/support/histogram.cc \ src/core/lib/support/host_port.cc \ src/core/lib/support/log.cc \ src/core/lib/support/log_android.cc \ diff --git a/config.w32 b/config.w32 index c2a4327c729..cd3a16a4653 100644 --- a/config.w32 +++ b/config.w32 @@ -31,7 +31,6 @@ if (PHP_GRPC != "no") { "src\\core\\lib\\support\\env_posix.cc " + "src\\core\\lib\\support\\env_windows.cc " + "src\\core\\lib\\support\\fork.cc " + - "src\\core\\lib\\support\\histogram.cc " + "src\\core\\lib\\support\\host_port.cc " + "src\\core\\lib\\support\\log.cc " + "src\\core\\lib\\support\\log_android.cc " + diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 82dda2017fb..39b848414ad 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -113,7 +113,6 @@ Pod::Spec.new do |s| 'include/grpc/support/avl.h', 'include/grpc/support/cmdline.h', 'include/grpc/support/cpu.h', - 'include/grpc/support/histogram.h', 'include/grpc/support/host_port.h', 'include/grpc/support/log.h', 'include/grpc/support/log_windows.h', @@ -223,7 +222,6 @@ Pod::Spec.new do |s| 'src/core/lib/support/env_posix.cc', 'src/core/lib/support/env_windows.cc', 'src/core/lib/support/fork.cc', - 'src/core/lib/support/histogram.cc', 'src/core/lib/support/host_port.cc', 'src/core/lib/support/log.cc', 'src/core/lib/support/log_android.cc', diff --git a/grpc.def b/grpc.def index 07c0b3e928d..d4a18ccefc1 100644 --- a/grpc.def +++ b/grpc.def @@ -200,21 +200,6 @@ EXPORTS gpr_cmdline_usage_string gpr_cpu_num_cores gpr_cpu_current_cpu - gpr_histogram_create - gpr_histogram_destroy - gpr_histogram_add - gpr_histogram_merge - gpr_histogram_percentile - gpr_histogram_mean - gpr_histogram_stddev - gpr_histogram_variance - gpr_histogram_maximum - gpr_histogram_minimum - gpr_histogram_count - gpr_histogram_sum - gpr_histogram_sum_of_squares - gpr_histogram_get_contents - gpr_histogram_merge_contents gpr_join_host_port gpr_split_host_port gpr_log_severity_string diff --git a/grpc.gemspec b/grpc.gemspec index e553b770e43..d1859952619 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -52,7 +52,6 @@ Gem::Specification.new do |s| s.files += %w( include/grpc/support/avl.h ) s.files += %w( include/grpc/support/cmdline.h ) s.files += %w( include/grpc/support/cpu.h ) - s.files += %w( include/grpc/support/histogram.h ) s.files += %w( include/grpc/support/host_port.h ) s.files += %w( include/grpc/support/log.h ) s.files += %w( include/grpc/support/log_windows.h ) @@ -117,7 +116,6 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/support/env_posix.cc ) s.files += %w( src/core/lib/support/env_windows.cc ) s.files += %w( src/core/lib/support/fork.cc ) - s.files += %w( src/core/lib/support/histogram.cc ) s.files += %w( src/core/lib/support/host_port.cc ) s.files += %w( src/core/lib/support/log.cc ) s.files += %w( src/core/lib/support/log_android.cc ) diff --git a/grpc.gyp b/grpc.gyp index f2033b47b0b..4ceb480282c 100644 --- a/grpc.gyp +++ b/grpc.gyp @@ -173,7 +173,6 @@ 'src/core/lib/support/env_posix.cc', 'src/core/lib/support/env_windows.cc', 'src/core/lib/support/fork.cc', - 'src/core/lib/support/histogram.cc', 'src/core/lib/support/host_port.cc', 'src/core/lib/support/log.cc', 'src/core/lib/support/log_android.cc', @@ -506,6 +505,7 @@ 'test/core/iomgr/endpoint_tests.cc', 'test/core/util/debugger_macros.cc', 'test/core/util/grpc_profiler.cc', + 'test/core/util/histogram.cc', 'test/core/util/memory_counters.cc', 'test/core/util/mock_endpoint.cc', 'test/core/util/parse_hexstring.cc', @@ -716,6 +716,7 @@ 'test/core/iomgr/endpoint_tests.cc', 'test/core/util/debugger_macros.cc', 'test/core/util/grpc_profiler.cc', + 'test/core/util/histogram.cc', 'test/core/util/memory_counters.cc', 'test/core/util/mock_endpoint.cc', 'test/core/util/parse_hexstring.cc', diff --git a/include/grpc/module.modulemap b/include/grpc/module.modulemap index 0faa448b70f..67136cba8ad 100644 --- a/include/grpc/module.modulemap +++ b/include/grpc/module.modulemap @@ -7,7 +7,6 @@ framework module grpc { header "support/avl.h" header "support/cmdline.h" header "support/cpu.h" - header "support/histogram.h" header "support/host_port.h" header "support/log.h" header "support/log_windows.h" diff --git a/include/grpc/support/histogram.h b/include/grpc/support/histogram.h deleted file mode 100644 index d2794d847e8..00000000000 --- a/include/grpc/support/histogram.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPC_SUPPORT_HISTOGRAM_H -#define GRPC_SUPPORT_HISTOGRAM_H - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct gpr_histogram gpr_histogram; - -GPRAPI gpr_histogram* gpr_histogram_create(double resolution, - double max_bucket_start); -GPRAPI void gpr_histogram_destroy(gpr_histogram* h); -GPRAPI void gpr_histogram_add(gpr_histogram* h, double x); - -/** The following merges the second histogram into the first. It only works - if they have the same buckets and resolution. Returns 0 on failure, 1 - on success */ -GPRAPI int gpr_histogram_merge(gpr_histogram* dst, const gpr_histogram* src); - -GPRAPI double gpr_histogram_percentile(gpr_histogram* histogram, - double percentile); -GPRAPI double gpr_histogram_mean(gpr_histogram* histogram); -GPRAPI double gpr_histogram_stddev(gpr_histogram* histogram); -GPRAPI double gpr_histogram_variance(gpr_histogram* histogram); -GPRAPI double gpr_histogram_maximum(gpr_histogram* histogram); -GPRAPI double gpr_histogram_minimum(gpr_histogram* histogram); -GPRAPI double gpr_histogram_count(gpr_histogram* histogram); -GPRAPI double gpr_histogram_sum(gpr_histogram* histogram); -GPRAPI double gpr_histogram_sum_of_squares(gpr_histogram* histogram); - -GPRAPI const uint32_t* gpr_histogram_get_contents(gpr_histogram* histogram, - size_t* count); -GPRAPI void gpr_histogram_merge_contents(gpr_histogram* histogram, - const uint32_t* data, - size_t data_count, double min_seen, - double max_seen, double sum, - double sum_of_squares, double count); - -#ifdef __cplusplus -} -#endif - -#endif /* GRPC_SUPPORT_HISTOGRAM_H */ diff --git a/package.xml b/package.xml index 435fb4c2c26..b4d8c886930 100644 --- a/package.xml +++ b/package.xml @@ -64,7 +64,6 @@ - @@ -129,7 +128,6 @@ - diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 56d6ebd8425..d2a68f0902f 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -30,7 +30,6 @@ CORE_SOURCE_FILES = [ 'src/core/lib/support/env_posix.cc', 'src/core/lib/support/env_windows.cc', 'src/core/lib/support/fork.cc', - 'src/core/lib/support/histogram.cc', 'src/core/lib/support/host_port.cc', 'src/core/lib/support/log.cc', 'src/core/lib/support/log_android.cc', diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.c b/src/ruby/ext/grpc/rb_grpc_imports.generated.c index 648d515003a..56f1d4c93f4 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.c +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.c @@ -223,21 +223,6 @@ gpr_cmdline_destroy_type gpr_cmdline_destroy_import; gpr_cmdline_usage_string_type gpr_cmdline_usage_string_import; gpr_cpu_num_cores_type gpr_cpu_num_cores_import; gpr_cpu_current_cpu_type gpr_cpu_current_cpu_import; -gpr_histogram_create_type gpr_histogram_create_import; -gpr_histogram_destroy_type gpr_histogram_destroy_import; -gpr_histogram_add_type gpr_histogram_add_import; -gpr_histogram_merge_type gpr_histogram_merge_import; -gpr_histogram_percentile_type gpr_histogram_percentile_import; -gpr_histogram_mean_type gpr_histogram_mean_import; -gpr_histogram_stddev_type gpr_histogram_stddev_import; -gpr_histogram_variance_type gpr_histogram_variance_import; -gpr_histogram_maximum_type gpr_histogram_maximum_import; -gpr_histogram_minimum_type gpr_histogram_minimum_import; -gpr_histogram_count_type gpr_histogram_count_import; -gpr_histogram_sum_type gpr_histogram_sum_import; -gpr_histogram_sum_of_squares_type gpr_histogram_sum_of_squares_import; -gpr_histogram_get_contents_type gpr_histogram_get_contents_import; -gpr_histogram_merge_contents_type gpr_histogram_merge_contents_import; gpr_join_host_port_type gpr_join_host_port_import; gpr_split_host_port_type gpr_split_host_port_import; gpr_log_severity_string_type gpr_log_severity_string_import; @@ -510,21 +495,6 @@ void grpc_rb_load_imports(HMODULE library) { gpr_cmdline_usage_string_import = (gpr_cmdline_usage_string_type) GetProcAddress(library, "gpr_cmdline_usage_string"); gpr_cpu_num_cores_import = (gpr_cpu_num_cores_type) GetProcAddress(library, "gpr_cpu_num_cores"); gpr_cpu_current_cpu_import = (gpr_cpu_current_cpu_type) GetProcAddress(library, "gpr_cpu_current_cpu"); - gpr_histogram_create_import = (gpr_histogram_create_type) GetProcAddress(library, "gpr_histogram_create"); - gpr_histogram_destroy_import = (gpr_histogram_destroy_type) GetProcAddress(library, "gpr_histogram_destroy"); - gpr_histogram_add_import = (gpr_histogram_add_type) GetProcAddress(library, "gpr_histogram_add"); - gpr_histogram_merge_import = (gpr_histogram_merge_type) GetProcAddress(library, "gpr_histogram_merge"); - gpr_histogram_percentile_import = (gpr_histogram_percentile_type) GetProcAddress(library, "gpr_histogram_percentile"); - gpr_histogram_mean_import = (gpr_histogram_mean_type) GetProcAddress(library, "gpr_histogram_mean"); - gpr_histogram_stddev_import = (gpr_histogram_stddev_type) GetProcAddress(library, "gpr_histogram_stddev"); - gpr_histogram_variance_import = (gpr_histogram_variance_type) GetProcAddress(library, "gpr_histogram_variance"); - gpr_histogram_maximum_import = (gpr_histogram_maximum_type) GetProcAddress(library, "gpr_histogram_maximum"); - gpr_histogram_minimum_import = (gpr_histogram_minimum_type) GetProcAddress(library, "gpr_histogram_minimum"); - gpr_histogram_count_import = (gpr_histogram_count_type) GetProcAddress(library, "gpr_histogram_count"); - gpr_histogram_sum_import = (gpr_histogram_sum_type) GetProcAddress(library, "gpr_histogram_sum"); - gpr_histogram_sum_of_squares_import = (gpr_histogram_sum_of_squares_type) GetProcAddress(library, "gpr_histogram_sum_of_squares"); - gpr_histogram_get_contents_import = (gpr_histogram_get_contents_type) GetProcAddress(library, "gpr_histogram_get_contents"); - gpr_histogram_merge_contents_import = (gpr_histogram_merge_contents_type) GetProcAddress(library, "gpr_histogram_merge_contents"); gpr_join_host_port_import = (gpr_join_host_port_type) GetProcAddress(library, "gpr_join_host_port"); gpr_split_host_port_import = (gpr_split_host_port_type) GetProcAddress(library, "gpr_split_host_port"); gpr_log_severity_string_import = (gpr_log_severity_string_type) GetProcAddress(library, "gpr_log_severity_string"); diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.h b/src/ruby/ext/grpc/rb_grpc_imports.generated.h index c2698d16ea4..62223fda5b7 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.h +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.h @@ -36,7 +36,6 @@ #include #include #include -#include #include #include #include @@ -649,51 +648,6 @@ extern gpr_cpu_num_cores_type gpr_cpu_num_cores_import; typedef unsigned(*gpr_cpu_current_cpu_type)(void); extern gpr_cpu_current_cpu_type gpr_cpu_current_cpu_import; #define gpr_cpu_current_cpu gpr_cpu_current_cpu_import -typedef gpr_histogram*(*gpr_histogram_create_type)(double resolution, double max_bucket_start); -extern gpr_histogram_create_type gpr_histogram_create_import; -#define gpr_histogram_create gpr_histogram_create_import -typedef void(*gpr_histogram_destroy_type)(gpr_histogram* h); -extern gpr_histogram_destroy_type gpr_histogram_destroy_import; -#define gpr_histogram_destroy gpr_histogram_destroy_import -typedef void(*gpr_histogram_add_type)(gpr_histogram* h, double x); -extern gpr_histogram_add_type gpr_histogram_add_import; -#define gpr_histogram_add gpr_histogram_add_import -typedef int(*gpr_histogram_merge_type)(gpr_histogram* dst, const gpr_histogram* src); -extern gpr_histogram_merge_type gpr_histogram_merge_import; -#define gpr_histogram_merge gpr_histogram_merge_import -typedef double(*gpr_histogram_percentile_type)(gpr_histogram* histogram, double percentile); -extern gpr_histogram_percentile_type gpr_histogram_percentile_import; -#define gpr_histogram_percentile gpr_histogram_percentile_import -typedef double(*gpr_histogram_mean_type)(gpr_histogram* histogram); -extern gpr_histogram_mean_type gpr_histogram_mean_import; -#define gpr_histogram_mean gpr_histogram_mean_import -typedef double(*gpr_histogram_stddev_type)(gpr_histogram* histogram); -extern gpr_histogram_stddev_type gpr_histogram_stddev_import; -#define gpr_histogram_stddev gpr_histogram_stddev_import -typedef double(*gpr_histogram_variance_type)(gpr_histogram* histogram); -extern gpr_histogram_variance_type gpr_histogram_variance_import; -#define gpr_histogram_variance gpr_histogram_variance_import -typedef double(*gpr_histogram_maximum_type)(gpr_histogram* histogram); -extern gpr_histogram_maximum_type gpr_histogram_maximum_import; -#define gpr_histogram_maximum gpr_histogram_maximum_import -typedef double(*gpr_histogram_minimum_type)(gpr_histogram* histogram); -extern gpr_histogram_minimum_type gpr_histogram_minimum_import; -#define gpr_histogram_minimum gpr_histogram_minimum_import -typedef double(*gpr_histogram_count_type)(gpr_histogram* histogram); -extern gpr_histogram_count_type gpr_histogram_count_import; -#define gpr_histogram_count gpr_histogram_count_import -typedef double(*gpr_histogram_sum_type)(gpr_histogram* histogram); -extern gpr_histogram_sum_type gpr_histogram_sum_import; -#define gpr_histogram_sum gpr_histogram_sum_import -typedef double(*gpr_histogram_sum_of_squares_type)(gpr_histogram* histogram); -extern gpr_histogram_sum_of_squares_type gpr_histogram_sum_of_squares_import; -#define gpr_histogram_sum_of_squares gpr_histogram_sum_of_squares_import -typedef const uint32_t*(*gpr_histogram_get_contents_type)(gpr_histogram* histogram, size_t* count); -extern gpr_histogram_get_contents_type gpr_histogram_get_contents_import; -#define gpr_histogram_get_contents gpr_histogram_get_contents_import -typedef void(*gpr_histogram_merge_contents_type)(gpr_histogram* histogram, const uint32_t* data, size_t data_count, double min_seen, double max_seen, double sum, double sum_of_squares, double count); -extern gpr_histogram_merge_contents_type gpr_histogram_merge_contents_import; -#define gpr_histogram_merge_contents gpr_histogram_merge_contents_import typedef int(*gpr_join_host_port_type)(char** out, const char* host, int port); extern gpr_join_host_port_type gpr_join_host_port_import; #define gpr_join_host_port gpr_join_host_port_import diff --git a/test/core/fling/client.cc b/test/core/fling/client.cc index 544b66d4808..69fb6dc7c71 100644 --- a/test/core/fling/client.cc +++ b/test/core/fling/client.cc @@ -22,15 +22,15 @@ #include #include -#include #include #include #include #include "src/core/lib/profiling/timers.h" #include "test/core/util/grpc_profiler.h" +#include "test/core/util/histogram.h" #include "test/core/util/test_config.h" -static gpr_histogram* histogram; +static grpc_histogram* histogram; static grpc_byte_buffer* the_buffer; static grpc_channel* channel; static grpc_completion_queue* cq; @@ -195,7 +195,7 @@ int main(int argc, char** argv) { channel = grpc_insecure_channel_create(target, nullptr, nullptr); cq = grpc_completion_queue_create_for_next(nullptr); the_buffer = grpc_raw_byte_buffer_create(&slice, (size_t)payload_size); - histogram = gpr_histogram_create(0.01, 60e9); + histogram = grpc_histogram_create(0.01, 60e9); sc.init(); @@ -213,7 +213,7 @@ int main(int argc, char** argv) { start = now(); sc.do_one_step(); stop = now(); - gpr_histogram_add(histogram, stop - start); + grpc_histogram_add(histogram, stop - start); } grpc_profiler_stop(); @@ -232,11 +232,11 @@ int main(int argc, char** argv) { grpc_slice_unref(slice); gpr_log(GPR_INFO, "latency (50/95/99/99.9): %f/%f/%f/%f", - gpr_histogram_percentile(histogram, 50), - gpr_histogram_percentile(histogram, 95), - gpr_histogram_percentile(histogram, 99), - gpr_histogram_percentile(histogram, 99.9)); - gpr_histogram_destroy(histogram); + grpc_histogram_percentile(histogram, 50), + grpc_histogram_percentile(histogram, 95), + grpc_histogram_percentile(histogram, 99), + grpc_histogram_percentile(histogram, 99.9)); + grpc_histogram_destroy(histogram); grpc_shutdown(); diff --git a/test/core/network_benchmarks/low_level_ping_pong.cc b/test/core/network_benchmarks/low_level_ping_pong.cc index 687395d9165..2ae9a45d7c6 100644 --- a/test/core/network_benchmarks/low_level_ping_pong.cc +++ b/test/core/network_benchmarks/low_level_ping_pong.cc @@ -36,13 +36,13 @@ #include #include -#include #include #include #include #include #include "src/core/lib/iomgr/error.h" #include "src/core/lib/iomgr/socket_utils_posix.h" +#include "test/core/util/histogram.h" typedef struct fd_pair { int read_fd; @@ -275,14 +275,14 @@ static void server_thread_wrap(void* arg) { server_thread(args); } -static void print_histogram(gpr_histogram* histogram) { +static void print_histogram(grpc_histogram* histogram) { /* TODO(klempner): Print more detailed information, such as detailed histogram buckets */ gpr_log(GPR_INFO, "latency (50/95/99/99.9): %f/%f/%f/%f", - gpr_histogram_percentile(histogram, 50), - gpr_histogram_percentile(histogram, 95), - gpr_histogram_percentile(histogram, 99), - gpr_histogram_percentile(histogram, 99.9)); + grpc_histogram_percentile(histogram, 50), + grpc_histogram_percentile(histogram, 95), + grpc_histogram_percentile(histogram, 99), + grpc_histogram_percentile(histogram, 99.9)); } static double now(void) { @@ -293,7 +293,7 @@ static double now(void) { static void client_thread(thread_args* args) { char* buf = static_cast(gpr_malloc(args->msg_size * sizeof(char))); memset(buf, 0, args->msg_size * sizeof(char)); - gpr_histogram* histogram = gpr_histogram_create(0.01, 60e9); + grpc_histogram* histogram = grpc_histogram_create(0.01, 60e9); double start_time; double end_time; double interval; @@ -316,13 +316,13 @@ static void client_thread(thread_args* args) { end_time = now(); if (i > kNumIters / 2) { interval = end_time - start_time; - gpr_histogram_add(histogram, interval); + grpc_histogram_add(histogram, interval); } } print_histogram(histogram); error: gpr_free(buf); - gpr_histogram_destroy(histogram); + grpc_histogram_destroy(histogram); } /* This roughly matches tcp_server's create_listening_socket */ diff --git a/test/core/support/BUILD b/test/core/support/BUILD index 32b64d4b8e1..4372b49b545 100644 --- a/test/core/support/BUILD +++ b/test/core/support/BUILD @@ -68,16 +68,6 @@ grpc_cc_test( ], ) -grpc_cc_test( - name = "histogram_test", - srcs = ["histogram_test.cc"], - language = "C++", - deps = [ - "//:gpr", - "//test/core/util:gpr_test_util", - ], -) - grpc_cc_test( name = "host_port_test", srcs = ["host_port_test.cc"], diff --git a/test/core/support/histogram_test.cc b/test/core/support/histogram_test.cc deleted file mode 100644 index 86b7d599e6a..00000000000 --- a/test/core/support/histogram_test.cc +++ /dev/null @@ -1,163 +0,0 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include -#include - -#define LOG_TEST(x) gpr_log(GPR_INFO, "%s", x); - -static void test_no_op(void) { - gpr_histogram_destroy(gpr_histogram_create(0.01, 60e9)); -} - -static void expect_percentile(gpr_histogram* h, double percentile, - double min_expect, double max_expect) { - double got = gpr_histogram_percentile(h, percentile); - gpr_log(GPR_INFO, "@%f%%, expect %f <= %f <= %f", percentile, min_expect, got, - max_expect); - GPR_ASSERT(min_expect <= got); - GPR_ASSERT(got <= max_expect); -} - -static void test_simple(void) { - gpr_histogram* h; - - LOG_TEST("test_simple"); - - h = gpr_histogram_create(0.01, 60e9); - gpr_histogram_add(h, 10000); - gpr_histogram_add(h, 10000); - gpr_histogram_add(h, 11000); - gpr_histogram_add(h, 11000); - - expect_percentile(h, 50, 10001, 10999); - GPR_ASSERT(gpr_histogram_mean(h) == 10500); - - gpr_histogram_destroy(h); -} - -static void test_percentile(void) { - gpr_histogram* h; - double last; - double i; - double cur; - - LOG_TEST("test_percentile"); - - h = gpr_histogram_create(0.05, 1e9); - gpr_histogram_add(h, 2.5); - gpr_histogram_add(h, 2.5); - gpr_histogram_add(h, 8); - gpr_histogram_add(h, 4); - - GPR_ASSERT(gpr_histogram_count(h) == 4); - GPR_ASSERT(gpr_histogram_minimum(h) == 2.5); - GPR_ASSERT(gpr_histogram_maximum(h) == 8); - GPR_ASSERT(gpr_histogram_sum(h) == 17); - GPR_ASSERT(gpr_histogram_sum_of_squares(h) == 92.5); - GPR_ASSERT(gpr_histogram_mean(h) == 4.25); - GPR_ASSERT(gpr_histogram_variance(h) == 5.0625); - GPR_ASSERT(gpr_histogram_stddev(h) == 2.25); - - expect_percentile(h, -10, 2.5, 2.5); - expect_percentile(h, 0, 2.5, 2.5); - expect_percentile(h, 12.5, 2.5, 2.5); - expect_percentile(h, 25, 2.5, 2.5); - expect_percentile(h, 37.5, 2.5, 2.8); - expect_percentile(h, 50, 3.0, 3.5); - expect_percentile(h, 62.5, 3.5, 4.5); - expect_percentile(h, 75, 5, 7.9); - expect_percentile(h, 100, 8, 8); - expect_percentile(h, 110, 8, 8); - - /* test monotonicity */ - last = 0.0; - for (i = 0; i < 100.0; i += 0.01) { - cur = gpr_histogram_percentile(h, i); - GPR_ASSERT(cur >= last); - last = cur; - } - - gpr_histogram_destroy(h); -} - -static void test_merge(void) { - gpr_histogram *h1, *h2; - double last; - double i; - double cur; - - LOG_TEST("test_merge"); - - h1 = gpr_histogram_create(0.05, 1e9); - gpr_histogram_add(h1, 2.5); - gpr_histogram_add(h1, 2.5); - gpr_histogram_add(h1, 8); - gpr_histogram_add(h1, 4); - - h2 = gpr_histogram_create(0.01, 1e9); - GPR_ASSERT(gpr_histogram_merge(h1, h2) == 0); - gpr_histogram_destroy(h2); - - h2 = gpr_histogram_create(0.05, 1e10); - GPR_ASSERT(gpr_histogram_merge(h1, h2) == 0); - gpr_histogram_destroy(h2); - - h2 = gpr_histogram_create(0.05, 1e9); - GPR_ASSERT(gpr_histogram_merge(h1, h2) == 1); - GPR_ASSERT(gpr_histogram_count(h1) == 4); - GPR_ASSERT(gpr_histogram_minimum(h1) == 2.5); - GPR_ASSERT(gpr_histogram_maximum(h1) == 8); - GPR_ASSERT(gpr_histogram_sum(h1) == 17); - GPR_ASSERT(gpr_histogram_sum_of_squares(h1) == 92.5); - GPR_ASSERT(gpr_histogram_mean(h1) == 4.25); - GPR_ASSERT(gpr_histogram_variance(h1) == 5.0625); - GPR_ASSERT(gpr_histogram_stddev(h1) == 2.25); - gpr_histogram_destroy(h2); - - h2 = gpr_histogram_create(0.05, 1e9); - gpr_histogram_add(h2, 7.0); - gpr_histogram_add(h2, 17.0); - gpr_histogram_add(h2, 1.0); - GPR_ASSERT(gpr_histogram_merge(h1, h2) == 1); - GPR_ASSERT(gpr_histogram_count(h1) == 7); - GPR_ASSERT(gpr_histogram_minimum(h1) == 1.0); - GPR_ASSERT(gpr_histogram_maximum(h1) == 17.0); - GPR_ASSERT(gpr_histogram_sum(h1) == 42.0); - GPR_ASSERT(gpr_histogram_sum_of_squares(h1) == 431.5); - GPR_ASSERT(gpr_histogram_mean(h1) == 6.0); - - /* test monotonicity */ - last = 0.0; - for (i = 0; i < 100.0; i += 0.01) { - cur = gpr_histogram_percentile(h1, i); - GPR_ASSERT(cur >= last); - last = cur; - } - - gpr_histogram_destroy(h1); - gpr_histogram_destroy(h2); -} - -int main(void) { - test_no_op(); - test_simple(); - test_percentile(); - test_merge(); - return 0; -} diff --git a/test/core/surface/public_headers_must_be_c89.c b/test/core/surface/public_headers_must_be_c89.c index 33dc70a6855..8d2384ba61f 100644 --- a/test/core/surface/public_headers_must_be_c89.c +++ b/test/core/surface/public_headers_must_be_c89.c @@ -50,7 +50,6 @@ #include #include #include -#include #include #include #include @@ -266,21 +265,6 @@ int main(int argc, char **argv) { printf("%lx", (unsigned long) gpr_cmdline_usage_string); printf("%lx", (unsigned long) gpr_cpu_num_cores); printf("%lx", (unsigned long) gpr_cpu_current_cpu); - printf("%lx", (unsigned long) gpr_histogram_create); - printf("%lx", (unsigned long) gpr_histogram_destroy); - printf("%lx", (unsigned long) gpr_histogram_add); - printf("%lx", (unsigned long) gpr_histogram_merge); - printf("%lx", (unsigned long) gpr_histogram_percentile); - printf("%lx", (unsigned long) gpr_histogram_mean); - printf("%lx", (unsigned long) gpr_histogram_stddev); - printf("%lx", (unsigned long) gpr_histogram_variance); - printf("%lx", (unsigned long) gpr_histogram_maximum); - printf("%lx", (unsigned long) gpr_histogram_minimum); - printf("%lx", (unsigned long) gpr_histogram_count); - printf("%lx", (unsigned long) gpr_histogram_sum); - printf("%lx", (unsigned long) gpr_histogram_sum_of_squares); - printf("%lx", (unsigned long) gpr_histogram_get_contents); - printf("%lx", (unsigned long) gpr_histogram_merge_contents); printf("%lx", (unsigned long) gpr_join_host_port); printf("%lx", (unsigned long) gpr_split_host_port); printf("%lx", (unsigned long) gpr_log_severity_string); diff --git a/test/core/util/BUILD b/test/core/util/BUILD index 6443553466f..268547f6c9d 100644 --- a/test/core/util/BUILD +++ b/test/core/util/BUILD @@ -16,7 +16,10 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_c licenses(["notice"]) # Apache v2 -grpc_package(name = "test/core/util", visibility = "public") +grpc_package( + name = "test/core/util", + visibility = "public", +) grpc_cc_library( name = "gpr_test_util", @@ -49,6 +52,7 @@ grpc_cc_library( name = "grpc_test_util_base", srcs = [ "grpc_profiler.cc", + "histogram.cc", "mock_endpoint.cc", "parse_hexstring.cc", "passthru_endpoint.cc", @@ -62,6 +66,7 @@ grpc_cc_library( ], hdrs = [ "grpc_profiler.h", + "histogram.h", "mock_endpoint.h", "parse_hexstring.h", "passthru_endpoint.h", @@ -76,8 +81,8 @@ grpc_cc_library( language = "C++", deps = [ ":gpr_test_util", + ":grpc_debugger_macros", "//:grpc_common", - ":grpc_debugger_macros" ], ) @@ -107,13 +112,23 @@ grpc_cc_library( name = "fuzzer_corpus_test", testonly = 1, srcs = ["fuzzer_corpus_test.cc"], + external_deps = [ + "gtest", + "gflags", + ], deps = [ ":gpr_test_util", "//:grpc", ], - external_deps = [ - "gtest", - "gflags", +) + +grpc_cc_test( + name = "histogram_test", + srcs = ["histogram_test.cc"], + language = "C++", + deps = [ + ":grpc_test_util", + "//:gpr", ], ) diff --git a/src/core/lib/support/histogram.cc b/test/core/util/histogram.cc similarity index 72% rename from src/core/lib/support/histogram.cc rename to test/core/util/histogram.cc index 73c821a28b0..2f916f831d6 100644 --- a/src/core/lib/support/histogram.cc +++ b/test/core/util/histogram.cc @@ -16,8 +16,6 @@ * */ -#include - #include #include #include @@ -27,12 +25,14 @@ #include #include +#include "test/core/util/histogram.h" + /* Histograms are stored with exponentially increasing bucket sizes. The first bucket is [0, m) where m = 1 + resolution Bucket n (n>=1) contains [m**n, m**(n+1)) There are sufficient buckets to reach max_bucket_start */ -struct gpr_histogram { +struct grpc_histogram { /* Sum of all values seen so far */ double sum; /* Sum of squares of all values seen so far */ @@ -55,25 +55,25 @@ struct gpr_histogram { }; /* determine a bucket index given a value - does no bounds checking */ -static size_t bucket_for_unchecked(gpr_histogram* h, double x) { +static size_t bucket_for_unchecked(grpc_histogram* h, double x) { return (size_t)(log(x) * h->one_on_log_multiplier); } /* bounds checked version of the above */ -static size_t bucket_for(gpr_histogram* h, double x) { +static size_t bucket_for(grpc_histogram* h, double x) { size_t bucket = bucket_for_unchecked(h, GPR_CLAMP(x, 1.0, h->max_possible)); GPR_ASSERT(bucket < h->num_buckets); return bucket; } /* at what value does a bucket start? */ -static double bucket_start(gpr_histogram* h, double x) { +static double bucket_start(grpc_histogram* h, double x) { return pow(h->multiplier, x); } -gpr_histogram* gpr_histogram_create(double resolution, - double max_bucket_start) { - gpr_histogram* h = (gpr_histogram*)gpr_malloc(sizeof(gpr_histogram)); +grpc_histogram* grpc_histogram_create(double resolution, + double max_bucket_start) { + grpc_histogram* h = (grpc_histogram*)gpr_malloc(sizeof(grpc_histogram)); GPR_ASSERT(resolution > 0.0); GPR_ASSERT(max_bucket_start > resolution); h->sum = 0.0; @@ -91,12 +91,12 @@ gpr_histogram* gpr_histogram_create(double resolution, return h; } -void gpr_histogram_destroy(gpr_histogram* h) { +void grpc_histogram_destroy(grpc_histogram* h) { gpr_free(h->buckets); gpr_free(h); } -void gpr_histogram_add(gpr_histogram* h, double x) { +void grpc_histogram_add(grpc_histogram* h, double x) { h->sum += x; h->sum_of_squares += x * x; h->count++; @@ -109,22 +109,22 @@ void gpr_histogram_add(gpr_histogram* h, double x) { h->buckets[bucket_for(h, x)]++; } -int gpr_histogram_merge(gpr_histogram* dst, const gpr_histogram* src) { +int grpc_histogram_merge(grpc_histogram* dst, const grpc_histogram* src) { if ((dst->num_buckets != src->num_buckets) || (dst->multiplier != src->multiplier)) { /* Fail because these histograms don't match */ return 0; } - gpr_histogram_merge_contents(dst, src->buckets, src->num_buckets, - src->min_seen, src->max_seen, src->sum, - src->sum_of_squares, src->count); + grpc_histogram_merge_contents(dst, src->buckets, src->num_buckets, + src->min_seen, src->max_seen, src->sum, + src->sum_of_squares, src->count); return 1; } -void gpr_histogram_merge_contents(gpr_histogram* dst, const uint32_t* data, - size_t data_count, double min_seen, - double max_seen, double sum, - double sum_of_squares, double count) { +void grpc_histogram_merge_contents(grpc_histogram* dst, const uint32_t* data, + size_t data_count, double min_seen, + double max_seen, double sum, + double sum_of_squares, double count) { size_t i; GPR_ASSERT(dst->num_buckets == data_count); dst->sum += sum; @@ -141,7 +141,7 @@ void gpr_histogram_merge_contents(gpr_histogram* dst, const uint32_t* data, } } -static double threshold_for_count_below(gpr_histogram* h, double count_below) { +static double threshold_for_count_below(grpc_histogram* h, double count_below) { double count_so_far; double lower_bound; double upper_bound; @@ -190,38 +190,38 @@ static double threshold_for_count_below(gpr_histogram* h, double count_below) { } } -double gpr_histogram_percentile(gpr_histogram* h, double percentile) { +double grpc_histogram_percentile(grpc_histogram* h, double percentile) { return threshold_for_count_below(h, h->count * percentile / 100.0); } -double gpr_histogram_mean(gpr_histogram* h) { +double grpc_histogram_mean(grpc_histogram* h) { GPR_ASSERT(h->count != 0); return h->sum / h->count; } -double gpr_histogram_stddev(gpr_histogram* h) { - return sqrt(gpr_histogram_variance(h)); +double grpc_histogram_stddev(grpc_histogram* h) { + return sqrt(grpc_histogram_variance(h)); } -double gpr_histogram_variance(gpr_histogram* h) { +double grpc_histogram_variance(grpc_histogram* h) { if (h->count == 0) return 0.0; return (h->sum_of_squares * h->count - h->sum * h->sum) / (h->count * h->count); } -double gpr_histogram_maximum(gpr_histogram* h) { return h->max_seen; } +double grpc_histogram_maximum(grpc_histogram* h) { return h->max_seen; } -double gpr_histogram_minimum(gpr_histogram* h) { return h->min_seen; } +double grpc_histogram_minimum(grpc_histogram* h) { return h->min_seen; } -double gpr_histogram_count(gpr_histogram* h) { return h->count; } +double grpc_histogram_count(grpc_histogram* h) { return h->count; } -double gpr_histogram_sum(gpr_histogram* h) { return h->sum; } +double grpc_histogram_sum(grpc_histogram* h) { return h->sum; } -double gpr_histogram_sum_of_squares(gpr_histogram* h) { +double grpc_histogram_sum_of_squares(grpc_histogram* h) { return h->sum_of_squares; } -const uint32_t* gpr_histogram_get_contents(gpr_histogram* h, size_t* size) { +const uint32_t* grpc_histogram_get_contents(grpc_histogram* h, size_t* size) { *size = h->num_buckets; return h->buckets; } diff --git a/test/core/util/histogram.h b/test/core/util/histogram.h new file mode 100644 index 00000000000..9d4985e64fb --- /dev/null +++ b/test/core/util/histogram.h @@ -0,0 +1,62 @@ +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPC_SUPPORT_HISTOGRAM_H +#define GRPC_SUPPORT_HISTOGRAM_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct grpc_histogram grpc_histogram; + +grpc_histogram* grpc_histogram_create(double resolution, + double max_bucket_start); +void grpc_histogram_destroy(grpc_histogram* h); +void grpc_histogram_add(grpc_histogram* h, double x); + +/** The following merges the second histogram into the first. It only works + if they have the same buckets and resolution. Returns 0 on failure, 1 + on success */ +int grpc_histogram_merge(grpc_histogram* dst, const grpc_histogram* src); + +double grpc_histogram_percentile(grpc_histogram* histogram, double percentile); +double grpc_histogram_mean(grpc_histogram* histogram); +double grpc_histogram_stddev(grpc_histogram* histogram); +double grpc_histogram_variance(grpc_histogram* histogram); +double grpc_histogram_maximum(grpc_histogram* histogram); +double grpc_histogram_minimum(grpc_histogram* histogram); +double grpc_histogram_count(grpc_histogram* histogram); +double grpc_histogram_sum(grpc_histogram* histogram); +double grpc_histogram_sum_of_squares(grpc_histogram* histogram); + +const uint32_t* grpc_histogram_get_contents(grpc_histogram* histogram, + size_t* count); +void grpc_histogram_merge_contents(grpc_histogram* histogram, + const uint32_t* data, size_t data_count, + double min_seen, double max_seen, double sum, + double sum_of_squares, double count); + +#ifdef __cplusplus +} +#endif + +#endif /* GRPC_SUPPORT_HISTOGRAM_H */ diff --git a/test/core/util/histogram_test.cc b/test/core/util/histogram_test.cc new file mode 100644 index 00000000000..b96ac7d8419 --- /dev/null +++ b/test/core/util/histogram_test.cc @@ -0,0 +1,163 @@ +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "test/core/util/histogram.h" +#include + +#define LOG_TEST(x) gpr_log(GPR_INFO, "%s", x); + +static void test_no_op(void) { + grpc_histogram_destroy(grpc_histogram_create(0.01, 60e9)); +} + +static void expect_percentile(grpc_histogram* h, double percentile, + double min_expect, double max_expect) { + double got = grpc_histogram_percentile(h, percentile); + gpr_log(GPR_INFO, "@%f%%, expect %f <= %f <= %f", percentile, min_expect, got, + max_expect); + GPR_ASSERT(min_expect <= got); + GPR_ASSERT(got <= max_expect); +} + +static void test_simple(void) { + grpc_histogram* h; + + LOG_TEST("test_simple"); + + h = grpc_histogram_create(0.01, 60e9); + grpc_histogram_add(h, 10000); + grpc_histogram_add(h, 10000); + grpc_histogram_add(h, 11000); + grpc_histogram_add(h, 11000); + + expect_percentile(h, 50, 10001, 10999); + GPR_ASSERT(grpc_histogram_mean(h) == 10500); + + grpc_histogram_destroy(h); +} + +static void test_percentile(void) { + grpc_histogram* h; + double last; + double i; + double cur; + + LOG_TEST("test_percentile"); + + h = grpc_histogram_create(0.05, 1e9); + grpc_histogram_add(h, 2.5); + grpc_histogram_add(h, 2.5); + grpc_histogram_add(h, 8); + grpc_histogram_add(h, 4); + + GPR_ASSERT(grpc_histogram_count(h) == 4); + GPR_ASSERT(grpc_histogram_minimum(h) == 2.5); + GPR_ASSERT(grpc_histogram_maximum(h) == 8); + GPR_ASSERT(grpc_histogram_sum(h) == 17); + GPR_ASSERT(grpc_histogram_sum_of_squares(h) == 92.5); + GPR_ASSERT(grpc_histogram_mean(h) == 4.25); + GPR_ASSERT(grpc_histogram_variance(h) == 5.0625); + GPR_ASSERT(grpc_histogram_stddev(h) == 2.25); + + expect_percentile(h, -10, 2.5, 2.5); + expect_percentile(h, 0, 2.5, 2.5); + expect_percentile(h, 12.5, 2.5, 2.5); + expect_percentile(h, 25, 2.5, 2.5); + expect_percentile(h, 37.5, 2.5, 2.8); + expect_percentile(h, 50, 3.0, 3.5); + expect_percentile(h, 62.5, 3.5, 4.5); + expect_percentile(h, 75, 5, 7.9); + expect_percentile(h, 100, 8, 8); + expect_percentile(h, 110, 8, 8); + + /* test monotonicity */ + last = 0.0; + for (i = 0; i < 100.0; i += 0.01) { + cur = grpc_histogram_percentile(h, i); + GPR_ASSERT(cur >= last); + last = cur; + } + + grpc_histogram_destroy(h); +} + +static void test_merge(void) { + grpc_histogram *h1, *h2; + double last; + double i; + double cur; + + LOG_TEST("test_merge"); + + h1 = grpc_histogram_create(0.05, 1e9); + grpc_histogram_add(h1, 2.5); + grpc_histogram_add(h1, 2.5); + grpc_histogram_add(h1, 8); + grpc_histogram_add(h1, 4); + + h2 = grpc_histogram_create(0.01, 1e9); + GPR_ASSERT(grpc_histogram_merge(h1, h2) == 0); + grpc_histogram_destroy(h2); + + h2 = grpc_histogram_create(0.05, 1e10); + GPR_ASSERT(grpc_histogram_merge(h1, h2) == 0); + grpc_histogram_destroy(h2); + + h2 = grpc_histogram_create(0.05, 1e9); + GPR_ASSERT(grpc_histogram_merge(h1, h2) == 1); + GPR_ASSERT(grpc_histogram_count(h1) == 4); + GPR_ASSERT(grpc_histogram_minimum(h1) == 2.5); + GPR_ASSERT(grpc_histogram_maximum(h1) == 8); + GPR_ASSERT(grpc_histogram_sum(h1) == 17); + GPR_ASSERT(grpc_histogram_sum_of_squares(h1) == 92.5); + GPR_ASSERT(grpc_histogram_mean(h1) == 4.25); + GPR_ASSERT(grpc_histogram_variance(h1) == 5.0625); + GPR_ASSERT(grpc_histogram_stddev(h1) == 2.25); + grpc_histogram_destroy(h2); + + h2 = grpc_histogram_create(0.05, 1e9); + grpc_histogram_add(h2, 7.0); + grpc_histogram_add(h2, 17.0); + grpc_histogram_add(h2, 1.0); + GPR_ASSERT(grpc_histogram_merge(h1, h2) == 1); + GPR_ASSERT(grpc_histogram_count(h1) == 7); + GPR_ASSERT(grpc_histogram_minimum(h1) == 1.0); + GPR_ASSERT(grpc_histogram_maximum(h1) == 17.0); + GPR_ASSERT(grpc_histogram_sum(h1) == 42.0); + GPR_ASSERT(grpc_histogram_sum_of_squares(h1) == 431.5); + GPR_ASSERT(grpc_histogram_mean(h1) == 6.0); + + /* test monotonicity */ + last = 0.0; + for (i = 0; i < 100.0; i += 0.01) { + cur = grpc_histogram_percentile(h1, i); + GPR_ASSERT(cur >= last); + last = cur; + } + + grpc_histogram_destroy(h1); + grpc_histogram_destroy(h2); +} + +int main(void) { + test_no_op(); + test_simple(); + test_percentile(); + test_merge(); + return 0; +} diff --git a/test/cpp/qps/BUILD b/test/cpp/qps/BUILD index 0d91d52f221..f1abb19e64d 100644 --- a/test/cpp/qps/BUILD +++ b/test/cpp/qps/BUILD @@ -106,7 +106,7 @@ grpc_cc_library( "histogram.h", "stats.h", ], - deps = ["//:gpr"], + deps = ["//test/core/util:grpc_test_util"], ) grpc_cc_test( diff --git a/test/cpp/qps/histogram.h b/test/cpp/qps/histogram.h index e31d5d78a8e..ba72b5b3320 100644 --- a/test/cpp/qps/histogram.h +++ b/test/cpp/qps/histogram.h @@ -19,8 +19,8 @@ #ifndef TEST_QPS_HISTOGRAM_H #define TEST_QPS_HISTOGRAM_H -#include #include "src/proto/grpc/testing/stats.pb.h" +#include "test/core/util/histogram.h" namespace grpc { namespace testing { @@ -29,36 +29,36 @@ class Histogram { public: // TODO: look into making histogram params not hardcoded for C++ Histogram() - : impl_(gpr_histogram_create(default_resolution(), - default_max_possible())) {} + : impl_(grpc_histogram_create(default_resolution(), + default_max_possible())) {} ~Histogram() { - if (impl_) gpr_histogram_destroy(impl_); + if (impl_) grpc_histogram_destroy(impl_); } Histogram(Histogram&& other) : impl_(other.impl_) { other.impl_ = nullptr; } - void Merge(const Histogram& h) { gpr_histogram_merge(impl_, h.impl_); } - void Add(double value) { gpr_histogram_add(impl_, value); } + void Merge(const Histogram& h) { grpc_histogram_merge(impl_, h.impl_); } + void Add(double value) { grpc_histogram_add(impl_, value); } double Percentile(double pctile) const { - return gpr_histogram_percentile(impl_, pctile); + return grpc_histogram_percentile(impl_, pctile); } - double Count() const { return gpr_histogram_count(impl_); } + double Count() const { return grpc_histogram_count(impl_); } void Swap(Histogram* other) { std::swap(impl_, other->impl_); } void FillProto(HistogramData* p) { size_t n; - const auto* data = gpr_histogram_get_contents(impl_, &n); + const auto* data = grpc_histogram_get_contents(impl_, &n); for (size_t i = 0; i < n; i++) { p->add_bucket(data[i]); } - p->set_min_seen(gpr_histogram_minimum(impl_)); - p->set_max_seen(gpr_histogram_maximum(impl_)); - p->set_sum(gpr_histogram_sum(impl_)); - p->set_sum_of_squares(gpr_histogram_sum_of_squares(impl_)); - p->set_count(gpr_histogram_count(impl_)); + p->set_min_seen(grpc_histogram_minimum(impl_)); + p->set_max_seen(grpc_histogram_maximum(impl_)); + p->set_sum(grpc_histogram_sum(impl_)); + p->set_sum_of_squares(grpc_histogram_sum_of_squares(impl_)); + p->set_count(grpc_histogram_count(impl_)); } void MergeProto(const HistogramData& p) { - gpr_histogram_merge_contents(impl_, &*p.bucket().begin(), p.bucket_size(), - p.min_seen(), p.max_seen(), p.sum(), - p.sum_of_squares(), p.count()); + grpc_histogram_merge_contents(impl_, &*p.bucket().begin(), p.bucket_size(), + p.min_seen(), p.max_seen(), p.sum(), + p.sum_of_squares(), p.count()); } static double default_resolution() { return 0.01; } @@ -68,7 +68,7 @@ class Histogram { Histogram(const Histogram&); Histogram& operator=(const Histogram&); - gpr_histogram* impl_; + grpc_histogram* impl_; }; } // namespace testing } // namespace grpc diff --git a/test/cpp/qps/qps_interarrival_test.cc b/test/cpp/qps/qps_interarrival_test.cc index 461bf624cec..625b7db4269 100644 --- a/test/cpp/qps/qps_interarrival_test.cc +++ b/test/cpp/qps/qps_interarrival_test.cc @@ -20,7 +20,7 @@ #include // Use the C histogram rather than C++ to avoid depending on proto -#include +#include "test/core/util/histogram.h" #include "test/cpp/qps/interarrival.h" #include "test/cpp/util/test_config.h" @@ -31,21 +31,21 @@ using grpc::testing::RandomDistInterface; static void RunTest(RandomDistInterface&& r, int threads, std::string title) { InterarrivalTimer timer; timer.init(r, threads); - gpr_histogram* h(gpr_histogram_create(0.01, 60e9)); + grpc_histogram* h(grpc_histogram_create(0.01, 60e9)); for (int i = 0; i < 10000000; i++) { for (int j = 0; j < threads; j++) { - gpr_histogram_add(h, timer.next(j)); + grpc_histogram_add(h, timer.next(j)); } } std::cout << title << " Distribution" << std::endl; std::cout << "Value, Percentile" << std::endl; for (double pct = 0.0; pct < 100.0; pct += 1.0) { - std::cout << gpr_histogram_percentile(h, pct) << "," << pct << std::endl; + std::cout << grpc_histogram_percentile(h, pct) << "," << pct << std::endl; } - gpr_histogram_destroy(h); + grpc_histogram_destroy(h); } using grpc::testing::ExpDist; diff --git a/test/cpp/qps/qps_worker.cc b/test/cpp/qps/qps_worker.cc index c288b03ec51..4c9ab0ea43e 100644 --- a/test/cpp/qps/qps_worker.cc +++ b/test/cpp/qps/qps_worker.cc @@ -32,12 +32,12 @@ #include #include #include -#include #include #include #include "src/proto/grpc/testing/services.pb.h" #include "test/core/util/grpc_profiler.h" +#include "test/core/util/histogram.h" #include "test/cpp/qps/client.h" #include "test/cpp/qps/server.h" #include "test/cpp/util/create_test_channel.h" diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index bd641c25422..e62278cb9f6 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -913,7 +913,6 @@ include/grpc/support/atm_windows.h \ include/grpc/support/avl.h \ include/grpc/support/cmdline.h \ include/grpc/support/cpu.h \ -include/grpc/support/histogram.h \ include/grpc/support/host_port.h \ include/grpc/support/log.h \ include/grpc/support/log_windows.h \ diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 09f668d847e..d09b325c97a 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -914,7 +914,6 @@ include/grpc/support/atm_windows.h \ include/grpc/support/avl.h \ include/grpc/support/cmdline.h \ include/grpc/support/cpu.h \ -include/grpc/support/histogram.h \ include/grpc/support/host_port.h \ include/grpc/support/log.h \ include/grpc/support/log_windows.h \ diff --git a/tools/doxygen/Doxyfile.core b/tools/doxygen/Doxyfile.core index 97bb43a4238..6ce90417475 100644 --- a/tools/doxygen/Doxyfile.core +++ b/tools/doxygen/Doxyfile.core @@ -853,7 +853,6 @@ include/grpc/support/atm_windows.h \ include/grpc/support/avl.h \ include/grpc/support/cmdline.h \ include/grpc/support/cpu.h \ -include/grpc/support/histogram.h \ include/grpc/support/host_port.h \ include/grpc/support/log.h \ include/grpc/support/log_windows.h \ diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 28b7d396e00..1aff0075a6a 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -853,7 +853,6 @@ include/grpc/support/atm_windows.h \ include/grpc/support/avl.h \ include/grpc/support/cmdline.h \ include/grpc/support/cpu.h \ -include/grpc/support/histogram.h \ include/grpc/support/host_port.h \ include/grpc/support/log.h \ include/grpc/support/log_windows.h \ @@ -1294,7 +1293,6 @@ src/core/lib/support/env_posix.cc \ src/core/lib/support/env_windows.cc \ src/core/lib/support/fork.cc \ src/core/lib/support/fork.h \ -src/core/lib/support/histogram.cc \ src/core/lib/support/host_port.cc \ src/core/lib/support/log.cc \ src/core/lib/support/log_android.cc \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index c868acf8d30..a0ea4238e1e 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -703,21 +703,6 @@ "third_party": false, "type": "target" }, - { - "deps": [ - "gpr", - "gpr_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "gpr_histogram_test", - "src": [ - "test/core/support/histogram_test.cc" - ], - "third_party": false, - "type": "target" - }, { "deps": [ "gpr", @@ -1242,6 +1227,21 @@ "third_party": false, "type": "target" }, + { + "deps": [ + "gpr", + "grpc_test_util" + ], + "headers": [], + "is_filegroup": false, + "language": "c", + "name": "histogram_test", + "src": [ + "test/core/util/histogram_test.cc" + ], + "third_party": false, + "type": "target" + }, { "deps": [ "gpr", @@ -7766,7 +7766,6 @@ "src/core/lib/support/env_posix.cc", "src/core/lib/support/env_windows.cc", "src/core/lib/support/fork.cc", - "src/core/lib/support/histogram.cc", "src/core/lib/support/host_port.cc", "src/core/lib/support/log.cc", "src/core/lib/support/log_android.cc", @@ -7813,7 +7812,6 @@ "include/grpc/support/avl.h", "include/grpc/support/cmdline.h", "include/grpc/support/cpu.h", - "include/grpc/support/histogram.h", "include/grpc/support/host_port.h", "include/grpc/support/log.h", "include/grpc/support/log_windows.h", @@ -7863,7 +7861,6 @@ "include/grpc/support/avl.h", "include/grpc/support/cmdline.h", "include/grpc/support/cpu.h", - "include/grpc/support/histogram.h", "include/grpc/support/host_port.h", "include/grpc/support/log.h", "include/grpc/support/log_windows.h", @@ -8928,6 +8925,7 @@ "test/core/iomgr/endpoint_tests.h", "test/core/util/debugger_macros.h", "test/core/util/grpc_profiler.h", + "test/core/util/histogram.h", "test/core/util/memory_counters.h", "test/core/util/mock_endpoint.h", "test/core/util/parse_hexstring.h", @@ -8956,6 +8954,8 @@ "test/core/util/debugger_macros.h", "test/core/util/grpc_profiler.cc", "test/core/util/grpc_profiler.h", + "test/core/util/histogram.cc", + "test/core/util/histogram.h", "test/core/util/memory_counters.cc", "test/core/util/memory_counters.h", "test/core/util/mock_endpoint.cc", diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index 929ed159187..ce698cb709e 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -839,30 +839,6 @@ ], "uses_polling": false }, - { - "args": [], - "benchmark": false, - "ci_platforms": [ - "linux", - "mac", - "posix", - "windows" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "exclude_iomgrs": [], - "flaky": false, - "gtest": false, - "language": "c", - "name": "gpr_histogram_test", - "platforms": [ - "linux", - "mac", - "posix", - "windows" - ], - "uses_polling": false - }, { "args": [], "benchmark": false, @@ -1523,6 +1499,30 @@ ], "uses_polling": true }, + { + "args": [], + "benchmark": false, + "ci_platforms": [ + "linux", + "mac", + "posix", + "windows" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "gtest": false, + "language": "c", + "name": "histogram_test", + "platforms": [ + "linux", + "mac", + "posix", + "windows" + ], + "uses_polling": false + }, { "args": [], "benchmark": false,