diff options
45 files changed, 896 insertions, 86 deletions
@@ -388,6 +388,10 @@ 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/memory.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/mpscq.h", "src/core/lib/support/murmur_hash.h", "src/core/lib/support/spinlock.h", @@ -555,7 +559,7 @@ grpc_cc_library( "src/core/lib/surface/completion_queue.c", "src/core/lib/surface/completion_queue_factory.c", "src/core/lib/surface/event_string.c", - "src/core/lib/surface/lame_client.c", + "src/core/lib/surface/lame_client.cc", "src/core/lib/surface/metadata_array.c", "src/core/lib/surface/server.c", "src/core/lib/surface/validate_metadata.c", diff --git a/CMakeLists.txt b/CMakeLists.txt index 340806d8ef..e76b015793 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -690,6 +690,7 @@ endif() if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_dependencies(buildtests_cxx json_run_localhost) endif() +add_dependencies(buildtests_cxx memory_test) add_dependencies(buildtests_cxx metrics_client) add_dependencies(buildtests_cxx mock_test) add_dependencies(buildtests_cxx noop-benchmark) @@ -1014,7 +1015,7 @@ add_library(grpc src/core/lib/surface/completion_queue.c src/core/lib/surface/completion_queue_factory.c src/core/lib/surface/event_string.c - src/core/lib/surface/lame_client.c + src/core/lib/surface/lame_client.cc src/core/lib/surface/metadata_array.c src/core/lib/surface/server.c src/core/lib/surface/validate_metadata.c @@ -1339,7 +1340,7 @@ add_library(grpc_cronet src/core/lib/surface/completion_queue.c src/core/lib/surface/completion_queue_factory.c src/core/lib/surface/event_string.c - src/core/lib/surface/lame_client.c + src/core/lib/surface/lame_client.cc src/core/lib/surface/metadata_array.c src/core/lib/surface/server.c src/core/lib/surface/validate_metadata.c @@ -1649,7 +1650,7 @@ add_library(grpc_test_util src/core/lib/surface/completion_queue.c src/core/lib/surface/completion_queue_factory.c src/core/lib/surface/event_string.c - src/core/lib/surface/lame_client.c + src/core/lib/surface/lame_client.cc src/core/lib/surface/metadata_array.c src/core/lib/surface/server.c src/core/lib/surface/validate_metadata.c @@ -1905,7 +1906,7 @@ add_library(grpc_unsecure src/core/lib/surface/completion_queue.c src/core/lib/surface/completion_queue_factory.c src/core/lib/surface/event_string.c - src/core/lib/surface/lame_client.c + src/core/lib/surface/lame_client.cc src/core/lib/surface/metadata_array.c src/core/lib/surface/server.c src/core/lib/surface/validate_metadata.c @@ -2324,7 +2325,7 @@ add_library(grpc++ src/core/lib/surface/completion_queue.c src/core/lib/surface/completion_queue_factory.c src/core/lib/surface/event_string.c - src/core/lib/surface/lame_client.c + src/core/lib/surface/lame_client.cc src/core/lib/surface/metadata_array.c src/core/lib/surface/server.c src/core/lib/surface/validate_metadata.c @@ -2649,7 +2650,7 @@ add_library(grpc++_cronet src/core/lib/surface/completion_queue.c src/core/lib/surface/completion_queue_factory.c src/core/lib/surface/event_string.c - src/core/lib/surface/lame_client.c + src/core/lib/surface/lame_client.cc src/core/lib/surface/metadata_array.c src/core/lib/surface/server.c src/core/lib/surface/validate_metadata.c @@ -3413,7 +3414,7 @@ add_library(grpc++_unsecure src/core/lib/surface/completion_queue.c src/core/lib/surface/completion_queue_factory.c src/core/lib/surface/event_string.c - src/core/lib/surface/lame_client.c + src/core/lib/surface/lame_client.cc src/core/lib/surface/metadata_array.c src/core/lib/surface/server.c src/core/lib/surface/validate_metadata.c @@ -10905,6 +10906,44 @@ endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) +add_executable(memory_test + test/core/support/memory_test.cc + third_party/googletest/googletest/src/gtest-all.cc +) + + +target_include_directories(memory_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_BUILD_INCLUDE_DIR} + PRIVATE ${CARES_INCLUDE_DIR} + PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest + PRIVATE ${_gRPC_PROTO_GENS_DIR} +) + +target_link_libraries(memory_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(metrics_client ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/metrics.pb.cc ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/metrics.grpc.pb.cc @@ -92,6 +92,7 @@ CC_opt = $(DEFAULT_CC) CXX_opt = $(DEFAULT_CXX) LD_opt = $(DEFAULT_CC) LDXX_opt = $(DEFAULT_CXX) +CXXFLAGS_opt = -fno-exceptions CPPFLAGS_opt = -O2 DEFINES_opt = NDEBUG @@ -99,7 +100,7 @@ VALID_CONFIG_asan-trace-cmp = 1 REQUIRE_CUSTOM_LIBRARIES_asan-trace-cmp = 1 CC_asan-trace-cmp = clang CXX_asan-trace-cmp = clang++ -LD_asan-trace-cmp = clang +LD_asan-trace-cmp = clang++ LDXX_asan-trace-cmp = clang++ CPPFLAGS_asan-trace-cmp = -O0 -fsanitize-coverage=edge -fsanitize-coverage=trace-cmp -fsanitize=address -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS LDFLAGS_asan-trace-cmp = -fsanitize=address @@ -109,6 +110,7 @@ CC_dbg = $(DEFAULT_CC) CXX_dbg = $(DEFAULT_CXX) LD_dbg = $(DEFAULT_CC) LDXX_dbg = $(DEFAULT_CXX) +CXXFLAGS_dbg = -fno-exceptions CPPFLAGS_dbg = -O0 DEFINES_dbg = _DEBUG DEBUG @@ -116,7 +118,7 @@ VALID_CONFIG_asan = 1 REQUIRE_CUSTOM_LIBRARIES_asan = 1 CC_asan = clang CXX_asan = clang++ -LD_asan = clang +LD_asan = clang++ LDXX_asan = clang++ CPPFLAGS_asan = -O0 -fsanitize-coverage=edge -fsanitize=address -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS LDFLAGS_asan = -fsanitize=address @@ -125,7 +127,7 @@ VALID_CONFIG_msan = 1 REQUIRE_CUSTOM_LIBRARIES_msan = 1 CC_msan = clang CXX_msan = clang++ -LD_msan = clang +LD_msan = clang++ LDXX_msan = clang++ CPPFLAGS_msan = -O0 -fsanitize-coverage=edge -fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer -DGTEST_HAS_TR1_TUPLE=0 -DGTEST_USE_OWN_TR1_TUPLE=1 -Wno-unused-command-line-argument -fPIE -pie -DGPR_NO_DIRECT_SYSCALLS LDFLAGS_msan = -fsanitize=memory -DGTEST_HAS_TR1_TUPLE=0 -DGTEST_USE_OWN_TR1_TUPLE=1 -fPIE -pie $(if $(JENKINS_BUILD),-Wl$(comma)-Ttext-segment=0x7e0000000000,) @@ -152,7 +154,7 @@ VALID_CONFIG_asan-noleaks = 1 REQUIRE_CUSTOM_LIBRARIES_asan-noleaks = 1 CC_asan-noleaks = clang CXX_asan-noleaks = clang++ -LD_asan-noleaks = clang +LD_asan-noleaks = clang++ LDXX_asan-noleaks = clang++ CPPFLAGS_asan-noleaks = -O0 -fsanitize-coverage=edge -fsanitize=address -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS LDFLAGS_asan-noleaks = -fsanitize=address @@ -161,7 +163,7 @@ VALID_CONFIG_ubsan = 1 REQUIRE_CUSTOM_LIBRARIES_ubsan = 1 CC_ubsan = clang CXX_ubsan = clang++ -LD_ubsan = clang +LD_ubsan = clang++ LDXX_ubsan = clang++ CPPFLAGS_ubsan = -O0 -fsanitize-coverage=edge -fsanitize=undefined -fno-omit-frame-pointer -Wno-unused-command-line-argument -Wvarargs LDFLAGS_ubsan = -fsanitize=undefined,unsigned-integer-overflow @@ -171,7 +173,7 @@ VALID_CONFIG_tsan = 1 REQUIRE_CUSTOM_LIBRARIES_tsan = 1 CC_tsan = clang CXX_tsan = clang++ -LD_tsan = clang +LD_tsan = clang++ LDXX_tsan = clang++ CPPFLAGS_tsan = -O0 -fsanitize=thread -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS LDFLAGS_tsan = -fsanitize=thread @@ -1150,6 +1152,7 @@ interop_client: $(BINDIR)/$(CONFIG)/interop_client interop_server: $(BINDIR)/$(CONFIG)/interop_server interop_test: $(BINDIR)/$(CONFIG)/interop_test json_run_localhost: $(BINDIR)/$(CONFIG)/json_run_localhost +memory_test: $(BINDIR)/$(CONFIG)/memory_test metrics_client: $(BINDIR)/$(CONFIG)/metrics_client mock_test: $(BINDIR)/$(CONFIG)/mock_test noop-benchmark: $(BINDIR)/$(CONFIG)/noop-benchmark @@ -1572,6 +1575,7 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/interop_server \ $(BINDIR)/$(CONFIG)/interop_test \ $(BINDIR)/$(CONFIG)/json_run_localhost \ + $(BINDIR)/$(CONFIG)/memory_test \ $(BINDIR)/$(CONFIG)/metrics_client \ $(BINDIR)/$(CONFIG)/mock_test \ $(BINDIR)/$(CONFIG)/noop-benchmark \ @@ -1692,6 +1696,7 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/interop_server \ $(BINDIR)/$(CONFIG)/interop_test \ $(BINDIR)/$(CONFIG)/json_run_localhost \ + $(BINDIR)/$(CONFIG)/memory_test \ $(BINDIR)/$(CONFIG)/metrics_client \ $(BINDIR)/$(CONFIG)/mock_test \ $(BINDIR)/$(CONFIG)/noop-benchmark \ @@ -2069,6 +2074,8 @@ test_cxx: buildtests_cxx $(Q) $(BINDIR)/$(CONFIG)/health_service_end2end_test || ( echo test health_service_end2end_test failed ; exit 1 ) $(E) "[RUN] Testing interop_test" $(Q) $(BINDIR)/$(CONFIG)/interop_test || ( echo test interop_test failed ; exit 1 ) + $(E) "[RUN] Testing memory_test" + $(Q) $(BINDIR)/$(CONFIG)/memory_test || ( echo test memory_test failed ; exit 1 ) $(E) "[RUN] Testing mock_test" $(Q) $(BINDIR)/$(CONFIG)/mock_test || ( echo test mock_test failed ; exit 1 ) $(E) "[RUN] Testing noop-benchmark" @@ -2960,7 +2967,7 @@ LIBGRPC_SRC = \ src/core/lib/surface/completion_queue.c \ src/core/lib/surface/completion_queue_factory.c \ src/core/lib/surface/event_string.c \ - src/core/lib/surface/lame_client.c \ + src/core/lib/surface/lame_client.cc \ src/core/lib/surface/metadata_array.c \ src/core/lib/surface/server.c \ src/core/lib/surface/validate_metadata.c \ @@ -3283,7 +3290,7 @@ LIBGRPC_CRONET_SRC = \ src/core/lib/surface/completion_queue.c \ src/core/lib/surface/completion_queue_factory.c \ src/core/lib/surface/event_string.c \ - src/core/lib/surface/lame_client.c \ + src/core/lib/surface/lame_client.cc \ src/core/lib/surface/metadata_array.c \ src/core/lib/surface/server.c \ src/core/lib/surface/validate_metadata.c \ @@ -3592,7 +3599,7 @@ LIBGRPC_TEST_UTIL_SRC = \ src/core/lib/surface/completion_queue.c \ src/core/lib/surface/completion_queue_factory.c \ src/core/lib/surface/event_string.c \ - src/core/lib/surface/lame_client.c \ + src/core/lib/surface/lame_client.cc \ src/core/lib/surface/metadata_array.c \ src/core/lib/surface/server.c \ src/core/lib/surface/validate_metadata.c \ @@ -3820,7 +3827,7 @@ LIBGRPC_UNSECURE_SRC = \ src/core/lib/surface/completion_queue.c \ src/core/lib/surface/completion_queue_factory.c \ src/core/lib/surface/event_string.c \ - src/core/lib/surface/lame_client.c \ + src/core/lib/surface/lame_client.cc \ src/core/lib/surface/metadata_array.c \ src/core/lib/surface/server.c \ src/core/lib/surface/validate_metadata.c \ @@ -4216,7 +4223,7 @@ LIBGRPC++_SRC = \ src/core/lib/surface/completion_queue.c \ src/core/lib/surface/completion_queue_factory.c \ src/core/lib/surface/event_string.c \ - src/core/lib/surface/lame_client.c \ + src/core/lib/surface/lame_client.cc \ src/core/lib/surface/metadata_array.c \ src/core/lib/surface/server.c \ src/core/lib/surface/validate_metadata.c \ @@ -4549,7 +4556,7 @@ LIBGRPC++_CRONET_SRC = \ src/core/lib/surface/completion_queue.c \ src/core/lib/surface/completion_queue_factory.c \ src/core/lib/surface/event_string.c \ - src/core/lib/surface/lame_client.c \ + src/core/lib/surface/lame_client.cc \ src/core/lib/surface/metadata_array.c \ src/core/lib/surface/server.c \ src/core/lib/surface/validate_metadata.c \ @@ -5310,7 +5317,7 @@ LIBGRPC++_UNSECURE_SRC = \ src/core/lib/surface/completion_queue.c \ src/core/lib/surface/completion_queue_factory.c \ src/core/lib/surface/event_string.c \ - src/core/lib/surface/lame_client.c \ + src/core/lib/surface/lame_client.cc \ src/core/lib/surface/metadata_array.c \ src/core/lib/surface/server.c \ src/core/lib/surface/validate_metadata.c \ @@ -15334,6 +15341,49 @@ endif endif +MEMORY_TEST_SRC = \ + test/core/support/memory_test.cc \ + +MEMORY_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(MEMORY_TEST_SRC)))) +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL. + +$(BINDIR)/$(CONFIG)/memory_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)/memory_test: protobuf_dep_error + +else + +$(BINDIR)/$(CONFIG)/memory_test: $(PROTOBUF_DEP) $(MEMORY_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) $(MEMORY_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)/memory_test + +endif + +endif + +$(OBJDIR)/$(CONFIG)/test/core/support/memory_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_memory_test: $(MEMORY_TEST_OBJS:.o=.dep) + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(MEMORY_TEST_OBJS:.o=.dep) +endif +endif + + METRICS_CLIENT_SRC = \ $(GENDIR)/src/proto/grpc/testing/metrics.pb.cc $(GENDIR)/src/proto/grpc/testing/metrics.grpc.pb.cc \ test/cpp/interop/metrics_client.cc \ diff --git a/PYTHON-MANIFEST.in b/PYTHON-MANIFEST.in index bb76b38f9f..8be0af964f 100644 --- a/PYTHON-MANIFEST.in +++ b/PYTHON-MANIFEST.in @@ -17,3 +17,4 @@ include src/python/grpcio/support.py include src/python/grpcio/README.rst include requirements.txt include etc/roots.pem +include Makefile diff --git a/binding.gyp b/binding.gyp index e424d136d6..b191e36d3f 100644 --- a/binding.gyp +++ b/binding.gyp @@ -752,7 +752,7 @@ 'src/core/lib/surface/completion_queue.c', 'src/core/lib/surface/completion_queue_factory.c', 'src/core/lib/surface/event_string.c', - 'src/core/lib/surface/lame_client.c', + 'src/core/lib/surface/lame_client.cc', 'src/core/lib/surface/metadata_array.c', 'src/core/lib/surface/server.c', 'src/core/lib/surface/validate_metadata.c', diff --git a/build.yaml b/build.yaml index f23de87d11..047de27379 100644 --- a/build.yaml +++ b/build.yaml @@ -86,9 +86,13 @@ filegroups: headers: - src/core/lib/profiling/timers.h - 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/backoff.h - src/core/lib/support/block_annotate.h - src/core/lib/support/env.h + - src/core/lib/support/memory.h - src/core/lib/support/mpscq.h - src/core/lib/support/murmur_hash.h - src/core/lib/support/spinlock.h @@ -382,7 +386,7 @@ filegroups: - src/core/lib/surface/completion_queue.c - src/core/lib/surface/completion_queue_factory.c - src/core/lib/surface/event_string.c - - src/core/lib/surface/lame_client.c + - src/core/lib/surface/lame_client.cc - src/core/lib/surface/metadata_array.c - src/core/lib/surface/server.c - src/core/lib/surface/validate_metadata.c @@ -3917,6 +3921,20 @@ targets: - mac - linux - posix +- name: memory_test + gtest: true + build: test + language: c++ + src: + - test/core/support/memory_test.cc + deps: + - grpc_test_util + - grpc++ + - grpc + - gpr_test_util + - gpr + uses: + - grpc++_test - name: metrics_client build: test run: false @@ -4344,7 +4362,7 @@ configs: CPPFLAGS: -O0 -fsanitize-coverage=edge -fsanitize=address -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS CXX: clang++ - LD: clang + LD: clang++ LDFLAGS: -fsanitize=address LDXX: clang++ compile_the_world: true @@ -4356,7 +4374,7 @@ configs: CPPFLAGS: -O0 -fsanitize-coverage=edge -fsanitize=address -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS CXX: clang++ - LD: clang + LD: clang++ LDFLAGS: -fsanitize=address LDXX: clang++ compile_the_world: true @@ -4367,7 +4385,7 @@ configs: CPPFLAGS: -O0 -fsanitize-coverage=edge -fsanitize-coverage=trace-cmp -fsanitize=address -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS CXX: clang++ - LD: clang + LD: clang++ LDFLAGS: -fsanitize=address LDXX: clang++ compile_the_world: true @@ -4382,6 +4400,7 @@ configs: DEFINES: NDEBUG dbg: CPPFLAGS: -O0 + CXXFLAGS: -fno-exceptions DEFINES: _DEBUG DEBUG gcov: CC: gcc @@ -4411,7 +4430,7 @@ configs: -Wno-unused-command-line-argument -fPIE -pie -DGPR_NO_DIRECT_SYSCALLS CXX: clang++ DEFINES: NDEBUG - LD: clang + LD: clang++ LDFLAGS: -fsanitize=memory -DGTEST_HAS_TR1_TUPLE=0 -DGTEST_USE_OWN_TR1_TUPLE=1 -fPIE -pie $(if $(JENKINS_BUILD),-Wl$(comma)-Ttext-segment=0x7e0000000000,) LDXX: clang++ @@ -4422,6 +4441,7 @@ configs: LDFLAGS: -rdynamic opt: CPPFLAGS: -O2 + CXXFLAGS: -fno-exceptions DEFINES: NDEBUG stapprof: CPPFLAGS: -O2 -DGRPC_STAP_PROFILER @@ -4432,7 +4452,7 @@ configs: -DGPR_NO_DIRECT_SYSCALLS CXX: clang++ DEFINES: GRPC_TSAN - LD: clang + LD: clang++ LDFLAGS: -fsanitize=thread LDXX: clang++ compile_the_world: true @@ -4444,7 +4464,7 @@ configs: -Wno-unused-command-line-argument -Wvarargs CXX: clang++ DEFINES: NDEBUG - LD: clang + LD: clang++ LDFLAGS: -fsanitize=undefined,unsigned-integer-overflow LDXX: clang++ compile_the_world: true @@ -185,7 +185,7 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/surface/completion_queue.c \ src/core/lib/surface/completion_queue_factory.c \ src/core/lib/surface/event_string.c \ - src/core/lib/surface/lame_client.c \ + src/core/lib/surface/lame_client.cc \ src/core/lib/surface/metadata_array.c \ src/core/lib/surface/server.c \ src/core/lib/surface/validate_metadata.c \ diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 4bd9cd9363..a81d37cd63 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -197,9 +197,13 @@ Pod::Spec.new do |s| # To save you from scrolling, this is the last part of the podspec. ss.source_files = 'src/core/lib/profiling/timers.h', '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/backoff.h', 'src/core/lib/support/block_annotate.h', 'src/core/lib/support/env.h', + 'src/core/lib/support/memory.h', 'src/core/lib/support/mpscq.h', 'src/core/lib/support/murmur_hash.h', 'src/core/lib/support/spinlock.h', @@ -562,7 +566,7 @@ Pod::Spec.new do |s| 'src/core/lib/surface/completion_queue.c', 'src/core/lib/surface/completion_queue_factory.c', 'src/core/lib/surface/event_string.c', - 'src/core/lib/surface/lame_client.c', + 'src/core/lib/surface/lame_client.cc', 'src/core/lib/surface/metadata_array.c', 'src/core/lib/surface/server.c', 'src/core/lib/surface/validate_metadata.c', @@ -698,9 +702,13 @@ Pod::Spec.new do |s| ss.private_header_files = 'src/core/lib/profiling/timers.h', '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/backoff.h', 'src/core/lib/support/block_annotate.h', 'src/core/lib/support/env.h', + 'src/core/lib/support/memory.h', 'src/core/lib/support/mpscq.h', 'src/core/lib/support/murmur_hash.h', 'src/core/lib/support/spinlock.h', diff --git a/grpc.gemspec b/grpc.gemspec index e53bd29cd4..677839d495 100755 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -82,9 +82,13 @@ Gem::Specification.new do |s| s.files += %w( include/grpc/impl/codegen/sync_windows.h ) s.files += %w( src/core/lib/profiling/timers.h ) s.files += %w( src/core/lib/support/arena.h ) + 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/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/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/spinlock.h ) @@ -478,7 +482,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/surface/completion_queue.c ) s.files += %w( src/core/lib/surface/completion_queue_factory.c ) s.files += %w( src/core/lib/surface/event_string.c ) - s.files += %w( src/core/lib/surface/lame_client.c ) + s.files += %w( src/core/lib/surface/lame_client.cc ) s.files += %w( src/core/lib/surface/metadata_array.c ) s.files += %w( src/core/lib/surface/server.c ) s.files += %w( src/core/lib/surface/validate_metadata.c ) diff --git a/include/grpc/impl/codegen/compression_types.h b/include/grpc/impl/codegen/compression_types.h index 170d99f431..a563711e32 100644 --- a/include/grpc/impl/codegen/compression_types.h +++ b/include/grpc/impl/codegen/compression_types.h @@ -34,8 +34,7 @@ #ifndef GRPC_IMPL_CODEGEN_COMPRESSION_TYPES_H #define GRPC_IMPL_CODEGEN_COMPRESSION_TYPES_H -#include <stdbool.h> -#include <stdint.h> +#include <grpc/impl/codegen/port_platform.h> #ifdef __cplusplus extern "C" { @@ -101,7 +100,7 @@ typedef struct grpc_compression_options { * precedence over \a default_algorithm. * TODO(dgq): currently only available for server channels. */ struct { - bool is_set; + int is_set; grpc_compression_level level; } default_level; @@ -109,7 +108,7 @@ typedef struct grpc_compression_options { * call specific settings. This option corresponds to the channel argument key * behind \a GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM. */ struct { - bool is_set; + int is_set; grpc_compression_algorithm algorithm; } default_algorithm; diff --git a/include/grpc/impl/codegen/gpr_types.h b/include/grpc/impl/codegen/gpr_types.h index ed9976f429..34d8156b61 100644 --- a/include/grpc/impl/codegen/gpr_types.h +++ b/include/grpc/impl/codegen/gpr_types.h @@ -37,7 +37,6 @@ #include <grpc/impl/codegen/port_platform.h> #include <stddef.h> -#include <stdint.h> #ifdef __cplusplus extern "C" { diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h index b5d637ed41..8c0786f463 100644 --- a/include/grpc/impl/codegen/grpc_types.h +++ b/include/grpc/impl/codegen/grpc_types.h @@ -34,6 +34,8 @@ #ifndef GRPC_IMPL_CODEGEN_GRPC_TYPES_H #define GRPC_IMPL_CODEGEN_GRPC_TYPES_H +#include <grpc/impl/codegen/port_platform.h> + #include <grpc/impl/codegen/compression_types.h> #include <grpc/impl/codegen/exec_ctx_fwd.h> #include <grpc/impl/codegen/gpr_types.h> @@ -41,7 +43,6 @@ #include <grpc/impl/codegen/status.h> #include <stddef.h> -#include <stdint.h> #ifdef __cplusplus extern "C" { diff --git a/include/grpc/impl/codegen/port_platform.h b/include/grpc/impl/codegen/port_platform.h index 813e08b86e..e12f6f4e99 100644 --- a/include/grpc/impl/codegen/port_platform.h +++ b/include/grpc/impl/codegen/port_platform.h @@ -290,6 +290,12 @@ #endif #endif /* GPR_NO_AUTODETECT_PLATFORM */ +#if defined(__has_include) +#if __has_include(<atomic>) +#define GRPC_HAS_CXX11_ATOMIC +#endif /* __has_include(<atomic>) */ +#endif /* defined(__has_include) */ + #ifndef GPR_PLATFORM_STRING #warning "GPR_PLATFORM_STRING not auto-detected" #define GPR_PLATFORM_STRING "unknown" diff --git a/include/grpc/impl/codegen/slice.h b/include/grpc/impl/codegen/slice.h index 0b09a0bfd8..b89a3f7910 100644 --- a/include/grpc/impl/codegen/slice.h +++ b/include/grpc/impl/codegen/slice.h @@ -34,8 +34,9 @@ #ifndef GRPC_IMPL_CODEGEN_SLICE_H #define GRPC_IMPL_CODEGEN_SLICE_H +#include <grpc/impl/codegen/port_platform.h> + #include <stddef.h> -#include <stdint.h> #include <grpc/impl/codegen/exec_ctx_fwd.h> #include <grpc/impl/codegen/gpr_slice.h> diff --git a/package.xml b/package.xml index b128be672e..226e0b61da 100644 --- a/package.xml +++ b/package.xml @@ -91,9 +91,13 @@ <file baseinstalldir="/" name="include/grpc/impl/codegen/sync_windows.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/profiling/timers.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/support/arena.h" role="src" /> + <file baseinstalldir="/" name="src/core/lib/support/atomic.h" role="src" /> + <file baseinstalldir="/" name="src/core/lib/support/atomic_with_atm.h" role="src" /> + <file baseinstalldir="/" name="src/core/lib/support/atomic_with_std.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/support/backoff.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/support/block_annotate.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/support/env.h" role="src" /> + <file baseinstalldir="/" name="src/core/lib/support/memory.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/support/mpscq.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/support/murmur_hash.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/support/spinlock.h" role="src" /> @@ -487,7 +491,7 @@ <file baseinstalldir="/" name="src/core/lib/surface/completion_queue.c" role="src" /> <file baseinstalldir="/" name="src/core/lib/surface/completion_queue_factory.c" role="src" /> <file baseinstalldir="/" name="src/core/lib/surface/event_string.c" role="src" /> - <file baseinstalldir="/" name="src/core/lib/surface/lame_client.c" role="src" /> + <file baseinstalldir="/" name="src/core/lib/surface/lame_client.cc" role="src" /> <file baseinstalldir="/" name="src/core/lib/surface/metadata_array.c" role="src" /> <file baseinstalldir="/" name="src/core/lib/surface/server.c" role="src" /> <file baseinstalldir="/" name="src/core/lib/surface/validate_metadata.c" role="src" /> @@ -104,6 +104,7 @@ EXTRA_ENV_LINK_ARGS = os.environ.get('GRPC_PYTHON_LDFLAGS', None) if EXTRA_ENV_COMPILE_ARGS is None: EXTRA_ENV_COMPILE_ARGS = '' if 'win32' in sys.platform and sys.version_info < (3, 5): + EXTRA_ENV_COMPILE_ARGS += ' -std=c++11' # We use define flags here and don't directly add to DEFINE_MACROS below to # ensure that the expert user/builder has a way of turning it off (via the # envvars) without adding yet more GRPC-specific envvars. @@ -114,7 +115,9 @@ if EXTRA_ENV_COMPILE_ARGS is None: EXTRA_ENV_COMPILE_ARGS += ' -D_ftime=_ftime64 -D_timeb=__timeb64' elif 'win32' in sys.platform: EXTRA_ENV_COMPILE_ARGS += ' -D_PYTHON_MSVC' - elif "linux" in sys.platform or "darwin" in sys.platform: + elif "linux" in sys.platform: + EXTRA_ENV_COMPILE_ARGS += ' -std=c++11 -fvisibility=hidden -fno-wrapv' + elif "darwin" in sys.platform: EXTRA_ENV_COMPILE_ARGS += ' -fvisibility=hidden -fno-wrapv' if EXTRA_ENV_LINK_ARGS is None: @@ -192,13 +195,25 @@ def cython_extensions_and_necessity(): cython_module_files = [os.path.join(PYTHON_STEM, name.replace('.', '/') + '.pyx') for name in CYTHON_EXTENSION_MODULE_NAMES] + config = os.environ.get('CONFIG', 'opt') + prefix = 'libs/' + config + '/' + if "darwin" in sys.platform: + extra_objects = [prefix + 'libares.a', + prefix + 'libboringssl.a', + prefix + 'libgpr.a', + prefix + 'libgrpc.a'] + core_c_files = [] + else: + core_c_files = list(CORE_C_FILES) + extra_objects = [] extensions = [ _extension.Extension( name=module_name, - sources=[module_file] + list(CYTHON_HELPER_C_FILES) + list(CORE_C_FILES), + sources=[module_file] + list(CYTHON_HELPER_C_FILES) + core_c_files, include_dirs=list(EXTENSION_INCLUDE_DIRECTORIES), libraries=list(EXTENSION_LIBRARIES), define_macros=list(DEFINE_MACROS), + extra_objects=extra_objects, extra_compile_args=list(CFLAGS), extra_link_args=list(LDFLAGS), ) for (module_name, module_file) in zip(list(CYTHON_EXTENSION_MODULE_NAMES), cython_module_files) diff --git a/src/core/lib/iomgr/socket_mutator.h b/src/core/lib/iomgr/socket_mutator.h index 2f5b6c248e..28b1710ec4 100644 --- a/src/core/lib/iomgr/socket_mutator.h +++ b/src/core/lib/iomgr/socket_mutator.h @@ -37,6 +37,8 @@ #include <grpc/impl/codegen/grpc_types.h> #include <grpc/support/sync.h> +#include <stdbool.h> + #ifdef __cplusplus extern "C" { #endif diff --git a/src/core/lib/support/atomic.h b/src/core/lib/support/atomic.h new file mode 100644 index 0000000000..2226189b68 --- /dev/null +++ b/src/core/lib/support/atomic.h @@ -0,0 +1,45 @@ +/* + * + * Copyright 2017, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef GRPC_CORE_LIB_SUPPORT_ATOMIC_H +#define GRPC_CORE_LIB_SUPPORT_ATOMIC_H + +#include <grpc/support/port_platform.h> + +#ifdef GPR_HAS_CXX11_ATOMIC +#include "src/core/lib/support/atomic_with_std.h" +#else +#include "src/core/lib/support/atomic_with_atm.h" +#endif + +#endif /* GRPC_CORE_LIB_SUPPORT_ATOMIC_H */ diff --git a/src/core/lib/support/atomic_with_atm.h b/src/core/lib/support/atomic_with_atm.h new file mode 100644 index 0000000000..55727f1dee --- /dev/null +++ b/src/core/lib/support/atomic_with_atm.h @@ -0,0 +1,70 @@ +/* + * + * Copyright 2017, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef GRPC_CORE_LIB_SUPPORT_ATOMIC_WITH_ATM_H +#define GRPC_CORE_LIB_SUPPORT_ATOMIC_WITH_ATM_H + +#include <grpc/support/atm.h> + +namespace grpc_core { + +enum MemoryOrderRelaxed { memory_order_relaxed }; + +template <class T> +class atomic; + +template <> +class atomic<bool> { + public: + atomic() { gpr_atm_no_barrier_store(&x_, static_cast<gpr_atm>(false)); } + explicit atomic(bool x) { + gpr_atm_no_barrier_store(&x_, static_cast<gpr_atm>(x)); + } + + bool compare_exchange_strong(bool& expected, bool update, MemoryOrderRelaxed, + MemoryOrderRelaxed) { + if (!gpr_atm_no_barrier_cas(&x_, static_cast<gpr_atm>(expected), + static_cast<gpr_atm>(update))) { + expected = gpr_atm_no_barrier_load(&x_) != 0; + return false; + } + return true; + } + + private: + gpr_atm x_; +}; + +} // namespace grpc_core + +#endif /* GRPC_CORE_LIB_SUPPORT_ATOMIC_WITH_ATM_H */ diff --git a/src/core/lib/support/atomic_with_std.h b/src/core/lib/support/atomic_with_std.h new file mode 100644 index 0000000000..7e9c19efe8 --- /dev/null +++ b/src/core/lib/support/atomic_with_std.h @@ -0,0 +1,48 @@ +/* + * + * Copyright 2017, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef GRPC_CORE_LIB_SUPPORT_ATOMIC_WITH_STD_H +#define GRPC_CORE_LIB_SUPPORT_ATOMIC_WITH_STD_H + +#include <atomic> + +namespace grpc_core { + +template <class T> +using atomic = std::atomic<T>; + +typedef std::memory_order memory_order; + +} // namespace grpc_core + +#endif /* GRPC_CORE_LIB_SUPPORT_ATOMIC_WITH_STD_H */ diff --git a/src/core/lib/support/memory.h b/src/core/lib/support/memory.h new file mode 100644 index 0000000000..6eff94eff7 --- /dev/null +++ b/src/core/lib/support/memory.h @@ -0,0 +1,74 @@ +/* + * + * Copyright 2017, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef GRPC_CORE_LIB_SUPPORT_MEMORY_H +#define GRPC_CORE_LIB_SUPPORT_MEMORY_H + +#include <grpc/support/alloc.h> + +#include <memory> +#include <utility> + +namespace grpc_core { + +// Alternative to new, since we cannot use it (for fear of libstdc++) +template <typename T, typename... Args> +inline T* New(Args&&... args) { + void* p = gpr_malloc(sizeof(T)); + return new (p) T(std::forward<Args>(args)...); +} + +// Alternative to delete, since we cannot use it (for fear of libstdc++) +template <typename T> +inline void Delete(T* p) { + p->~T(); + gpr_free(p); +} + +template <typename T> +class DefaultDelete { + public: + void operator()(T* p) { Delete(p); } +}; + +template <typename T, typename Deleter = DefaultDelete<T>> +using UniquePtr = std::unique_ptr<T, Deleter>; + +template <typename T, typename... Args> +inline UniquePtr<T> MakeUnique(Args&&... args) { + return UniquePtr<T>(New<T>(std::forward<Args>(args)...)); +} + +} // namespace grpc_core + +#endif /* GRPC_CORE_LIB_SUPPORT_MEMORY_H */ diff --git a/src/core/lib/surface/lame_client.c b/src/core/lib/surface/lame_client.cc index 82428c42c0..88f4eaac08 100644 --- a/src/core/lib/surface/lame_client.c +++ b/src/core/lib/surface/lame_client.cc @@ -31,39 +31,50 @@ * */ -#include "src/core/lib/surface/lame_client.h" - #include <grpc/grpc.h> #include <string.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> + +#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" #include "src/core/lib/surface/call.h" #include "src/core/lib/surface/channel.h" +#include "src/core/lib/surface/lame_client.h" #include "src/core/lib/transport/static_metadata.h" +} -typedef struct { +namespace grpc_core { + +namespace { + +struct CallData { grpc_linked_mdelem status; grpc_linked_mdelem details; - gpr_atm filled_metadata; -} call_data; + grpc_core::atomic<bool> filled_metadata; +}; -typedef struct { +struct ChannelData { grpc_status_code error_code; const char *error_message; -} channel_data; +}; static void fill_metadata(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, grpc_metadata_batch *mdb) { - call_data *calld = elem->call_data; - if (!gpr_atm_no_barrier_cas(&calld->filled_metadata, 0, 1)) { + CallData *calld = static_cast<CallData *>(elem->call_data); + bool expected = false; + if (!calld->filled_metadata.compare_exchange_strong( + expected, true, grpc_core::memory_order_relaxed, + grpc_core::memory_order_relaxed)) { return; } - channel_data *chand = elem->channel_data; + ChannelData *chand = static_cast<ChannelData *>(elem->channel_data); char tmp[GPR_LTOA_MIN_BUFSIZE]; gpr_ltoa(chand->error_code, tmp); calld->status.md = grpc_mdelem_from_slices( @@ -83,7 +94,6 @@ static void fill_metadata(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, static void lame_start_transport_stream_op_batch( grpc_exec_ctx *exec_ctx, grpc_call_element *elem, grpc_transport_stream_op_batch *op) { - GRPC_CALL_LOG_OP(GPR_INFO, elem, op); if (op->recv_initial_metadata) { fill_metadata(exec_ctx, elem, op->payload->recv_initial_metadata.recv_initial_metadata); @@ -127,8 +137,6 @@ static void lame_start_transport_op(grpc_exec_ctx *exec_ctx, static grpc_error *init_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, const grpc_call_element_args *args) { - call_data *calld = elem->call_data; - gpr_atm_no_barrier_store(&calld->filled_metadata, 0); return GRPC_ERROR_NONE; } @@ -149,18 +157,22 @@ static grpc_error *init_channel_elem(grpc_exec_ctx *exec_ctx, static void destroy_channel_elem(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem) {} -const grpc_channel_filter grpc_lame_filter = { - lame_start_transport_stream_op_batch, - lame_start_transport_op, - sizeof(call_data), - init_call_elem, +} // namespace + +} // namespace grpc_core + +extern "C" 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), + grpc_core::init_call_elem, grpc_call_stack_ignore_set_pollset_or_pollset_set, - destroy_call_elem, - sizeof(channel_data), - init_channel_elem, - destroy_channel_elem, - lame_get_peer, - lame_get_channel_info, + grpc_core::destroy_call_elem, + sizeof(grpc_core::ChannelData), + grpc_core::init_channel_elem, + grpc_core::destroy_channel_elem, + grpc_core::lame_get_peer, + grpc_core::lame_get_channel_info, "lame-client", }; @@ -171,7 +183,6 @@ grpc_channel *grpc_lame_client_channel_create(const char *target, const char *error_message) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_channel_element *elem; - channel_data *chand; grpc_channel *channel = grpc_channel_create(&exec_ctx, target, NULL, GRPC_CLIENT_LAME_CHANNEL, NULL); elem = grpc_channel_stack_element(grpc_channel_get_channel_stack(channel), 0); @@ -180,7 +191,7 @@ grpc_channel *grpc_lame_client_channel_create(const char *target, "error_message=%s)", 3, (target, (int)error_code, error_message)); GPR_ASSERT(elem->filter == &grpc_lame_filter); - chand = (channel_data *)elem->channel_data; + auto chand = static_cast<grpc_core::ChannelData *>(elem->channel_data); chand->error_code = error_code; chand->error_message = error_message; grpc_exec_ctx_finish(&exec_ctx); diff --git a/src/python/grpcio/commands.py b/src/python/grpcio/commands.py index e50ccbe23e..4f072809c4 100644 --- a/src/python/grpcio/commands.py +++ b/src/python/grpcio/commands.py @@ -260,12 +260,36 @@ class BuildExt(build_ext.build_ext): """Custom build_ext command to enable compiler-specific flags.""" C_OPTIONS = { - 'unix': ('-pthread', '-std=gnu99'), + 'unix': ('-pthread',), 'msvc': (), } LINK_OPTIONS = {} def build_extensions(self): + if "darwin" in sys.platform: + config = os.environ.get('CONFIG', 'opt') + target_path = os.path.abspath( + os.path.join( + os.path.dirname(os.path.realpath(__file__)), '..', '..', + '..', 'libs', config)) + targets = [ + os.path.join(target_path, 'libboringssl.a'), + os.path.join(target_path, 'libares.a'), + os.path.join(target_path, 'libgpr.a'), + os.path.join(target_path, 'libgrpc.a') + ] + make_process = subprocess.Popen( + ['make'] + targets, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + make_out, make_err = make_process.communicate() + if make_out and make_process.returncode != 0: + sys.stdout.write(make_out + '\n') + if make_err: + sys.stderr.write(make_err + '\n') + if make_process.returncode != 0: + raise Exception("make command failed!") + compiler = self.compiler.compiler_type if compiler in BuildExt.C_OPTIONS: for extension in self.extensions: diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 16bb32bcc6..163d90f1a7 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -179,7 +179,7 @@ CORE_SOURCE_FILES = [ 'src/core/lib/surface/completion_queue.c', 'src/core/lib/surface/completion_queue_factory.c', 'src/core/lib/surface/event_string.c', - 'src/core/lib/surface/lame_client.c', + 'src/core/lib/surface/lame_client.cc', 'src/core/lib/surface/metadata_array.c', 'src/core/lib/surface/server.c', 'src/core/lib/surface/validate_metadata.c', diff --git a/src/ruby/ext/grpc/extconf.rb b/src/ruby/ext/grpc/extconf.rb index 7067933832..6c0486f1a8 100644 --- a/src/ruby/ext/grpc/extconf.rb +++ b/src/ruby/ext/grpc/extconf.rb @@ -65,6 +65,7 @@ ENV['MACOSX_DEPLOYMENT_TARGET'] = '10.7' ENV['AR'] = RbConfig::CONFIG['AR'] + ' rcs' ENV['CC'] = RbConfig::CONFIG['CC'] +ENV['CXX'] = RbConfig::CONFIG['CXX'] ENV['LD'] = ENV['CC'] ENV['AR'] = 'libtool -o' if RUBY_PLATFORM =~ /darwin/ @@ -84,7 +85,7 @@ unless windows puts 'Building internal gRPC into ' + grpc_lib_dir nproc = 4 nproc = Etc.nprocessors * 2 if Etc.respond_to? :nprocessors - system("make -j#{nproc} -C #{grpc_root} #{grpc_lib_dir}/libgrpc.a CONFIG=#{grpc_config}") + system("make -j#{nproc} -C #{grpc_root} #{grpc_lib_dir}/libgrpc.a CONFIG=#{grpc_config} Q=") exit 1 unless $? == 0 end diff --git a/test/core/support/memory_test.cc b/test/core/support/memory_test.cc new file mode 100644 index 0000000000..8db316a423 --- /dev/null +++ b/test/core/support/memory_test.cc @@ -0,0 +1,89 @@ +/* + * + * Copyright 2017, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "src/core/lib/support/memory.h" +#include <gtest/gtest.h> +#include "test/core/util/test_config.h" + +namespace grpc_core { +namespace testing { + +struct Foo { + Foo(int p, int q) : a(p), b(q) {} + int a; + int b; +}; + +TEST(MemoryTest, NewDeleteTest) { Delete(New<int>()); } + +TEST(MemoryTest, NewDeleteWithArgTest) { + int* i = New<int>(42); + EXPECT_EQ(42, *i); + Delete(i); +} + +TEST(MemoryTest, NewDeleteWithArgsTest) { + Foo* p = New<Foo>(1, 2); + EXPECT_EQ(1, p->a); + EXPECT_EQ(2, p->b); + Delete(p); +} + +TEST(MemoryTest, MakeUniqueTest) { MakeUnique<int>(); } + +TEST(MemoryTest, MakeUniqueWithArgTest) { + auto i = MakeUnique<int>(42); + EXPECT_EQ(42, *i); +} + +TEST(MemoryTest, UniquePtrWithCustomDeleter) { + int n = 0; + class IncrementingDeleter { + public: + void operator()(int* p) { ++*p; } + }; + { + UniquePtr<int, IncrementingDeleter> p(&n); + EXPECT_EQ(0, n); + } + EXPECT_EQ(1, n); +} + +} // 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 88a9736d5b..9664234f9f 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -1090,7 +1090,7 @@ src/core/lib/surface/completion_queue_factory.h \ src/core/lib/surface/event_string.c \ src/core/lib/surface/event_string.h \ src/core/lib/surface/init.h \ -src/core/lib/surface/lame_client.c \ +src/core/lib/surface/lame_client.cc \ src/core/lib/surface/lame_client.h \ src/core/lib/surface/metadata_array.c \ src/core/lib/surface/server.c \ diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 924595eb95..a363adc268 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -1249,6 +1249,9 @@ src/core/lib/support/alloc.c \ src/core/lib/support/arena.c \ src/core/lib/support/arena.h \ src/core/lib/support/atm.c \ +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/avl.c \ src/core/lib/support/backoff.c \ src/core/lib/support/backoff.h \ @@ -1269,6 +1272,7 @@ src/core/lib/support/log_android.c \ src/core/lib/support/log_linux.c \ src/core/lib/support/log_posix.c \ src/core/lib/support/log_windows.c \ +src/core/lib/support/memory.h \ src/core/lib/support/mpscq.c \ src/core/lib/support/mpscq.h \ src/core/lib/support/murmur_hash.c \ @@ -1329,7 +1333,7 @@ src/core/lib/surface/event_string.h \ src/core/lib/surface/init.c \ src/core/lib/surface/init.h \ src/core/lib/surface/init_secure.c \ -src/core/lib/surface/lame_client.c \ +src/core/lib/surface/lame_client.cc \ src/core/lib/surface/lame_client.h \ src/core/lib/surface/metadata_array.c \ src/core/lib/surface/server.c \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index c8011fdb89..52aaa0bccc 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -3400,6 +3400,25 @@ { "deps": [ "gpr", + "gpr_test_util", + "grpc", + "grpc++", + "grpc++_test", + "grpc_test_util" + ], + "headers": [], + "is_filegroup": false, + "language": "c++", + "name": "memory_test", + "src": [ + "test/core/support/memory_test.cc" + ], + "third_party": false, + "type": "target" + }, + { + "deps": [ + "gpr", "grpc", "grpc++", "grpc++_test_config" @@ -7453,9 +7472,13 @@ "include/grpc/support/useful.h", "src/core/lib/profiling/timers.h", "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/backoff.h", "src/core/lib/support/block_annotate.h", "src/core/lib/support/env.h", + "src/core/lib/support/memory.h", "src/core/lib/support/mpscq.h", "src/core/lib/support/murmur_hash.h", "src/core/lib/support/spinlock.h", @@ -7503,6 +7526,9 @@ "src/core/lib/support/arena.c", "src/core/lib/support/arena.h", "src/core/lib/support/atm.c", + "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/avl.c", "src/core/lib/support/backoff.c", "src/core/lib/support/backoff.h", @@ -7523,6 +7549,7 @@ "src/core/lib/support/log_linux.c", "src/core/lib/support/log_posix.c", "src/core/lib/support/log_windows.c", + "src/core/lib/support/memory.h", "src/core/lib/support/mpscq.c", "src/core/lib/support/mpscq.h", "src/core/lib/support/murmur_hash.c", @@ -7922,7 +7949,7 @@ "src/core/lib/surface/event_string.c", "src/core/lib/surface/event_string.h", "src/core/lib/surface/init.h", - "src/core/lib/surface/lame_client.c", + "src/core/lib/surface/lame_client.cc", "src/core/lib/surface/lame_client.h", "src/core/lib/surface/metadata_array.c", "src/core/lib/surface/server.c", diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index 6338ea7012..40669d2517 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -3473,6 +3473,28 @@ "flaky": false, "gtest": true, "language": "c++", + "name": "memory_test", + "platforms": [ + "linux", + "mac", + "posix", + "windows" + ] + }, + { + "args": [], + "ci_platforms": [ + "linux", + "mac", + "posix", + "windows" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "gtest": true, + "language": "c++", "name": "mock_test", "platforms": [ "linux", diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index cfa7071e00..9d3620a0fe 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -763,7 +763,7 @@ class CSharpLanguage(object): self._make_options = ['EMBED_OPENSSL=true'] if self.args.compiler != 'coreclr': # On Mac, official distribution of mono is 32bit. - self._make_options += ['CFLAGS=-m32', 'LDFLAGS=-m32'] + self._make_options += ['ARCH_FLAGS=-m32', 'LDFLAGS=-m32'] else: self._make_options = ['EMBED_OPENSSL=true', 'EMBED_ZLIB=true'] @@ -1352,7 +1352,8 @@ def make_jobspec(cfg, targets, makefile='Makefile'): '-f', makefile, '-j', '%d' % args.jobs, 'EXTRA_DEFINES=GRPC_TEST_SLOWDOWN_MACHINE_FACTOR=%f' % args.slowdown, - 'CONFIG=%s' % cfg] + + 'CONFIG=%s' % cfg, + 'Q='] + language_make_options + ([] if not args.travis else ['JENKINS_BUILD=1']) + targets, diff --git a/vsprojects/vcxproj/gpr/gpr.vcxproj b/vsprojects/vcxproj/gpr/gpr.vcxproj index 511ff06771..7fb81a7fbc 100644 --- a/vsprojects/vcxproj/gpr/gpr.vcxproj +++ b/vsprojects/vcxproj/gpr/gpr.vcxproj @@ -188,9 +188,13 @@ <ItemGroup> <ClInclude Include="$(SolutionDir)\..\src\core\lib\profiling\timers.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\support\arena.h" /> + <ClInclude Include="$(SolutionDir)\..\src\core\lib\support\atomic.h" /> + <ClInclude Include="$(SolutionDir)\..\src\core\lib\support\atomic_with_atm.h" /> + <ClInclude Include="$(SolutionDir)\..\src\core\lib\support\atomic_with_std.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\support\backoff.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\support\block_annotate.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\support\env.h" /> + <ClInclude Include="$(SolutionDir)\..\src\core\lib\support\memory.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\support\mpscq.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\support\murmur_hash.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\support\spinlock.h" /> diff --git a/vsprojects/vcxproj/gpr/gpr.vcxproj.filters b/vsprojects/vcxproj/gpr/gpr.vcxproj.filters index a098a54ae4..27d9d2f38f 100644 --- a/vsprojects/vcxproj/gpr/gpr.vcxproj.filters +++ b/vsprojects/vcxproj/gpr/gpr.vcxproj.filters @@ -260,6 +260,15 @@ <ClInclude Include="$(SolutionDir)\..\src\core\lib\support\arena.h"> <Filter>src\core\lib\support</Filter> </ClInclude> + <ClInclude Include="$(SolutionDir)\..\src\core\lib\support\atomic.h"> + <Filter>src\core\lib\support</Filter> + </ClInclude> + <ClInclude Include="$(SolutionDir)\..\src\core\lib\support\atomic_with_atm.h"> + <Filter>src\core\lib\support</Filter> + </ClInclude> + <ClInclude Include="$(SolutionDir)\..\src\core\lib\support\atomic_with_std.h"> + <Filter>src\core\lib\support</Filter> + </ClInclude> <ClInclude Include="$(SolutionDir)\..\src\core\lib\support\backoff.h"> <Filter>src\core\lib\support</Filter> </ClInclude> @@ -269,6 +278,9 @@ <ClInclude Include="$(SolutionDir)\..\src\core\lib\support\env.h"> <Filter>src\core\lib\support</Filter> </ClInclude> + <ClInclude Include="$(SolutionDir)\..\src\core\lib\support\memory.h"> + <Filter>src\core\lib\support</Filter> + </ClInclude> <ClInclude Include="$(SolutionDir)\..\src\core\lib\support\mpscq.h"> <Filter>src\core\lib\support</Filter> </ClInclude> diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj b/vsprojects/vcxproj/grpc++/grpc++.vcxproj index 424af0d9e7..32d2e09a58 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj @@ -774,7 +774,7 @@ </ClCompile> <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\event_string.c"> </ClCompile> - <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\lame_client.c"> + <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\lame_client.cc"> </ClCompile> <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\metadata_array.c"> </ClCompile> diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters index a2f74655d0..a3346bc297 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters @@ -430,7 +430,7 @@ <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\event_string.c"> <Filter>src\core\lib\surface</Filter> </ClCompile> - <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\lame_client.c"> + <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\lame_client.cc"> <Filter>src\core\lib\surface</Filter> </ClCompile> <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\metadata_array.c"> diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj index 3f8a2f2757..28ccefc651 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj @@ -758,7 +758,7 @@ </ClCompile> <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\event_string.c"> </ClCompile> - <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\lame_client.c"> + <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\lame_client.cc"> </ClCompile> <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\metadata_array.c"> </ClCompile> diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters index 929501a56c..83f869dab3 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters @@ -415,7 +415,7 @@ <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\event_string.c"> <Filter>src\core\lib\surface</Filter> </ClCompile> - <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\lame_client.c"> + <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\lame_client.cc"> <Filter>src\core\lib\surface</Filter> </ClCompile> <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\metadata_array.c"> diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj b/vsprojects/vcxproj/grpc/grpc.vcxproj index ca70dde793..d8b61b8c9d 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj @@ -712,7 +712,7 @@ </ClCompile> <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\event_string.c"> </ClCompile> - <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\lame_client.c"> + <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\lame_client.cc"> </ClCompile> <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\metadata_array.c"> </ClCompile> diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters index acadc0ad88..e1435f4084 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters @@ -310,7 +310,7 @@ <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\event_string.c"> <Filter>src\core\lib\surface</Filter> </ClCompile> - <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\lame_client.c"> + <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\lame_client.cc"> <Filter>src\core\lib\surface</Filter> </ClCompile> <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\metadata_array.c"> diff --git a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj index a5ec4ae171..df89932a97 100644 --- a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj +++ b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj @@ -547,7 +547,7 @@ </ClCompile> <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\event_string.c"> </ClCompile> - <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\lame_client.c"> + <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\lame_client.cc"> </ClCompile> <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\metadata_array.c"> </ClCompile> diff --git a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters index 4078ebd5d7..22cfbe14d4 100644 --- a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters +++ b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters @@ -367,7 +367,7 @@ <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\event_string.c"> <Filter>src\core\lib\surface</Filter> </ClCompile> - <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\lame_client.c"> + <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\lame_client.cc"> <Filter>src\core\lib\surface</Filter> </ClCompile> <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\metadata_array.c"> diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj index c844e157e4..0bfda72e81 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj @@ -680,7 +680,7 @@ </ClCompile> <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\event_string.c"> </ClCompile> - <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\lame_client.c"> + <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\lame_client.cc"> </ClCompile> <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\metadata_array.c"> </ClCompile> diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters index 43d27b44a2..63c8d7f254 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters @@ -313,7 +313,7 @@ <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\event_string.c"> <Filter>src\core\lib\surface</Filter> </ClCompile> - <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\lame_client.c"> + <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\lame_client.cc"> <Filter>src\core\lib\surface</Filter> </ClCompile> <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\metadata_array.c"> diff --git a/vsprojects/vcxproj/test/memory_test/memory_test.vcxproj b/vsprojects/vcxproj/test/memory_test/memory_test.vcxproj new file mode 100644 index 0000000000..1f4c1136ec --- /dev/null +++ b/vsprojects/vcxproj/test/memory_test/memory_test.vcxproj @@ -0,0 +1,204 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.props" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\1.0.204.1.props')" /> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{0B674E04-7F49-A76B-3FF6-989D751B9AA4}</ProjectGuid> + <IgnoreWarnIntDirInTempDetected>true</IgnoreWarnIntDirInTempDetected> + <IntDir>$(SolutionDir)IntDir\$(MSBuildProjectName)\</IntDir> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(VisualStudioVersion)' == '10.0'" Label="Configuration"> + <PlatformToolset>v100</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(VisualStudioVersion)' == '11.0'" Label="Configuration"> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(VisualStudioVersion)' == '12.0'" Label="Configuration"> + <PlatformToolset>v120</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(VisualStudioVersion)' == '14.0'" Label="Configuration"> + <PlatformToolset>v140</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(SolutionDir)\..\vsprojects\cpptest.props" /> + <Import Project="$(SolutionDir)\..\vsprojects\global.props" /> + <Import Project="$(SolutionDir)\..\vsprojects\openssl.props" /> + <Import Project="$(SolutionDir)\..\vsprojects\protobuf.props" /> + <Import Project="$(SolutionDir)\..\vsprojects\winsock.props" /> + <Import Project="$(SolutionDir)\..\vsprojects\zlib.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)'=='Debug'"> + <TargetName>memory_test</TargetName> + <Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib> + <Configuration-grpc_dependencies_zlib>Debug</Configuration-grpc_dependencies_zlib> + <Linkage-grpc_dependencies_openssl>static</Linkage-grpc_dependencies_openssl> + <Configuration-grpc_dependencies_openssl>Debug</Configuration-grpc_dependencies_openssl> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)'=='Release'"> + <TargetName>memory_test</TargetName> + <Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib> + <Configuration-grpc_dependencies_zlib>Release</Configuration-grpc_dependencies_zlib> + <Linkage-grpc_dependencies_openssl>static</Linkage-grpc_dependencies_openssl> + <Configuration-grpc_dependencies_openssl>Release</Configuration-grpc_dependencies_openssl> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <SDLCheck>true</SDLCheck> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat> + <MinimalRebuild Condition="$(Jenkins)">false</MinimalRebuild> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation> + <GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <SDLCheck>true</SDLCheck> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat> + <MinimalRebuild Condition="$(Jenkins)">false</MinimalRebuild> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation> + <GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <Optimization>MaxSpeed</Optimization> + <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <SDLCheck>true</SDLCheck> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat> + <MinimalRebuild Condition="$(Jenkins)">false</MinimalRebuild> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation> + <GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <Optimization>MaxSpeed</Optimization> + <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <SDLCheck>true</SDLCheck> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat> + <MinimalRebuild Condition="$(Jenkins)">false</MinimalRebuild> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation> + <GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + + <ItemGroup> + <ClCompile Include="$(SolutionDir)\..\test\core\support\memory_test.cc"> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc_test_util\grpc_test_util.vcxproj"> + <Project>{17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}</Project> + </ProjectReference> + <ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc++\grpc++.vcxproj"> + <Project>{C187A093-A0FE-489D-A40A-6E33DE0F9FEB}</Project> + </ProjectReference> + <ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc\grpc.vcxproj"> + <Project>{29D16885-7228-4C31-81ED-5F9187C7F2A9}</Project> + </ProjectReference> + <ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\gpr_test_util\gpr_test_util.vcxproj"> + <Project>{EAB0A629-17A9-44DB-B5FF-E91A721FE037}</Project> + </ProjectReference> + <ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\gpr\gpr.vcxproj"> + <Project>{B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}</Project> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <None Include="packages.config" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + <Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.redist.1.2.8.10\build\native\grpc.dependencies.zlib.redist.targets" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.redist.1.2.8.10\build\native\grpc.dependencies\grpc.dependencies.zlib.targets')" /> + <Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.1.2.8.10\build\native\grpc.dependencies.zlib.targets" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.1.2.8.10\build\native\grpc.dependencies\grpc.dependencies.zlib.targets')" /> + <Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.redist.1.0.204.1\build\native\grpc.dependencies.openssl.redist.targets" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.redist.1.0.204.1\build\native\grpc.dependencies\grpc.dependencies.openssl.targets')" /> + <Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.targets" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies\grpc.dependencies.openssl.targets')" /> + </ImportGroup> + <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> + <PropertyGroup> + <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> + </PropertyGroup> + <Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.redist.1.2.8.10\build\native\grpc.dependencies.zlib.redist.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.redist.1.2.8.10\build\native\grpc.dependencies.zlib.redist.targets')" /> + <Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.1.2.8.10\build\native\grpc.dependencies.zlib.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.1.2.8.10\build\native\grpc.dependencies.zlib.targets')" /> + <Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.redist.1.0.204.1\build\native\grpc.dependencies.openssl.redist.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.redist.1.0.204.1\build\native\grpc.dependencies.openssl.redist.targets')" /> + <Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.props')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.props')" /> + <Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.targets')" /> + </Target> +</Project> + diff --git a/vsprojects/vcxproj/test/memory_test/memory_test.vcxproj.filters b/vsprojects/vcxproj/test/memory_test/memory_test.vcxproj.filters new file mode 100644 index 0000000000..01a89346d2 --- /dev/null +++ b/vsprojects/vcxproj/test/memory_test/memory_test.vcxproj.filters @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <ClCompile Include="$(SolutionDir)\..\test\core\support\memory_test.cc"> + <Filter>test\core\support</Filter> + </ClCompile> + </ItemGroup> + + <ItemGroup> + <Filter Include="test"> + <UniqueIdentifier>{80245c10-56a8-a6ec-0abc-8125f4271d38}</UniqueIdentifier> + </Filter> + <Filter Include="test\core"> + <UniqueIdentifier>{eb61342c-1b95-756a-8b70-42aeb2a55f59}</UniqueIdentifier> + </Filter> + <Filter Include="test\core\support"> + <UniqueIdentifier>{8c8dfaee-c0b7-e843-c50e-427448fe1eb9}</UniqueIdentifier> + </Filter> + </ItemGroup> +</Project> + |