From 32a0218e6e01778ec31e00e3357bb26b7b610b6f Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 5 Jun 2024 10:34:29 -0700 Subject: [PATCH] [log] Use ABSL_ prefixed version of LOG/CHECK macros in the include/ tree (#36819) We should separately add a lint to ensure no new usage slips in. Closes #36819 COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36819 from ctiller:absl 61207b02f45a6abf0d4d0ccba118a1c011586708 PiperOrigin-RevId: 640572209 --- BUILD | 10 ++ CMakeLists.txt | 30 +++++- build_autogenerated.yaml | 22 +++++ gRPC-C++.podspec | 2 + include/grpcpp/client_context.h | 4 +- include/grpcpp/completion_queue.h | 8 +- include/grpcpp/impl/call_op_set.h | 18 ++-- include/grpcpp/impl/interceptor_common.h | 94 ++++++++++--------- include/grpcpp/impl/proto_utils.h | 6 +- include/grpcpp/impl/rpc_service_method.h | 18 ++-- .../grpcpp/impl/server_callback_handlers.h | 18 ++-- include/grpcpp/impl/service_type.h | 14 +-- include/grpcpp/impl/sync.h | 4 +- include/grpcpp/server_interface.h | 6 +- include/grpcpp/support/async_stream.h | 90 +++++++++--------- include/grpcpp/support/async_unary_call.h | 20 ++-- include/grpcpp/support/callback_common.h | 16 ++-- include/grpcpp/support/client_callback.h | 34 +++---- include/grpcpp/support/client_interceptor.h | 4 +- include/grpcpp/support/method_handler.h | 4 +- include/grpcpp/support/proto_buffer_reader.h | 10 +- include/grpcpp/support/proto_buffer_writer.h | 10 +- include/grpcpp/support/server_interceptor.h | 4 +- include/grpcpp/support/sync_stream.h | 22 ++--- 24 files changed, 266 insertions(+), 202 deletions(-) diff --git a/BUILD b/BUILD index 2df4affb927..ebd41076cf9 100644 --- a/BUILD +++ b/BUILD @@ -910,6 +910,8 @@ grpc_cc_library( external_deps = [ "absl/log:check", "absl/log:log", + "absl/log:absl_check", + "absl/log:absl_log", "absl/strings:cord", "absl/synchronization", "protobuf_headers", @@ -941,6 +943,8 @@ grpc_cc_library( external_deps = [ "absl/log:check", "absl/log:log", + "absl/log:absl_check", + "absl/log:absl_log", "absl/strings:cord", ], language = "c++", @@ -1258,6 +1262,8 @@ grpc_cc_library( external_deps = [ "absl/log:check", "absl/log:log", + "absl/log:absl_check", + "absl/log:absl_log", "absl/strings", "absl/synchronization", ], @@ -2478,6 +2484,8 @@ grpc_cc_library( "absl/functional:any_invocable", "absl/log:check", "absl/log:log", + "absl/log:absl_check", + "absl/log:absl_log", "absl/status", "absl/status:statusor", "absl/strings", @@ -2566,6 +2574,8 @@ grpc_cc_library( "absl/status:statusor", "absl/strings", "absl/synchronization", + "absl/log:absl_check", + "absl/log:absl_log", "absl/types:optional", "absl/memory", "@com_google_protobuf//upb:base", diff --git a/CMakeLists.txt b/CMakeLists.txt index ae0d73b684f..10397373769 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,6 +97,8 @@ set(gRPC_ABSL_PROVIDER "module" CACHE STRING "Provider of absl library") set_property(CACHE gRPC_ABSL_PROVIDER PROPERTY STRINGS "module" "package") set(gRPC_ABSL_USED_TARGETS + absl_absl_check + absl_absl_log absl_absl_vlog_is_on absl_algorithm absl_algorithm_container @@ -4175,6 +4177,8 @@ target_include_directories(grpc++ ) target_link_libraries(grpc++ ${_gRPC_ALLTARGETS_LIBRARIES} + absl::absl_check + absl::absl_log grpc ${_gRPC_PROTOBUF_LIBRARIES} ) @@ -4917,6 +4921,8 @@ target_include_directories(grpc++_unsecure ) target_link_libraries(grpc++_unsecure ${_gRPC_ALLTARGETS_LIBRARIES} + absl::absl_check + absl::absl_log grpc_unsecure ${_gRPC_PROTOBUF_LIBRARIES} ) @@ -8285,6 +8291,8 @@ target_include_directories(binder_transport_test target_link_libraries(binder_transport_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest + absl::absl_check + absl::absl_log ${_gRPC_PROTOBUF_LIBRARIES} grpc_test_util ) @@ -13318,6 +13326,8 @@ target_include_directories(endpoint_binder_pool_test target_link_libraries(endpoint_binder_pool_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest + absl::absl_check + absl::absl_log ${_gRPC_PROTOBUF_LIBRARIES} grpc_test_util ) @@ -14176,6 +14186,8 @@ target_include_directories(fake_binder_test target_link_libraries(fake_binder_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest + absl::absl_check + absl::absl_log ${_gRPC_PROTOBUF_LIBRARIES} grpc_test_util ) @@ -32478,6 +32490,8 @@ target_include_directories(transport_stream_receiver_test target_link_libraries(transport_stream_receiver_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest + absl::absl_check + absl::absl_log ${_gRPC_PROTOBUF_LIBRARIES} grpc_test_util ) @@ -33313,6 +33327,8 @@ target_include_directories(wire_reader_test target_link_libraries(wire_reader_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest + absl::absl_check + absl::absl_log ${_gRPC_PROTOBUF_LIBRARIES} grpc_test_util ) @@ -33421,6 +33437,8 @@ target_include_directories(wire_writer_test target_link_libraries(wire_writer_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest + absl::absl_check + absl::absl_log ${_gRPC_PROTOBUF_LIBRARIES} grpc_test_util ) @@ -33966,6 +33984,8 @@ target_include_directories(xds_client_test target_link_libraries(xds_client_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest + absl::absl_check + absl::absl_log ${_gRPC_PROTOBUF_LIBRARIES} grpc_test_util ) @@ -34258,6 +34278,8 @@ target_include_directories(xds_cluster_resource_type_test target_link_libraries(xds_cluster_resource_type_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest + absl::absl_check + absl::absl_log ${_gRPC_PROTOBUF_LIBRARIES} grpc_test_util ) @@ -35252,6 +35274,8 @@ target_include_directories(xds_endpoint_resource_type_test target_link_libraries(xds_endpoint_resource_type_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest + absl::absl_check + absl::absl_log ${_gRPC_PROTOBUF_LIBRARIES} grpc_test_util ) @@ -37676,7 +37700,7 @@ generate_pkgconfig( "gRPC++" "C++ wrapper for gRPC" "${gRPC_CPP_VERSION}" - "absl_algorithm_container absl_any_invocable absl_base absl_bind_front absl_check absl_cleanup absl_config absl_cord absl_core_headers absl_flags absl_flags_marshalling absl_flat_hash_map absl_flat_hash_set absl_function_ref absl_hash absl_inlined_vector absl_log absl_log_globals absl_log_severity absl_memory absl_no_destructor absl_optional absl_random_bit_gen_ref absl_random_distributions absl_random_random absl_span absl_status absl_statusor absl_str_format absl_strings absl_synchronization absl_time absl_type_traits absl_utility absl_variant gpr grpc" + "absl_absl_check absl_absl_log absl_algorithm_container absl_any_invocable absl_base absl_bind_front absl_check absl_cleanup absl_config absl_cord absl_core_headers absl_flags absl_flags_marshalling absl_flat_hash_map absl_flat_hash_set absl_function_ref absl_hash absl_inlined_vector absl_log absl_log_globals absl_log_severity absl_memory absl_no_destructor absl_optional absl_random_bit_gen_ref absl_random_distributions absl_random_random absl_span absl_status absl_statusor absl_str_format absl_strings absl_synchronization absl_time absl_type_traits absl_utility absl_variant gpr grpc" "libcares openssl re2 zlib" "-lgrpc++" "-laddress_sorting -lupb_textformat_lib -lupb_json_lib -lupb_message_lib -lupb_mem_lib -lupb_base_lib -lutf8_range_lib" @@ -37687,7 +37711,7 @@ generate_pkgconfig( "gRPC++ unsecure" "C++ wrapper for gRPC without SSL" "${gRPC_CPP_VERSION}" - "absl_algorithm_container absl_any_invocable absl_base absl_bind_front absl_check absl_cleanup absl_config absl_cord absl_core_headers absl_flags absl_flags_marshalling absl_flat_hash_map absl_flat_hash_set absl_function_ref absl_hash absl_inlined_vector absl_log absl_log_globals absl_log_severity absl_memory absl_no_destructor absl_optional absl_random_bit_gen_ref absl_random_distributions absl_random_random absl_span absl_status absl_statusor absl_str_format absl_strings absl_synchronization absl_time absl_type_traits absl_utility absl_variant gpr grpc_unsecure" + "absl_absl_check absl_absl_log absl_algorithm_container absl_any_invocable absl_base absl_bind_front absl_check absl_cleanup absl_config absl_cord absl_core_headers absl_flags absl_flags_marshalling absl_flat_hash_map absl_flat_hash_set absl_function_ref absl_hash absl_inlined_vector absl_log absl_log_globals absl_log_severity absl_memory absl_no_destructor absl_optional absl_random_bit_gen_ref absl_random_distributions absl_random_random absl_span absl_status absl_statusor absl_str_format absl_strings absl_synchronization absl_time absl_type_traits absl_utility absl_variant gpr grpc_unsecure" "libcares zlib" "-lgrpc++_unsecure" "-laddress_sorting -lupb_message_lib -lupb_mem_lib -lupb_base_lib -lutf8_range_lib" @@ -37698,7 +37722,7 @@ generate_pkgconfig( "gRPC++ OpenTelemetry Plugin" "OpenTelemetry Plugin for gRPC C++" "${gRPC_CPP_VERSION}" - "absl_algorithm_container absl_any_invocable absl_base absl_bind_front absl_check absl_cleanup absl_config absl_cord absl_core_headers absl_flags absl_flags_marshalling absl_flat_hash_map absl_flat_hash_set absl_function_ref absl_hash absl_inlined_vector absl_log absl_log_globals absl_log_severity absl_memory absl_no_destructor absl_optional absl_random_bit_gen_ref absl_random_distributions absl_random_random absl_span absl_status absl_statusor absl_str_format absl_strings absl_synchronization absl_time absl_type_traits absl_utility absl_variant gpr grpc grpc++ opentelemetry_api" + "absl_absl_check absl_absl_log absl_algorithm_container absl_any_invocable absl_base absl_bind_front absl_check absl_cleanup absl_config absl_cord absl_core_headers absl_flags absl_flags_marshalling absl_flat_hash_map absl_flat_hash_set absl_function_ref absl_hash absl_inlined_vector absl_log absl_log_globals absl_log_severity absl_memory absl_no_destructor absl_optional absl_random_bit_gen_ref absl_random_distributions absl_random_random absl_span absl_status absl_statusor absl_str_format absl_strings absl_synchronization absl_time absl_type_traits absl_utility absl_variant gpr grpc grpc++ opentelemetry_api" "libcares openssl re2 zlib" "-lgrpcpp_otel_plugin" "-laddress_sorting -lupb_textformat_lib -lupb_json_lib -lupb_message_lib -lupb_mem_lib -lupb_base_lib -lutf8_range_lib" diff --git a/build_autogenerated.yaml b/build_autogenerated.yaml index 792d48d015d..06418da3336 100644 --- a/build_autogenerated.yaml +++ b/build_autogenerated.yaml @@ -3958,6 +3958,8 @@ libs: - src/cpp/util/string_ref.cc - src/cpp/util/time_cc.cc deps: + - absl/log:absl_check + - absl/log:absl_log - grpc - protobuf baselib: true @@ -4331,6 +4333,8 @@ libs: - src/cpp/util/string_ref.cc - src/cpp/util/time_cc.cc deps: + - absl/log:absl_check + - absl/log:absl_log - grpc_unsecure - protobuf baselib: true @@ -6256,6 +6260,8 @@ targets: - test/core/transport/binder/mock_objects.cc deps: - gtest + - absl/log:absl_check + - absl/log:absl_log - protobuf - grpc_test_util uses_polling: false @@ -9762,6 +9768,8 @@ targets: - test/core/transport/binder/mock_objects.cc deps: - gtest + - absl/log:absl_check + - absl/log:absl_log - protobuf - grpc_test_util uses_polling: false @@ -10252,6 +10260,8 @@ targets: - test/core/transport/binder/end2end/fake_binder_test.cc deps: - gtest + - absl/log:absl_check + - absl/log:absl_log - protobuf - grpc_test_util uses_polling: false @@ -21151,6 +21161,8 @@ targets: - test/core/transport/binder/transport_stream_receiver_test.cc deps: - gtest + - absl/log:absl_check + - absl/log:absl_log - protobuf - grpc_test_util uses_polling: false @@ -21529,6 +21541,8 @@ targets: - test/core/transport/binder/wire_reader_test.cc deps: - gtest + - absl/log:absl_check + - absl/log:absl_log - protobuf - grpc_test_util uses_polling: false @@ -21638,6 +21652,8 @@ targets: - test/core/transport/binder/wire_writer_test.cc deps: - gtest + - absl/log:absl_check + - absl/log:absl_log - protobuf - grpc_test_util uses_polling: false @@ -21926,6 +21942,8 @@ targets: - test/core/xds/xds_transport_fake.cc deps: - gtest + - absl/log:absl_check + - absl/log:absl_log - protobuf - grpc_test_util uses_polling: false @@ -22019,6 +22037,8 @@ targets: - test/core/xds/xds_cluster_resource_type_test.cc deps: - gtest + - absl/log:absl_check + - absl/log:absl_log - protobuf - grpc_test_util uses_polling: false @@ -22363,6 +22383,8 @@ targets: - test/core/xds/xds_endpoint_resource_type_test.cc deps: - gtest + - absl/log:absl_check + - absl/log:absl_log - protobuf - grpc_test_util uses_polling: false diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 5a3f0443b4b..896971c662b 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -244,6 +244,8 @@ Pod::Spec.new do |s| ss.dependency 'abseil/functional/bind_front', abseil_version ss.dependency 'abseil/functional/function_ref', abseil_version ss.dependency 'abseil/hash/hash', abseil_version + ss.dependency 'abseil/log/absl_check', abseil_version + ss.dependency 'abseil/log/absl_log', abseil_version ss.dependency 'abseil/log/check', abseil_version ss.dependency 'abseil/log/globals', abseil_version ss.dependency 'abseil/log/log', abseil_version diff --git a/include/grpcpp/client_context.h b/include/grpcpp/client_context.h index 2328e3e6fc6..d0934dd0f54 100644 --- a/include/grpcpp/client_context.h +++ b/include/grpcpp/client_context.h @@ -38,7 +38,7 @@ #include #include -#include "absl/log/check.h" +#include "absl/log/absl_check.h" #include #include @@ -248,7 +248,7 @@ class ClientContext { /// \return A multimap of initial metadata key-value pairs from the server. const std::multimap& GetServerInitialMetadata() const { - CHECK(initial_metadata_received_); + ABSL_CHECK(initial_metadata_received_); return *recv_initial_metadata_.map(); } diff --git a/include/grpcpp/completion_queue.h b/include/grpcpp/completion_queue.h index bfd138b5945..63d202b0e2f 100644 --- a/include/grpcpp/completion_queue.h +++ b/include/grpcpp/completion_queue.h @@ -34,7 +34,7 @@ #include -#include "absl/log/check.h" +#include "absl/log/absl_check.h" #include #include @@ -325,7 +325,7 @@ class CompletionQueue : private grpc::internal::GrpcLibrary { bool ok = ev.success != 0; void* ignored = tag; if (tag->FinalizeResult(&ignored, &ok)) { - CHECK(ignored == tag); + ABSL_CHECK(ignored == tag); return ok; } } @@ -346,7 +346,7 @@ class CompletionQueue : private grpc::internal::GrpcLibrary { bool ok = ev.success != 0; void* ignored = tag; // the tag must be swallowed if using TryPluck - CHECK(!tag->FinalizeResult(&ignored, &ok)); + ABSL_CHECK(!tag->FinalizeResult(&ignored, &ok)); } /// Performs a single polling pluck on \a tag. Calls tag->FinalizeResult if @@ -363,7 +363,7 @@ class CompletionQueue : private grpc::internal::GrpcLibrary { bool ok = ev.success != 0; void* ignored = tag; - CHECK(!tag->FinalizeResult(&ignored, &ok)); + ABSL_CHECK(!tag->FinalizeResult(&ignored, &ok)); } /// Manage state of avalanching operations : completion queue tags that diff --git a/include/grpcpp/impl/call_op_set.h b/include/grpcpp/impl/call_op_set.h index 3fea3b65621..5afa8272aa2 100644 --- a/include/grpcpp/impl/call_op_set.h +++ b/include/grpcpp/impl/call_op_set.h @@ -23,8 +23,8 @@ #include #include -#include "absl/log/check.h" -#include "absl/log/log.h" +#include "absl/log/absl_check.h" +#include "absl/log/absl_log.h" #include #include @@ -318,7 +318,7 @@ class CallOpSendMessage { return; } if (msg_ != nullptr) { - CHECK(serializer_(msg_).ok()); + ABSL_CHECK(serializer_(msg_).ok()); } serializer_ = nullptr; grpc_op* op = &ops[(*nops)++]; @@ -799,7 +799,7 @@ class CallOpClientRecvStatus { if (recv_status_ == nullptr || hijacked_) return; if (static_cast(status_code_) == StatusCode::OK) { *recv_status_ = Status(); - DCHECK_EQ(debug_error_string_, nullptr); + ABSL_DCHECK_EQ(debug_error_string_, nullptr); } else { *recv_status_ = Status(static_cast(status_code_), @@ -976,9 +976,9 @@ class CallOpSet : public CallOpSetInterface, // A failure here indicates an API misuse; for example, doing a Write // while another Write is already pending on the same RPC or invoking // WritesDone multiple times - LOG(ERROR) << "API misuse of type " << grpc_call_error_to_string(err) - << " observed"; - CHECK(false); + ABSL_LOG(ERROR) << "API misuse of type " << grpc_call_error_to_string(err) + << " observed"; + ABSL_CHECK(false); } } @@ -988,8 +988,8 @@ class CallOpSet : public CallOpSetInterface, done_intercepting_ = true; // The following call_start_batch is internally-generated so no need for an // explanatory log on failure. - CHECK(grpc_call_start_batch(call_.call(), nullptr, 0, core_cq_tag(), - nullptr) == GRPC_CALL_OK); + ABSL_CHECK(grpc_call_start_batch(call_.call(), nullptr, 0, core_cq_tag(), + nullptr) == GRPC_CALL_OK); } private: diff --git a/include/grpcpp/impl/interceptor_common.h b/include/grpcpp/impl/interceptor_common.h index f8b104ba89c..7e3a566f6b3 100644 --- a/include/grpcpp/impl/interceptor_common.h +++ b/include/grpcpp/impl/interceptor_common.h @@ -22,7 +22,7 @@ #include #include -#include "absl/log/check.h" +#include "absl/log/absl_check.h" #include #include @@ -58,15 +58,16 @@ class InterceptorBatchMethodsImpl if (call_->client_rpc_info() != nullptr) { return ProceedClient(); } - CHECK_NE(call_->server_rpc_info(), nullptr); + ABSL_CHECK_NE(call_->server_rpc_info(), nullptr); ProceedServer(); } void Hijack() override { // Only the client can hijack when sending down initial metadata - CHECK(!reverse_ && ops_ != nullptr && call_->client_rpc_info() != nullptr); + ABSL_CHECK(!reverse_ && ops_ != nullptr && + call_->client_rpc_info() != nullptr); // It is illegal to call Hijack twice - CHECK(!ran_hijacking_interceptor_); + ABSL_CHECK(!ran_hijacking_interceptor_); auto* rpc_info = call_->client_rpc_info(); rpc_info->hijacked_ = true; rpc_info->hijacked_interceptor_ = current_interceptor_index_; @@ -81,21 +82,21 @@ class InterceptorBatchMethodsImpl } ByteBuffer* GetSerializedSendMessage() override { - CHECK_NE(orig_send_message_, nullptr); + ABSL_CHECK_NE(orig_send_message_, nullptr); if (*orig_send_message_ != nullptr) { - CHECK(serializer_(*orig_send_message_).ok()); + ABSL_CHECK(serializer_(*orig_send_message_).ok()); *orig_send_message_ = nullptr; } return send_message_; } const void* GetSendMessage() override { - CHECK_NE(orig_send_message_, nullptr); + ABSL_CHECK_NE(orig_send_message_, nullptr); return *orig_send_message_; } void ModifySendMessage(const void* message) override { - CHECK_NE(orig_send_message_, nullptr); + ABSL_CHECK_NE(orig_send_message_, nullptr); *orig_send_message_ = message; } @@ -130,7 +131,7 @@ class InterceptorBatchMethodsImpl Status* GetRecvStatus() override { return recv_status_; } void FailHijackedSendMessage() override { - CHECK(hooks_[static_cast( + ABSL_CHECK(hooks_[static_cast( experimental::InterceptionHookPoints::PRE_SEND_MESSAGE)]); *fail_send_message_ = true; } @@ -193,7 +194,7 @@ class InterceptorBatchMethodsImpl } void FailHijackedRecvMessage() override { - CHECK(hooks_[static_cast( + ABSL_CHECK(hooks_[static_cast( experimental::InterceptionHookPoints::PRE_RECV_MESSAGE)]); *hijacked_recv_message_failed_ = true; } @@ -237,7 +238,7 @@ class InterceptorBatchMethodsImpl // ContinueFinalizeOpsAfterInterception will be called. Note that neither of // them is invoked if there were no interceptors registered. bool RunInterceptors() { - CHECK(ops_); + ABSL_CHECK(ops_); auto* client_rpc_info = call_->client_rpc_info(); if (client_rpc_info != nullptr) { if (client_rpc_info->interceptors_.empty()) { @@ -262,8 +263,8 @@ class InterceptorBatchMethodsImpl // SyncRequest. bool RunInterceptors(std::function f) { // This is used only by the server for initial call request - CHECK_EQ(reverse_, true); - CHECK_EQ(call_->client_rpc_info(), nullptr); + ABSL_CHECK_EQ(reverse_, true); + ABSL_CHECK_EQ(call_->client_rpc_info(), nullptr); auto* server_rpc_info = call_->server_rpc_info(); if (server_rpc_info == nullptr || server_rpc_info->interceptors_.empty()) { return true; @@ -357,7 +358,7 @@ class InterceptorBatchMethodsImpl return ops_->ContinueFinalizeResultAfterInterception(); } } - CHECK(callback_); + ABSL_CHECK(callback_); callback_(); } @@ -423,98 +424,103 @@ class CancelInterceptorBatchMethods void Hijack() override { // Only the client can hijack when sending down initial metadata - CHECK(false) << "It is illegal to call Hijack on a method which has a " - "Cancel notification"; + ABSL_CHECK(false) << "It is illegal to call Hijack on a method which has a " + "Cancel notification"; } ByteBuffer* GetSerializedSendMessage() override { - CHECK(false) << "It is illegal to call GetSendMessage on a method which " - "has a Cancel notification"; + ABSL_CHECK(false) + << "It is illegal to call GetSendMessage on a method which " + "has a Cancel notification"; return nullptr; } bool GetSendMessageStatus() override { - CHECK(false) + ABSL_CHECK(false) << "It is illegal to call GetSendMessageStatus on a method which " "has a Cancel notification"; return false; } const void* GetSendMessage() override { - CHECK(false) + ABSL_CHECK(false) << "It is illegal to call GetOriginalSendMessage on a method which " "has a Cancel notification"; return nullptr; } void ModifySendMessage(const void* /*message*/) override { - CHECK(false) << "It is illegal to call ModifySendMessage on a method which " - "has a Cancel notification"; + ABSL_CHECK(false) + << "It is illegal to call ModifySendMessage on a method which " + "has a Cancel notification"; } std::multimap* GetSendInitialMetadata() override { - CHECK(false) << "It is illegal to call GetSendInitialMetadata on a " - "method which has a Cancel notification"; + ABSL_CHECK(false) << "It is illegal to call GetSendInitialMetadata on a " + "method which has a Cancel notification"; return nullptr; } Status GetSendStatus() override { - CHECK(false) << "It is illegal to call GetSendStatus on a method which " - "has a Cancel notification"; + ABSL_CHECK(false) + << "It is illegal to call GetSendStatus on a method which " + "has a Cancel notification"; return Status(); } void ModifySendStatus(const Status& /*status*/) override { - CHECK(false) << "It is illegal to call ModifySendStatus on a method " - "which has a Cancel notification"; + ABSL_CHECK(false) << "It is illegal to call ModifySendStatus on a method " + "which has a Cancel notification"; } std::multimap* GetSendTrailingMetadata() override { - CHECK(false) << "It is illegal to call GetSendTrailingMetadata on a " - "method which has a Cancel notification"; + ABSL_CHECK(false) << "It is illegal to call GetSendTrailingMetadata on a " + "method which has a Cancel notification"; return nullptr; } void* GetRecvMessage() override { - CHECK(false) << "It is illegal to call GetRecvMessage on a method which " - "has a Cancel notification"; + ABSL_CHECK(false) + << "It is illegal to call GetRecvMessage on a method which " + "has a Cancel notification"; return nullptr; } std::multimap* GetRecvInitialMetadata() override { - CHECK(false) << "It is illegal to call GetRecvInitialMetadata on a " - "method which has a Cancel notification"; + ABSL_CHECK(false) << "It is illegal to call GetRecvInitialMetadata on a " + "method which has a Cancel notification"; return nullptr; } Status* GetRecvStatus() override { - CHECK(false) << "It is illegal to call GetRecvStatus on a method which " - "has a Cancel notification"; + ABSL_CHECK(false) + << "It is illegal to call GetRecvStatus on a method which " + "has a Cancel notification"; return nullptr; } std::multimap* GetRecvTrailingMetadata() override { - CHECK(false) << "It is illegal to call GetRecvTrailingMetadata on a " - "method which has a Cancel notification"; + ABSL_CHECK(false) << "It is illegal to call GetRecvTrailingMetadata on a " + "method which has a Cancel notification"; return nullptr; } std::unique_ptr GetInterceptedChannel() override { - CHECK(false) << "It is illegal to call GetInterceptedChannel on a " - "method which has a Cancel notification"; + ABSL_CHECK(false) << "It is illegal to call GetInterceptedChannel on a " + "method which has a Cancel notification"; return std::unique_ptr(nullptr); } void FailHijackedRecvMessage() override { - CHECK(false) << "It is illegal to call FailHijackedRecvMessage on a " - "method which has a Cancel notification"; + ABSL_CHECK(false) << "It is illegal to call FailHijackedRecvMessage on a " + "method which has a Cancel notification"; } void FailHijackedSendMessage() override { - CHECK(false) << "It is illegal to call FailHijackedSendMessage on a " - "method which has a Cancel notification"; + ABSL_CHECK(false) << "It is illegal to call FailHijackedSendMessage on a " + "method which has a Cancel notification"; } }; } // namespace internal diff --git a/include/grpcpp/impl/proto_utils.h b/include/grpcpp/impl/proto_utils.h index 0cd4d1bdb4b..20d14358426 100644 --- a/include/grpcpp/impl/proto_utils.h +++ b/include/grpcpp/impl/proto_utils.h @@ -21,7 +21,7 @@ #include -#include "absl/log/check.h" +#include "absl/log/absl_check.h" #include #include @@ -53,8 +53,8 @@ Status GenericSerialize(const grpc::protobuf::MessageLite& msg, ByteBuffer* bb, if (static_cast(byte_size) <= GRPC_SLICE_INLINED_SIZE) { Slice slice(byte_size); // We serialize directly into the allocated slices memory - CHECK(slice.end() == msg.SerializeWithCachedSizesToArray( - const_cast(slice.begin()))); + ABSL_CHECK(slice.end() == msg.SerializeWithCachedSizesToArray( + const_cast(slice.begin()))); ByteBuffer tmp(&slice, 1); bb->Swap(&tmp); diff --git a/include/grpcpp/impl/rpc_service_method.h b/include/grpcpp/impl/rpc_service_method.h index 3537409ab17..6ab92c978e3 100644 --- a/include/grpcpp/impl/rpc_service_method.h +++ b/include/grpcpp/impl/rpc_service_method.h @@ -25,8 +25,8 @@ #include #include -#include "absl/log/check.h" -#include "absl/log/log.h" +#include "absl/log/absl_check.h" +#include "absl/log/absl_log.h" #include #include @@ -77,7 +77,7 @@ class MethodHandler { // retained by the handler. Returns nullptr if deserialization failed. virtual void* Deserialize(grpc_call* /*call*/, grpc_byte_buffer* req, Status* /*status*/, void** /*handler_data*/) { - CHECK_EQ(req, nullptr); + ABSL_CHECK_EQ(req, nullptr); return nullptr; } }; @@ -116,12 +116,12 @@ class RpcServiceMethod : public RpcMethod { // this is not an error condition, as it allows users to declare a server // like WithRawMethod_foo. However since it // overwrites behavior, it should be logged. - LOG(INFO) << "You are marking method " << name() << " as '" - << TypeToString(api_type_) - << "', even though it was previously marked '" - << TypeToString(type) - << "'. This behavior will overwrite the original behavior. If " - "you expected this then ignore this message."; + ABSL_LOG(INFO) + << "You are marking method " << name() << " as '" + << TypeToString(api_type_) + << "', even though it was previously marked '" << TypeToString(type) + << "'. This behavior will overwrite the original behavior. If " + "you expected this then ignore this message."; } api_type_ = type; } diff --git a/include/grpcpp/impl/server_callback_handlers.h b/include/grpcpp/impl/server_callback_handlers.h index f9839973fe9..c097ab2ace2 100644 --- a/include/grpcpp/impl/server_callback_handlers.h +++ b/include/grpcpp/impl/server_callback_handlers.h @@ -18,7 +18,7 @@ #ifndef GRPCPP_IMPL_SERVER_CALLBACK_HANDLERS_H #define GRPCPP_IMPL_SERVER_CALLBACK_HANDLERS_H -#include "absl/log/check.h" +#include "absl/log/absl_check.h" #include #include @@ -149,7 +149,7 @@ class CallbackUnaryHandler : public grpc::internal::MethodHandler { } void SendInitialMetadata() override { - CHECK(!ctx_->sent_initial_metadata_); + ABSL_CHECK(!ctx_->sent_initial_metadata_); this->Ref(); // The callback for this function should not be marked inline because it // is directly invoking a user-controlled reaction @@ -337,7 +337,7 @@ class CallbackClientStreamingHandler : public grpc::internal::MethodHandler { } void SendInitialMetadata() override { - CHECK(!ctx_->sent_initial_metadata_); + ABSL_CHECK(!ctx_->sent_initial_metadata_); this->Ref(); // The callback for this function should not be inlined because it invokes // a user-controlled reaction, but any resulting OnDone can be inlined in @@ -541,7 +541,7 @@ class CallbackServerStreamingHandler : public grpc::internal::MethodHandler { } void SendInitialMetadata() override { - CHECK(!ctx_->sent_initial_metadata_); + ABSL_CHECK(!ctx_->sent_initial_metadata_); this->Ref(); // The callback for this function should not be inlined because it invokes // a user-controlled reaction, but any resulting OnDone can be inlined in @@ -579,7 +579,7 @@ class CallbackServerStreamingHandler : public grpc::internal::MethodHandler { ctx_->sent_initial_metadata_ = true; } // TODO(vjpai): don't assert - CHECK(write_ops_.SendMessagePtr(resp, options).ok()); + ABSL_CHECK(write_ops_.SendMessagePtr(resp, options).ok()); call_.PerformOps(&write_ops_); } @@ -587,7 +587,7 @@ class CallbackServerStreamingHandler : public grpc::internal::MethodHandler { grpc::Status s) override { // This combines the write into the finish callback // TODO(vjpai): don't assert - CHECK(finish_ops_.SendMessagePtr(resp, options).ok()); + ABSL_CHECK(finish_ops_.SendMessagePtr(resp, options).ok()); Finish(std::move(s)); } @@ -753,7 +753,7 @@ class CallbackBidiHandler : public grpc::internal::MethodHandler { } void SendInitialMetadata() override { - CHECK(!ctx_->sent_initial_metadata_); + ABSL_CHECK(!ctx_->sent_initial_metadata_); this->Ref(); // The callback for this function should not be inlined because it invokes // a user-controlled reaction, but any resulting OnDone can be inlined in @@ -791,14 +791,14 @@ class CallbackBidiHandler : public grpc::internal::MethodHandler { ctx_->sent_initial_metadata_ = true; } // TODO(vjpai): don't assert - CHECK(write_ops_.SendMessagePtr(resp, options).ok()); + ABSL_CHECK(write_ops_.SendMessagePtr(resp, options).ok()); call_.PerformOps(&write_ops_); } void WriteAndFinish(const ResponseType* resp, grpc::WriteOptions options, grpc::Status s) override { // TODO(vjpai): don't assert - CHECK(finish_ops_.SendMessagePtr(resp, options).ok()); + ABSL_CHECK(finish_ops_.SendMessagePtr(resp, options).ok()); Finish(std::move(s)); } diff --git a/include/grpcpp/impl/service_type.h b/include/grpcpp/impl/service_type.h index c284026a0f6..3e40e08b297 100644 --- a/include/grpcpp/impl/service_type.h +++ b/include/grpcpp/impl/service_type.h @@ -19,7 +19,7 @@ #ifndef GRPCPP_IMPL_SERVICE_TYPE_H #define GRPCPP_IMPL_SERVICE_TYPE_H -#include "absl/log/check.h" +#include "absl/log/absl_check.h" #include #include @@ -152,7 +152,7 @@ class Service { // This does not have to be a hard error, however no one has approached us // with a use case yet. Please file an issue if you believe you have one. size_t idx = static_cast(index); - CHECK_NE(methods_[idx].get(), nullptr) + ABSL_CHECK_NE(methods_[idx].get(), nullptr) << "Cannot mark the method as 'async' because it has already been " "marked as 'generic'."; methods_[idx]->SetServerApiType(internal::RpcServiceMethod::ApiType::ASYNC); @@ -162,7 +162,7 @@ class Service { // This does not have to be a hard error, however no one has approached us // with a use case yet. Please file an issue if you believe you have one. size_t idx = static_cast(index); - CHECK_NE(methods_[idx].get(), nullptr) + ABSL_CHECK_NE(methods_[idx].get(), nullptr) << "Cannot mark the method as 'raw' because it has already " "been marked as 'generic'."; methods_[idx]->SetServerApiType(internal::RpcServiceMethod::ApiType::RAW); @@ -172,7 +172,7 @@ class Service { // This does not have to be a hard error, however no one has approached us // with a use case yet. Please file an issue if you believe you have one. size_t idx = static_cast(index); - CHECK_NE(methods_[idx]->handler(), nullptr) + ABSL_CHECK_NE(methods_[idx]->handler(), nullptr) << "Cannot mark the method as 'generic' because it has already been " "marked as 'async' or 'raw'."; methods_[idx].reset(); @@ -182,7 +182,7 @@ class Service { // This does not have to be a hard error, however no one has approached us // with a use case yet. Please file an issue if you believe you have one. size_t idx = static_cast(index); - CHECK(methods_[idx] && methods_[idx]->handler()) + ABSL_CHECK(methods_[idx] && methods_[idx]->handler()) << "Cannot mark an async or generic method Streamed"; methods_[idx]->SetHandler(streamed_method); @@ -197,7 +197,7 @@ class Service { // This does not have to be a hard error, however no one has approached us // with a use case yet. Please file an issue if you believe you have one. size_t idx = static_cast(index); - CHECK_NE(methods_[idx].get(), nullptr) + ABSL_CHECK_NE(methods_[idx].get(), nullptr) << "Cannot mark the method as 'callback' because it has already been " "marked as 'generic'."; methods_[idx]->SetHandler(handler); @@ -209,7 +209,7 @@ class Service { // This does not have to be a hard error, however no one has approached us // with a use case yet. Please file an issue if you believe you have one. size_t idx = static_cast(index); - CHECK_NE(methods_[idx].get(), nullptr) + ABSL_CHECK_NE(methods_[idx].get(), nullptr) << "Cannot mark the method as 'raw callback' because it has already " "been marked as 'generic'."; methods_[idx]->SetHandler(handler); diff --git a/include/grpcpp/impl/sync.h b/include/grpcpp/impl/sync.h index 9288459196a..132e376d7a9 100644 --- a/include/grpcpp/impl/sync.h +++ b/include/grpcpp/impl/sync.h @@ -27,7 +27,7 @@ #include -#include "absl/log/check.h" +#include "absl/log/absl_check.h" #include "absl/synchronization/mutex.h" #include @@ -106,7 +106,7 @@ class ABSL_SCOPED_LOCKABLE ReleasableMutexLock { ReleasableMutexLock& operator=(const ReleasableMutexLock&) = delete; void Release() ABSL_UNLOCK_FUNCTION() { - DCHECK(!released_); + ABSL_DCHECK(!released_); released_ = true; mu_->Unlock(); } diff --git a/include/grpcpp/server_interface.h b/include/grpcpp/server_interface.h index 129562016ac..266b85313c8 100644 --- a/include/grpcpp/server_interface.h +++ b/include/grpcpp/server_interface.h @@ -19,7 +19,7 @@ #ifndef GRPCPP_SERVER_INTERFACE_H #define GRPCPP_SERVER_INTERFACE_H -#include "absl/log/check.h" +#include "absl/log/absl_check.h" #include #include @@ -320,7 +320,7 @@ class ServerInterface : public internal::CallHook { grpc::CompletionQueue* call_cq, grpc::ServerCompletionQueue* notification_cq, void* tag, Message* message) { - CHECK(method); + ABSL_CHECK(method); new PayloadAsyncRequest(method, this, context, stream, call_cq, notification_cq, tag, message); } @@ -331,7 +331,7 @@ class ServerInterface : public internal::CallHook { grpc::CompletionQueue* call_cq, grpc::ServerCompletionQueue* notification_cq, void* tag) { - CHECK(method); + ABSL_CHECK(method); new NoPayloadAsyncRequest(method, this, context, stream, call_cq, notification_cq, tag); } diff --git a/include/grpcpp/support/async_stream.h b/include/grpcpp/support/async_stream.h index ebc7aebcf51..ca849fd348a 100644 --- a/include/grpcpp/support/async_stream.h +++ b/include/grpcpp/support/async_stream.h @@ -19,7 +19,7 @@ #ifndef GRPCPP_SUPPORT_ASYNC_STREAM_H #define GRPCPP_SUPPORT_ASYNC_STREAM_H -#include "absl/log/check.h" +#include "absl/log/absl_check.h" #include #include @@ -202,7 +202,7 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface { public: // always allocated against a call arena, no memory free required static void operator delete(void* /*ptr*/, std::size_t size) { - CHECK_EQ(size, sizeof(ClientAsyncReader)); + ABSL_CHECK_EQ(size, sizeof(ClientAsyncReader)); } // This operator should never be called as the memory should be freed as part @@ -210,10 +210,10 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface { // delete to the operator new so that some compilers will not complain (see // https://github.com/grpc/grpc/issues/11301) Note at the time of adding this // there are no tests catching the compiler warning. - static void operator delete(void*, void*) { CHECK(false); } + static void operator delete(void*, void*) { ABSL_CHECK(false); } void StartCall(void* tag) override { - CHECK(!started_); + ABSL_CHECK(!started_); started_ = true; StartCallInternal(tag); } @@ -227,8 +227,8 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface { /// calling code can access the received metadata through the /// \a ClientContext. void ReadInitialMetadata(void* tag) override { - CHECK(started_); - CHECK(!context_->initial_metadata_received_); + ABSL_CHECK(started_); + ABSL_CHECK(!context_->initial_metadata_received_); meta_ops_.set_output_tag(tag); meta_ops_.RecvInitialMetadata(context_); @@ -236,7 +236,7 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface { } void Read(R* msg, void* tag) override { - CHECK(started_); + ABSL_CHECK(started_); read_ops_.set_output_tag(tag); if (!context_->initial_metadata_received_) { read_ops_.RecvInitialMetadata(context_); @@ -251,7 +251,7 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface { /// - the \a ClientContext associated with this call is updated with /// possible initial and trailing metadata received from the server. void Finish(grpc::Status* status, void* tag) override { - CHECK(started_); + ABSL_CHECK(started_); finish_ops_.set_output_tag(tag); if (!context_->initial_metadata_received_) { finish_ops_.RecvInitialMetadata(context_); @@ -267,12 +267,12 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface { const W& request, bool start, void* tag) : context_(context), call_(call), started_(start) { // TODO(ctiller): don't assert - CHECK(init_ops_.SendMessage(request).ok()); + ABSL_CHECK(init_ops_.SendMessage(request).ok()); init_ops_.ClientSendClose(); if (start) { StartCallInternal(tag); } else { - CHECK(tag == nullptr); + ABSL_CHECK(tag == nullptr); } } @@ -350,7 +350,7 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface { public: // always allocated against a call arena, no memory free required static void operator delete(void* /*ptr*/, std::size_t size) { - CHECK_EQ(size, sizeof(ClientAsyncWriter)); + ABSL_CHECK_EQ(size, sizeof(ClientAsyncWriter)); } // This operator should never be called as the memory should be freed as part @@ -358,10 +358,10 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface { // delete to the operator new so that some compilers will not complain (see // https://github.com/grpc/grpc/issues/11301) Note at the time of adding this // there are no tests catching the compiler warning. - static void operator delete(void*, void*) { CHECK(false); } + static void operator delete(void*, void*) { ABSL_CHECK(false); } void StartCall(void* tag) override { - CHECK(!started_); + ABSL_CHECK(!started_); started_ = true; StartCallInternal(tag); } @@ -374,8 +374,8 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface { /// associated with this call is updated, and the calling code can access /// the received metadata through the \a ClientContext. void ReadInitialMetadata(void* tag) override { - CHECK(started_); - CHECK(!context_->initial_metadata_received_); + ABSL_CHECK(started_); + ABSL_CHECK(!context_->initial_metadata_received_); meta_ops_.set_output_tag(tag); meta_ops_.RecvInitialMetadata(context_); @@ -383,27 +383,27 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface { } void Write(const W& msg, void* tag) override { - CHECK(started_); + ABSL_CHECK(started_); write_ops_.set_output_tag(tag); // TODO(ctiller): don't assert - CHECK(write_ops_.SendMessage(msg).ok()); + ABSL_CHECK(write_ops_.SendMessage(msg).ok()); call_.PerformOps(&write_ops_); } void Write(const W& msg, grpc::WriteOptions options, void* tag) override { - CHECK(started_); + ABSL_CHECK(started_); write_ops_.set_output_tag(tag); if (options.is_last_message()) { options.set_buffer_hint(); write_ops_.ClientSendClose(); } // TODO(ctiller): don't assert - CHECK(write_ops_.SendMessage(msg, options).ok()); + ABSL_CHECK(write_ops_.SendMessage(msg, options).ok()); call_.PerformOps(&write_ops_); } void WritesDone(void* tag) override { - CHECK(started_); + ABSL_CHECK(started_); write_ops_.set_output_tag(tag); write_ops_.ClientSendClose(); call_.PerformOps(&write_ops_); @@ -417,7 +417,7 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface { /// - attempts to fill in the \a response parameter passed to this class's /// constructor with the server's response message. void Finish(grpc::Status* status, void* tag) override { - CHECK(started_); + ABSL_CHECK(started_); finish_ops_.set_output_tag(tag); if (!context_->initial_metadata_received_) { finish_ops_.RecvInitialMetadata(context_); @@ -437,7 +437,7 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface { if (start) { StartCallInternal(tag); } else { - CHECK(tag == nullptr); + ABSL_CHECK(tag == nullptr); } } @@ -517,7 +517,7 @@ class ClientAsyncReaderWriter final public: // always allocated against a call arena, no memory free required static void operator delete(void* /*ptr*/, std::size_t size) { - CHECK_EQ(size, sizeof(ClientAsyncReaderWriter)); + ABSL_CHECK_EQ(size, sizeof(ClientAsyncReaderWriter)); } // This operator should never be called as the memory should be freed as part @@ -525,10 +525,10 @@ class ClientAsyncReaderWriter final // delete to the operator new so that some compilers will not complain (see // https://github.com/grpc/grpc/issues/11301) Note at the time of adding this // there are no tests catching the compiler warning. - static void operator delete(void*, void*) { CHECK(false); } + static void operator delete(void*, void*) { ABSL_CHECK(false); } void StartCall(void* tag) override { - CHECK(!started_); + ABSL_CHECK(!started_); started_ = true; StartCallInternal(tag); } @@ -541,8 +541,8 @@ class ClientAsyncReaderWriter final /// is updated with it, and then the receiving initial metadata can /// be accessed through this \a ClientContext. void ReadInitialMetadata(void* tag) override { - CHECK(started_); - CHECK(!context_->initial_metadata_received_); + ABSL_CHECK(started_); + ABSL_CHECK(!context_->initial_metadata_received_); meta_ops_.set_output_tag(tag); meta_ops_.RecvInitialMetadata(context_); @@ -550,7 +550,7 @@ class ClientAsyncReaderWriter final } void Read(R* msg, void* tag) override { - CHECK(started_); + ABSL_CHECK(started_); read_ops_.set_output_tag(tag); if (!context_->initial_metadata_received_) { read_ops_.RecvInitialMetadata(context_); @@ -560,27 +560,27 @@ class ClientAsyncReaderWriter final } void Write(const W& msg, void* tag) override { - CHECK(started_); + ABSL_CHECK(started_); write_ops_.set_output_tag(tag); // TODO(ctiller): don't assert - CHECK(write_ops_.SendMessage(msg).ok()); + ABSL_CHECK(write_ops_.SendMessage(msg).ok()); call_.PerformOps(&write_ops_); } void Write(const W& msg, grpc::WriteOptions options, void* tag) override { - CHECK(started_); + ABSL_CHECK(started_); write_ops_.set_output_tag(tag); if (options.is_last_message()) { options.set_buffer_hint(); write_ops_.ClientSendClose(); } // TODO(ctiller): don't assert - CHECK(write_ops_.SendMessage(msg, options).ok()); + ABSL_CHECK(write_ops_.SendMessage(msg, options).ok()); call_.PerformOps(&write_ops_); } void WritesDone(void* tag) override { - CHECK(started_); + ABSL_CHECK(started_); write_ops_.set_output_tag(tag); write_ops_.ClientSendClose(); call_.PerformOps(&write_ops_); @@ -591,7 +591,7 @@ class ClientAsyncReaderWriter final /// - the \a ClientContext associated with this call is updated with /// possible initial and trailing metadata sent from the server. void Finish(grpc::Status* status, void* tag) override { - CHECK(started_); + ABSL_CHECK(started_); finish_ops_.set_output_tag(tag); if (!context_->initial_metadata_received_) { finish_ops_.RecvInitialMetadata(context_); @@ -608,7 +608,7 @@ class ClientAsyncReaderWriter final if (start) { StartCallInternal(tag); } else { - CHECK(tag == nullptr); + ABSL_CHECK(tag == nullptr); } } @@ -708,7 +708,7 @@ class ServerAsyncReader final : public ServerAsyncReaderInterface { /// - The initial metadata that will be sent to the client from this op will /// be taken from the \a ServerContext associated with the call. void SendInitialMetadata(void* tag) override { - CHECK(!ctx_->sent_initial_metadata_); + ABSL_CHECK(!ctx_->sent_initial_metadata_); meta_ops_.set_output_tag(tag); meta_ops_.SendInitialMetadata(&ctx_->initial_metadata_, @@ -767,7 +767,7 @@ class ServerAsyncReader final : public ServerAsyncReaderInterface { /// gRPC doesn't take ownership or a reference to \a status, so it is safe to /// to deallocate once FinishWithError returns. void FinishWithError(const grpc::Status& status, void* tag) override { - CHECK(!status.ok()); + ABSL_CHECK(!status.ok()); finish_ops_.set_output_tag(tag); if (!ctx_->sent_initial_metadata_) { finish_ops_.SendInitialMetadata(&ctx_->initial_metadata_, @@ -857,7 +857,7 @@ class ServerAsyncWriter final : public ServerAsyncWriterInterface { /// /// \param[in] tag Tag identifying this request. void SendInitialMetadata(void* tag) override { - CHECK(!ctx_->sent_initial_metadata_); + ABSL_CHECK(!ctx_->sent_initial_metadata_); meta_ops_.set_output_tag(tag); meta_ops_.SendInitialMetadata(&ctx_->initial_metadata_, @@ -873,7 +873,7 @@ class ServerAsyncWriter final : public ServerAsyncWriterInterface { write_ops_.set_output_tag(tag); EnsureInitialMetadataSent(&write_ops_); // TODO(ctiller): don't assert - CHECK(write_ops_.SendMessage(msg).ok()); + ABSL_CHECK(write_ops_.SendMessage(msg).ok()); call_.PerformOps(&write_ops_); } @@ -885,7 +885,7 @@ class ServerAsyncWriter final : public ServerAsyncWriterInterface { EnsureInitialMetadataSent(&write_ops_); // TODO(ctiller): don't assert - CHECK(write_ops_.SendMessage(msg, options).ok()); + ABSL_CHECK(write_ops_.SendMessage(msg, options).ok()); call_.PerformOps(&write_ops_); } @@ -904,7 +904,7 @@ class ServerAsyncWriter final : public ServerAsyncWriterInterface { write_ops_.set_output_tag(tag); EnsureInitialMetadataSent(&write_ops_); options.set_buffer_hint(); - CHECK(write_ops_.SendMessage(msg, options).ok()); + ABSL_CHECK(write_ops_.SendMessage(msg, options).ok()); write_ops_.ServerSendStatus(&ctx_->trailing_metadata_, status); call_.PerformOps(&write_ops_); } @@ -1023,7 +1023,7 @@ class ServerAsyncReaderWriter final /// /// \param[in] tag Tag identifying this request. void SendInitialMetadata(void* tag) override { - CHECK(!ctx_->sent_initial_metadata_); + ABSL_CHECK(!ctx_->sent_initial_metadata_); meta_ops_.set_output_tag(tag); meta_ops_.SendInitialMetadata(&ctx_->initial_metadata_, @@ -1045,7 +1045,7 @@ class ServerAsyncReaderWriter final write_ops_.set_output_tag(tag); EnsureInitialMetadataSent(&write_ops_); // TODO(ctiller): don't assert - CHECK(write_ops_.SendMessage(msg).ok()); + ABSL_CHECK(write_ops_.SendMessage(msg).ok()); call_.PerformOps(&write_ops_); } @@ -1055,7 +1055,7 @@ class ServerAsyncReaderWriter final options.set_buffer_hint(); } EnsureInitialMetadataSent(&write_ops_); - CHECK(write_ops_.SendMessage(msg, options).ok()); + ABSL_CHECK(write_ops_.SendMessage(msg, options).ok()); call_.PerformOps(&write_ops_); } @@ -1075,7 +1075,7 @@ class ServerAsyncReaderWriter final write_ops_.set_output_tag(tag); EnsureInitialMetadataSent(&write_ops_); options.set_buffer_hint(); - CHECK(write_ops_.SendMessage(msg, options).ok()); + ABSL_CHECK(write_ops_.SendMessage(msg, options).ok()); write_ops_.ServerSendStatus(&ctx_->trailing_metadata_, status); call_.PerformOps(&write_ops_); } diff --git a/include/grpcpp/support/async_unary_call.h b/include/grpcpp/support/async_unary_call.h index 787d3a56e3d..715093fa772 100644 --- a/include/grpcpp/support/async_unary_call.h +++ b/include/grpcpp/support/async_unary_call.h @@ -19,7 +19,7 @@ #ifndef GRPCPP_SUPPORT_ASYNC_UNARY_CALL_H #define GRPCPP_SUPPORT_ASYNC_UNARY_CALL_H -#include "absl/log/check.h" +#include "absl/log/absl_check.h" #include #include @@ -132,7 +132,7 @@ class ClientAsyncResponseReaderHelper { new (grpc_call_arena_alloc(call, sizeof(SingleBufType))) SingleBufType; *single_buf_ptr = single_buf; // TODO(ctiller): don't assert - CHECK(single_buf->SendMessage(request).ok()); + ABSL_CHECK(single_buf->SendMessage(request).ok()); single_buf->ClientSendClose(); // The purpose of the following functions is to type-erase the actual @@ -222,7 +222,7 @@ class ClientAsyncResponseReader final public: // always allocated against a call arena, no memory free required static void operator delete(void* /*ptr*/, std::size_t size) { - CHECK_EQ(size, sizeof(ClientAsyncResponseReader)); + ABSL_CHECK_EQ(size, sizeof(ClientAsyncResponseReader)); } // This operator should never be called as the memory should be freed as part @@ -230,10 +230,10 @@ class ClientAsyncResponseReader final // delete to the operator new so that some compilers will not complain (see // https://github.com/grpc/grpc/issues/11301) Note at the time of adding this // there are no tests catching the compiler warning. - static void operator delete(void*, void*) { CHECK(false); } + static void operator delete(void*, void*) { ABSL_CHECK(false); } void StartCall() override { - DCHECK(!started_); + ABSL_DCHECK(!started_); started_ = true; internal::ClientAsyncResponseReaderHelper::StartCall(context_, single_buf_); } @@ -245,8 +245,8 @@ class ClientAsyncResponseReader final /// - the \a ClientContext associated with this call is updated with /// possible initial and trailing metadata sent from the server. void ReadInitialMetadata(void* tag) override { - DCHECK(started_); - DCHECK(!context_->initial_metadata_received_); + ABSL_DCHECK(started_); + ABSL_DCHECK(!context_->initial_metadata_received_); read_initial_metadata_(context_, &call_, single_buf_, tag); initial_metadata_read_ = true; } @@ -257,7 +257,7 @@ class ClientAsyncResponseReader final /// - the \a ClientContext associated with this call is updated with /// possible initial and trailing metadata sent from the server. void Finish(R* msg, grpc::Status* status, void* tag) override { - DCHECK(started_); + ABSL_DCHECK(started_); finish_(context_, &call_, initial_metadata_read_, single_buf_, &finish_buf_, static_cast(msg), status, tag); } @@ -306,7 +306,7 @@ class ServerAsyncResponseWriter final /// /// \param[in] tag Tag identifying this request. void SendInitialMetadata(void* tag) override { - CHECK(!ctx_->sent_initial_metadata_); + ABSL_CHECK(!ctx_->sent_initial_metadata_); meta_buf_.set_output_tag(tag); meta_buf_.SendInitialMetadata(&ctx_->initial_metadata_, @@ -375,7 +375,7 @@ class ServerAsyncResponseWriter final /// deallocate them once the Finish operation is complete (i.e. a result /// arrives in the completion queue). void FinishWithError(const grpc::Status& status, void* tag) { - CHECK(!status.ok()); + ABSL_CHECK(!status.ok()); finish_buf_.set_output_tag(tag); if (!ctx_->sent_initial_metadata_) { finish_buf_.SendInitialMetadata(&ctx_->initial_metadata_, diff --git a/include/grpcpp/support/callback_common.h b/include/grpcpp/support/callback_common.h index 2868de0bd4d..0de9cbcf050 100644 --- a/include/grpcpp/support/callback_common.h +++ b/include/grpcpp/support/callback_common.h @@ -21,7 +21,7 @@ #include -#include "absl/log/check.h" +#include "absl/log/absl_check.h" #include #include @@ -73,7 +73,7 @@ class CallbackWithStatusTag : public grpc_completion_queue_functor { public: // always allocated against a call arena, no memory free required static void operator delete(void* /*ptr*/, std::size_t size) { - CHECK_EQ(size, sizeof(CallbackWithStatusTag)); + ABSL_CHECK_EQ(size, sizeof(CallbackWithStatusTag)); } // This operator should never be called as the memory should be freed as part @@ -81,7 +81,7 @@ class CallbackWithStatusTag : public grpc_completion_queue_functor { // delete to the operator new so that some compilers will not complain (see // https://github.com/grpc/grpc/issues/11301) Note at the time of adding this // there are no tests catching the compiler warning. - static void operator delete(void*, void*) { CHECK(false); } + static void operator delete(void*, void*) { ABSL_CHECK(false); } CallbackWithStatusTag(grpc_call* call, std::function f, CompletionQueueTag* ops) @@ -120,7 +120,7 @@ class CallbackWithStatusTag : public grpc_completion_queue_functor { // The tag was swallowed return; } - CHECK(ignored == ops_); + ABSL_CHECK(ignored == ops_); // Last use of func_ or status_, so ok to move them out auto func = std::move(func_); @@ -139,7 +139,7 @@ class CallbackWithSuccessTag : public grpc_completion_queue_functor { public: // always allocated against a call arena, no memory free required static void operator delete(void* /*ptr*/, std::size_t size) { - CHECK_EQ(size, sizeof(CallbackWithSuccessTag)); + ABSL_CHECK_EQ(size, sizeof(CallbackWithSuccessTag)); } // This operator should never be called as the memory should be freed as part @@ -147,7 +147,7 @@ class CallbackWithSuccessTag : public grpc_completion_queue_functor { // delete to the operator new so that some compilers will not complain (see // https://github.com/grpc/grpc/issues/11301) Note at the time of adding this // there are no tests catching the compiler warning. - static void operator delete(void*, void*) { CHECK(false); } + static void operator delete(void*, void*) { ABSL_CHECK(false); } CallbackWithSuccessTag() : call_(nullptr) {} @@ -164,7 +164,7 @@ class CallbackWithSuccessTag : public grpc_completion_queue_functor { // callbacks. void Set(grpc_call* call, std::function f, CompletionQueueTag* ops, bool can_inline) { - CHECK_EQ(call_, nullptr); + ABSL_CHECK_EQ(call_, nullptr); grpc_call_ref(call); call_ = call; func_ = std::move(f); @@ -210,7 +210,7 @@ class CallbackWithSuccessTag : public grpc_completion_queue_functor { #endif bool do_callback = ops_->FinalizeResult(&ignored, &ok); #ifndef NDEBUG - DCHECK(ignored == ops); + ABSL_DCHECK(ignored == ops); #endif if (do_callback) { diff --git a/include/grpcpp/support/client_callback.h b/include/grpcpp/support/client_callback.h index 49e52bb37aa..f306b26b96b 100644 --- a/include/grpcpp/support/client_callback.h +++ b/include/grpcpp/support/client_callback.h @@ -22,7 +22,7 @@ #include #include -#include "absl/log/check.h" +#include "absl/log/absl_check.h" #include #include @@ -72,7 +72,7 @@ class CallbackUnaryCallImpl { const InputMessage* request, OutputMessage* result, std::function on_completion) { grpc::CompletionQueue* cq = channel->CallbackCQ(); - CHECK_NE(cq, nullptr); + ABSL_CHECK_NE(cq, nullptr); grpc::internal::Call call(channel->CreateCall(method, context, cq)); using FullCallOpSet = grpc::internal::CallOpSet< @@ -306,7 +306,7 @@ class ClientBidiReactor : public internal::ClientReactor { /// The argument to AddMultipleHolds must be positive. void AddHold() { AddMultipleHolds(1); } void AddMultipleHolds(int holds) { - DCHECK_GT(holds, 0); + ABSL_DCHECK_GT(holds, 0); stream_->AddHold(holds); } void RemoveHold() { stream_->RemoveHold(); } @@ -370,7 +370,7 @@ class ClientReadReactor : public internal::ClientReactor { void AddHold() { AddMultipleHolds(1); } void AddMultipleHolds(int holds) { - DCHECK_GT(holds, 0); + ABSL_DCHECK_GT(holds, 0); reader_->AddHold(holds); } void RemoveHold() { reader_->RemoveHold(); } @@ -402,7 +402,7 @@ class ClientWriteReactor : public internal::ClientReactor { void AddHold() { AddMultipleHolds(1); } void AddMultipleHolds(int holds) { - DCHECK_GT(holds, 0); + ABSL_DCHECK_GT(holds, 0); writer_->AddHold(holds); } void RemoveHold() { writer_->RemoveHold(); } @@ -463,7 +463,7 @@ class ClientCallbackReaderWriterImpl public: // always allocated against a call arena, no memory free required static void operator delete(void* /*ptr*/, std::size_t size) { - CHECK_EQ(size, sizeof(ClientCallbackReaderWriterImpl)); + ABSL_CHECK_EQ(size, sizeof(ClientCallbackReaderWriterImpl)); } // This operator should never be called as the memory should be freed as part @@ -471,7 +471,7 @@ class ClientCallbackReaderWriterImpl // delete to the operator new so that some compilers will not complain (see // https://github.com/grpc/grpc/issues/11301) Note at the time of adding this // there are no tests catching the compiler warning. - static void operator delete(void*, void*) { CHECK(false); } + static void operator delete(void*, void*) { ABSL_CHECK(false); } void StartCall() ABSL_LOCKS_EXCLUDED(start_mu_) override { // This call initiates two batches, plus any backlog, each with a callback @@ -529,7 +529,7 @@ class ClientCallbackReaderWriterImpl write_ops_.ClientSendClose(); } // TODO(vjpai): don't assert - CHECK(write_ops_.SendMessagePtr(msg, options).ok()); + ABSL_CHECK(write_ops_.SendMessagePtr(msg, options).ok()); callbacks_outstanding_.fetch_add(1, std::memory_order_relaxed); if (GPR_UNLIKELY(corked_write_needed_)) { write_ops_.SendInitialMetadata(&context_->send_initial_metadata_, @@ -721,7 +721,7 @@ class ClientCallbackReaderImpl : public ClientCallbackReader { public: // always allocated against a call arena, no memory free required static void operator delete(void* /*ptr*/, std::size_t size) { - CHECK_EQ(size, sizeof(ClientCallbackReaderImpl)); + ABSL_CHECK_EQ(size, sizeof(ClientCallbackReaderImpl)); } // This operator should never be called as the memory should be freed as part @@ -729,7 +729,7 @@ class ClientCallbackReaderImpl : public ClientCallbackReader { // delete to the operator new so that some compilers will not complain (see // https://github.com/grpc/grpc/issues/11301) Note at the time of adding this // there are no tests catching the compiler warning. - static void operator delete(void*, void*) { CHECK(false); } + static void operator delete(void*, void*) { ABSL_CHECK(false); } void StartCall() override { // This call initiates two batches, plus any backlog, each with a callback @@ -806,7 +806,7 @@ class ClientCallbackReaderImpl : public ClientCallbackReader { : context_(context), call_(call), reactor_(reactor) { this->BindReactor(reactor); // TODO(vjpai): don't assert - CHECK(start_ops_.SendMessagePtr(request).ok()); + ABSL_CHECK(start_ops_.SendMessagePtr(request).ok()); start_ops_.ClientSendClose(); } @@ -882,7 +882,7 @@ class ClientCallbackWriterImpl : public ClientCallbackWriter { public: // always allocated against a call arena, no memory free required static void operator delete(void* /*ptr*/, std::size_t size) { - CHECK_EQ(size, sizeof(ClientCallbackWriterImpl)); + ABSL_CHECK_EQ(size, sizeof(ClientCallbackWriterImpl)); } // This operator should never be called as the memory should be freed as part @@ -890,7 +890,7 @@ class ClientCallbackWriterImpl : public ClientCallbackWriter { // delete to the operator new so that some compilers will not complain (see // https://github.com/grpc/grpc/issues/11301) Note at the time of adding this // there are no tests catching the compiler warning. - static void operator delete(void*, void*) { CHECK(false); } + static void operator delete(void*, void*) { ABSL_CHECK(false); } void StartCall() ABSL_LOCKS_EXCLUDED(start_mu_) override { // This call initiates two batches, plus any backlog, each with a callback @@ -931,7 +931,7 @@ class ClientCallbackWriterImpl : public ClientCallbackWriter { write_ops_.ClientSendClose(); } // TODO(vjpai): don't assert - CHECK(write_ops_.SendMessagePtr(msg, options).ok()); + ABSL_CHECK(write_ops_.SendMessagePtr(msg, options).ok()); callbacks_outstanding_.fetch_add(1, std::memory_order_relaxed); if (GPR_UNLIKELY(corked_write_needed_)) { @@ -1112,7 +1112,7 @@ class ClientCallbackUnaryImpl final : public ClientCallbackUnary { public: // always allocated against a call arena, no memory free required static void operator delete(void* /*ptr*/, std::size_t size) { - CHECK_EQ(size, sizeof(ClientCallbackUnaryImpl)); + ABSL_CHECK_EQ(size, sizeof(ClientCallbackUnaryImpl)); } // This operator should never be called as the memory should be freed as part @@ -1120,7 +1120,7 @@ class ClientCallbackUnaryImpl final : public ClientCallbackUnary { // delete to the operator new so that some compilers will not complain (see // https://github.com/grpc/grpc/issues/11301) Note at the time of adding this // there are no tests catching the compiler warning. - static void operator delete(void*, void*) { CHECK(false); } + static void operator delete(void*, void*) { ABSL_CHECK(false); } void StartCall() override { // This call initiates two batches, each with a callback @@ -1159,7 +1159,7 @@ class ClientCallbackUnaryImpl final : public ClientCallbackUnary { : context_(context), call_(call), reactor_(reactor) { this->BindReactor(reactor); // TODO(vjpai): don't assert - CHECK(start_ops_.SendMessagePtr(request).ok()); + ABSL_CHECK(start_ops_.SendMessagePtr(request).ok()); start_ops_.ClientSendClose(); finish_ops_.RecvMessage(response); finish_ops_.AllowNoMessage(); diff --git a/include/grpcpp/support/client_interceptor.h b/include/grpcpp/support/client_interceptor.h index 3bcb2f16256..67aee26ec3b 100644 --- a/include/grpcpp/support/client_interceptor.h +++ b/include/grpcpp/support/client_interceptor.h @@ -22,7 +22,7 @@ #include #include -#include "absl/log/check.h" +#include "absl/log/absl_check.h" #include #include @@ -141,7 +141,7 @@ class ClientRpcInfo { // Runs interceptor at pos \a pos. void RunInterceptor( experimental::InterceptorBatchMethods* interceptor_methods, size_t pos) { - CHECK_LT(pos, interceptors_.size()); + ABSL_CHECK_LT(pos, interceptors_.size()); interceptors_[pos]->Intercept(interceptor_methods); } diff --git a/include/grpcpp/support/method_handler.h b/include/grpcpp/support/method_handler.h index 51821c6da38..6a2d2b22d2d 100644 --- a/include/grpcpp/support/method_handler.h +++ b/include/grpcpp/support/method_handler.h @@ -19,7 +19,7 @@ #ifndef GRPCPP_SUPPORT_METHOD_HANDLER_H #define GRPCPP_SUPPORT_METHOD_HANDLER_H -#include "absl/log/check.h" +#include "absl/log/absl_check.h" #include #include @@ -59,7 +59,7 @@ template template void UnaryRunHandlerHelper(const MethodHandler::HandlerParameter& param, ResponseType* rsp, grpc::Status& status) { - CHECK(!param.server_context->sent_initial_metadata_); + ABSL_CHECK(!param.server_context->sent_initial_metadata_); grpc::internal::CallOpSet diff --git a/include/grpcpp/support/proto_buffer_reader.h b/include/grpcpp/support/proto_buffer_reader.h index f5431d462e4..e5ede7a09a2 100644 --- a/include/grpcpp/support/proto_buffer_reader.h +++ b/include/grpcpp/support/proto_buffer_reader.h @@ -21,7 +21,7 @@ #include -#include "absl/log/check.h" +#include "absl/log/absl_check.h" #include "absl/strings/cord.h" #include @@ -76,7 +76,7 @@ class ProtoBufferReader : public grpc::protobuf::io::ZeroCopyInputStream { if (backup_count_ > 0) { *data = GRPC_SLICE_START_PTR(*slice_) + GRPC_SLICE_LENGTH(*slice_) - backup_count_; - CHECK_LE(backup_count_, INT_MAX); + ABSL_CHECK_LE(backup_count_, INT_MAX); *size = static_cast(backup_count_); backup_count_ = 0; return true; @@ -87,7 +87,7 @@ class ProtoBufferReader : public grpc::protobuf::io::ZeroCopyInputStream { } *data = GRPC_SLICE_START_PTR(*slice_); // On win x64, int is only 32bit - CHECK_LE(GRPC_SLICE_LENGTH(*slice_), static_cast(INT_MAX)); + ABSL_CHECK_LE(GRPC_SLICE_LENGTH(*slice_), static_cast(INT_MAX)); byte_count_ += * size = static_cast(GRPC_SLICE_LENGTH(*slice_)); return true; } @@ -99,7 +99,7 @@ class ProtoBufferReader : public grpc::protobuf::io::ZeroCopyInputStream { /// bytes that have already been returned by the last call of Next. /// So do the backup and have that ready for a later Next. void BackUp(int count) override { - CHECK_LE(count, static_cast(GRPC_SLICE_LENGTH(*slice_))); + ABSL_CHECK_LE(count, static_cast(GRPC_SLICE_LENGTH(*slice_))); backup_count_ = count; } @@ -175,7 +175,7 @@ class ProtoBufferReader : public grpc::protobuf::io::ZeroCopyInputStream { return true; } } - CHECK_EQ(count, 0); + ABSL_CHECK_EQ(count, 0); return true; } #endif // GRPC_PROTOBUF_CORD_SUPPORT_ENABLED diff --git a/include/grpcpp/support/proto_buffer_writer.h b/include/grpcpp/support/proto_buffer_writer.h index 351b2b826d9..e695f14ae11 100644 --- a/include/grpcpp/support/proto_buffer_writer.h +++ b/include/grpcpp/support/proto_buffer_writer.h @@ -21,7 +21,7 @@ #include -#include "absl/log/check.h" +#include "absl/log/absl_check.h" #include "absl/strings/cord.h" #include @@ -65,7 +65,7 @@ class ProtoBufferWriter : public grpc::protobuf::io::ZeroCopyOutputStream { total_size_(total_size), byte_count_(0), have_backup_(false) { - CHECK(!byte_buffer->Valid()); + ABSL_CHECK(!byte_buffer->Valid()); /// Create an empty raw byte buffer and look at its underlying slice buffer grpc_byte_buffer* bp = grpc_raw_byte_buffer_create(nullptr, 0); byte_buffer->set_buffer(bp); @@ -82,7 +82,7 @@ class ProtoBufferWriter : public grpc::protobuf::io::ZeroCopyOutputStream { /// safe for the caller to write from data[0, size - 1]. bool Next(void** data, int* size) override { // Protobuf should not ask for more memory than total_size_. - CHECK_LT(byte_count_, total_size_); + ABSL_CHECK_LT(byte_count_, total_size_); // 1. Use the remaining backup slice if we have one // 2. Otherwise allocate a slice, up to the remaining length needed // or our maximum allocation size @@ -107,7 +107,7 @@ class ProtoBufferWriter : public grpc::protobuf::io::ZeroCopyOutputStream { } *data = GRPC_SLICE_START_PTR(slice_); // On win x64, int is only 32bit - CHECK(GRPC_SLICE_LENGTH(slice_) <= static_cast(INT_MAX)); + ABSL_CHECK(GRPC_SLICE_LENGTH(slice_) <= static_cast(INT_MAX)); byte_count_ += * size = static_cast(GRPC_SLICE_LENGTH(slice_)); // Using grpc_slice_buffer_add could modify slice_ and merge it with the // previous slice. Therefore, use grpc_slice_buffer_add_indexed method to @@ -132,7 +132,7 @@ class ProtoBufferWriter : public grpc::protobuf::io::ZeroCopyOutputStream { /// 2. Split it into the needed (if any) and unneeded part /// 3. Add the needed part back to the slice buffer /// 4. Mark that we still have the remaining part (for later use/unref) - CHECK_LE(count, static_cast(GRPC_SLICE_LENGTH(slice_))); + ABSL_CHECK_LE(count, static_cast(GRPC_SLICE_LENGTH(slice_))); grpc_slice_buffer_pop(slice_buffer_); if (static_cast(count) == GRPC_SLICE_LENGTH(slice_)) { backup_slice_ = slice_; diff --git a/include/grpcpp/support/server_interceptor.h b/include/grpcpp/support/server_interceptor.h index c30d0aee495..1147235b6b1 100644 --- a/include/grpcpp/support/server_interceptor.h +++ b/include/grpcpp/support/server_interceptor.h @@ -22,7 +22,7 @@ #include #include -#include "absl/log/check.h" +#include "absl/log/absl_check.h" #include #include @@ -102,7 +102,7 @@ class ServerRpcInfo { // Runs interceptor at pos \a pos. void RunInterceptor( experimental::InterceptorBatchMethods* interceptor_methods, size_t pos) { - CHECK_LT(pos, interceptors_.size()); + ABSL_CHECK_LT(pos, interceptors_.size()); interceptors_[pos]->Intercept(interceptor_methods); } diff --git a/include/grpcpp/support/sync_stream.h b/include/grpcpp/support/sync_stream.h index ab6ced7343b..9b16b070130 100644 --- a/include/grpcpp/support/sync_stream.h +++ b/include/grpcpp/support/sync_stream.h @@ -19,7 +19,7 @@ #ifndef GRPCPP_SUPPORT_SYNC_STREAM_H #define GRPCPP_SUPPORT_SYNC_STREAM_H -#include "absl/log/check.h" +#include "absl/log/absl_check.h" #include #include @@ -186,7 +186,7 @@ class ClientReader final : public ClientReaderInterface { /// the server will be accessible through the \a ClientContext used to /// construct this object. void WaitForInitialMetadata() override { - CHECK(!context_->initial_metadata_received_); + ABSL_CHECK(!context_->initial_metadata_received_); grpc::internal::CallOpSet ops; ops.RecvInitialMetadata(context_); @@ -232,7 +232,7 @@ class ClientReader final : public ClientReaderInterface { grpc::Status status; ops.ClientRecvStatus(context_, &status); call_.PerformOps(&ops); - CHECK(cq_.Pluck(&ops)); + ABSL_CHECK(cq_.Pluck(&ops)); return status; } @@ -261,7 +261,7 @@ class ClientReader final : public ClientReaderInterface { ops.SendInitialMetadata(&context->send_initial_metadata_, context->initial_metadata_flags()); // TODO(ctiller): don't assert - CHECK(ops.SendMessagePtr(&request).ok()); + ABSL_CHECK(ops.SendMessagePtr(&request).ok()); ops.ClientSendClose(); call_.PerformOps(&ops); cq_.Pluck(&ops); @@ -308,7 +308,7 @@ class ClientWriter : public ClientWriterInterface { /// Once complete, the initial metadata read from the server will be /// accessible through the \a ClientContext used to construct this object. void WaitForInitialMetadata() { - CHECK(!context_->initial_metadata_received_); + ABSL_CHECK(!context_->initial_metadata_received_); grpc::internal::CallOpSet ops; ops.RecvInitialMetadata(context_); @@ -366,7 +366,7 @@ class ClientWriter : public ClientWriterInterface { } finish_ops_.ClientRecvStatus(context_, &status); call_.PerformOps(&finish_ops_); - CHECK(cq_.Pluck(&finish_ops_)); + ABSL_CHECK(cq_.Pluck(&finish_ops_)); return status; } @@ -457,7 +457,7 @@ class ClientReaderWriter final : public ClientReaderWriterInterface { /// Once complete, the initial metadata read from the server will be /// accessible through the \a ClientContext used to construct this object. void WaitForInitialMetadata() override { - CHECK(!context_->initial_metadata_received_); + ABSL_CHECK(!context_->initial_metadata_received_); grpc::internal::CallOpSet ops; ops.RecvInitialMetadata(context_); @@ -538,7 +538,7 @@ class ClientReaderWriter final : public ClientReaderWriterInterface { grpc::Status status; ops.ClientRecvStatus(context_, &status); call_.PerformOps(&ops); - CHECK(cq_.Pluck(&ops)); + ABSL_CHECK(cq_.Pluck(&ops)); return status; } @@ -585,7 +585,7 @@ class ServerReader final : public ServerReaderInterface { /// for semantics. Note that initial metadata will be affected by the /// \a ServerContext associated with this call. void SendInitialMetadata() override { - CHECK(!ctx_->sent_initial_metadata_); + ABSL_CHECK(!ctx_->sent_initial_metadata_); grpc::internal::CallOpSet ops; ops.SendInitialMetadata(&ctx_->initial_metadata_, @@ -642,7 +642,7 @@ class ServerWriter final : public ServerWriterInterface { /// Note that initial metadata will be affected by the /// \a ServerContext associated with this call. void SendInitialMetadata() override { - CHECK(!ctx_->sent_initial_metadata_); + ABSL_CHECK(!ctx_->sent_initial_metadata_); grpc::internal::CallOpSet ops; ops.SendInitialMetadata(&ctx_->initial_metadata_, @@ -715,7 +715,7 @@ class ServerReaderWriterBody final { : call_(call), ctx_(ctx) {} void SendInitialMetadata() { - CHECK(!ctx_->sent_initial_metadata_); + ABSL_CHECK(!ctx_->sent_initial_metadata_); grpc::internal::CallOpSet ops; ops.SendInitialMetadata(&ctx_->initial_metadata_,