Address comments on build systems

pull/15069/head
Muxi Yan 7 years ago
parent a8709ae049
commit d810bdc00f
  1. 6
      src/core/lib/iomgr/cfstream_handle.cc
  2. 2
      src/core/lib/iomgr/cfstream_handle.h
  3. 4
      src/core/lib/iomgr/error_apple.cc
  4. 5
      src/core/lib/iomgr/polling_entity.cc
  5. 6
      src/core/lib/iomgr/resolve_address.h
  6. 8
      src/core/lib/transport/transport.cc

@ -74,8 +74,7 @@ void CFStreamHandle::ReadCallback(CFReadStreamRef stream,
handle->read_event_.SetReady(); handle->read_event_.SetReady();
break; break;
default: default:
// Impossible GPR_UNREACHABLE_CODE(return );
abort();
} }
CFSTREAM_HANDLE_UNREF(handle, "read callback"); CFSTREAM_HANDLE_UNREF(handle, "read callback");
}); });
@ -105,8 +104,7 @@ void CFStreamHandle::WriteCallback(CFWriteStreamRef stream,
handle->write_event_.SetReady(); handle->write_event_.SetReady();
break; break;
default: default:
// Impossible GPR_UNREACHABLE_CODE(return );
abort();
} }
CFSTREAM_HANDLE_UNREF(handle, "write callback"); CFSTREAM_HANDLE_UNREF(handle, "write callback");
}); });

@ -67,7 +67,7 @@ class CFStreamHandle final {
gpr_refcount refcount_; gpr_refcount refcount_;
}; };
#ifndef NDEBUG #ifdef DEBUG
#define CFSTREAM_HANDLE_REF(handle, reason) \ #define CFSTREAM_HANDLE_REF(handle, reason) \
(handle)->Ref(__FILE__, __LINE__, (reason)) (handle)->Ref(__FILE__, __LINE__, (reason))
#define CFSTREAM_HANDLE_UNREF(handle, reason) \ #define CFSTREAM_HANDLE_UNREF(handle, reason) \

@ -18,7 +18,7 @@
#include <grpc/support/port_platform.h> #include <grpc/support/port_platform.h>
#ifdef GRPC_CFSTREAM #ifdef GPR_APPLE
#include <CoreFoundation/CoreFoundation.h> #include <CoreFoundation/CoreFoundation.h>
#include <grpc/support/alloc.h> #include <grpc/support/alloc.h>
@ -49,4 +49,4 @@ grpc_error* grpc_error_create_from_cferror(const char* file, int line,
gpr_free(error_msg); gpr_free(error_msg);
return return_error; return return_error;
} }
#endif /* GRPC_CFSTREAM */ #endif /* GPR_APPLE */

@ -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, void grpc_polling_entity_add_to_pollset_set(grpc_polling_entity* pollent,
grpc_pollset_set* pss_dst) { grpc_pollset_set* pss_dst) {
if (pollent->tag == GRPC_POLLS_POLLSET) { if (pollent->tag == GRPC_POLLS_POLLSET) {
#ifdef GRPC_CFSTREAM
// CFStream does not use file destriptors. When CFStream is used, the fd // CFStream does not use file destriptors. When CFStream is used, the fd
// pollset is possible to be null. // pollset is possible to be null.
if (pollent->pollent.pollset != nullptr) { if (pollent->pollent.pollset != nullptr) {
grpc_pollset_set_add_pollset(pss_dst, pollent->pollent.pollset); 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) { } else if (pollent->tag == GRPC_POLLS_POLLSET_SET) {
GPR_ASSERT(pollent->pollent.pollset_set != nullptr); GPR_ASSERT(pollent->pollent.pollset_set != nullptr);
grpc_pollset_set_add_pollset_set(pss_dst, pollent->pollent.pollset_set); grpc_pollset_set_add_pollset_set(pss_dst, pollent->pollent.pollset_set);

@ -33,11 +33,7 @@
#include <ws2tcpip.h> #include <ws2tcpip.h>
#endif #endif
#ifdef GRPC_POSIX_SOCKET #if defined(GRPC_POSIX_SOCKET) || defined(GRPC_CFSTREAM)
#include <sys/socket.h>
#endif
#ifdef GRPC_CFSTREAM
#include <sys/socket.h> #include <sys/socket.h>
#endif #endif

@ -184,12 +184,8 @@ void grpc_transport_set_pops(grpc_transport* transport, grpc_stream* stream,
nullptr) { nullptr) {
transport->vtable->set_pollset_set(transport, stream, pollset_set); transport->vtable->set_pollset_set(transport, stream, pollset_set);
} else { } else {
#ifdef GRPC_CFSTREAM // No-op for empty pollset. Empty pollset is possible when using
// No-op for empty pollset. CFStream does not use file destriptors. When // non-fd-based event engines such as CFStream.
// CFStream is used, the fd pollset is possible to be null.
#else
abort();
#endif
} }
} }

Loading…
Cancel
Save