From d810bdc00f4d5b21328d1a8c2b6d5abe5b3e7c7d Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Thu, 31 May 2018 16:32:48 -0700 Subject: [PATCH] Address comments on build systems --- src/core/lib/iomgr/cfstream_handle.cc | 6 ++---- src/core/lib/iomgr/cfstream_handle.h | 2 +- src/core/lib/iomgr/error_apple.cc | 4 ++-- src/core/lib/iomgr/polling_entity.cc | 5 ----- src/core/lib/iomgr/resolve_address.h | 6 +----- src/core/lib/transport/transport.cc | 8 ++------ 6 files changed, 8 insertions(+), 23 deletions(-) diff --git a/src/core/lib/iomgr/cfstream_handle.cc b/src/core/lib/iomgr/cfstream_handle.cc index 51c8474e42e..30f4e656324 100644 --- a/src/core/lib/iomgr/cfstream_handle.cc +++ b/src/core/lib/iomgr/cfstream_handle.cc @@ -74,8 +74,7 @@ void CFStreamHandle::ReadCallback(CFReadStreamRef stream, handle->read_event_.SetReady(); break; default: - // Impossible - abort(); + GPR_UNREACHABLE_CODE(return ); } CFSTREAM_HANDLE_UNREF(handle, "read callback"); }); @@ -105,8 +104,7 @@ void CFStreamHandle::WriteCallback(CFWriteStreamRef stream, handle->write_event_.SetReady(); break; default: - // Impossible - abort(); + GPR_UNREACHABLE_CODE(return ); } CFSTREAM_HANDLE_UNREF(handle, "write callback"); }); diff --git a/src/core/lib/iomgr/cfstream_handle.h b/src/core/lib/iomgr/cfstream_handle.h index 10711202005..9e07dfb60a9 100644 --- a/src/core/lib/iomgr/cfstream_handle.h +++ b/src/core/lib/iomgr/cfstream_handle.h @@ -67,7 +67,7 @@ class CFStreamHandle final { gpr_refcount refcount_; }; -#ifndef NDEBUG +#ifdef DEBUG #define CFSTREAM_HANDLE_REF(handle, reason) \ (handle)->Ref(__FILE__, __LINE__, (reason)) #define CFSTREAM_HANDLE_UNREF(handle, reason) \ diff --git a/src/core/lib/iomgr/error_apple.cc b/src/core/lib/iomgr/error_apple.cc index d7af8c377f6..bc375bae88f 100644 --- a/src/core/lib/iomgr/error_apple.cc +++ b/src/core/lib/iomgr/error_apple.cc @@ -18,7 +18,7 @@ #include -#ifdef GRPC_CFSTREAM +#ifdef GPR_APPLE #include #include @@ -49,4 +49,4 @@ grpc_error* grpc_error_create_from_cferror(const char* file, int line, gpr_free(error_msg); return return_error; } -#endif /* GRPC_CFSTREAM */ +#endif /* GPR_APPLE */ diff --git a/src/core/lib/iomgr/polling_entity.cc b/src/core/lib/iomgr/polling_entity.cc index 1ca3d9f31fd..dea07cae537 100644 --- a/src/core/lib/iomgr/polling_entity.cc +++ b/src/core/lib/iomgr/polling_entity.cc @@ -61,16 +61,11 @@ bool grpc_polling_entity_is_empty(const grpc_polling_entity* pollent) { void grpc_polling_entity_add_to_pollset_set(grpc_polling_entity* pollent, grpc_pollset_set* pss_dst) { if (pollent->tag == GRPC_POLLS_POLLSET) { -#ifdef GRPC_CFSTREAM // CFStream does not use file destriptors. When CFStream is used, the fd // pollset is possible to be null. if (pollent->pollent.pollset != nullptr) { grpc_pollset_set_add_pollset(pss_dst, pollent->pollent.pollset); } -#else - GPR_ASSERT(pollent->pollent.pollset != nullptr); - grpc_pollset_set_add_pollset(pss_dst, pollent->pollent.pollset); -#endif } else if (pollent->tag == GRPC_POLLS_POLLSET_SET) { GPR_ASSERT(pollent->pollent.pollset_set != nullptr); grpc_pollset_set_add_pollset_set(pss_dst, pollent->pollent.pollset_set); diff --git a/src/core/lib/iomgr/resolve_address.h b/src/core/lib/iomgr/resolve_address.h index 8638935060f..6afe94a7a92 100644 --- a/src/core/lib/iomgr/resolve_address.h +++ b/src/core/lib/iomgr/resolve_address.h @@ -33,11 +33,7 @@ #include #endif -#ifdef GRPC_POSIX_SOCKET -#include -#endif - -#ifdef GRPC_CFSTREAM +#if defined(GRPC_POSIX_SOCKET) || defined(GRPC_CFSTREAM) #include #endif diff --git a/src/core/lib/transport/transport.cc b/src/core/lib/transport/transport.cc index c9f5def40dc..039d603394f 100644 --- a/src/core/lib/transport/transport.cc +++ b/src/core/lib/transport/transport.cc @@ -184,12 +184,8 @@ void grpc_transport_set_pops(grpc_transport* transport, grpc_stream* stream, nullptr) { transport->vtable->set_pollset_set(transport, stream, pollset_set); } else { -#ifdef GRPC_CFSTREAM - // No-op for empty pollset. CFStream does not use file destriptors. When - // CFStream is used, the fd pollset is possible to be null. -#else - abort(); -#endif + // No-op for empty pollset. Empty pollset is possible when using + // non-fd-based event engines such as CFStream. } }