aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Muxi Yan <mxyan@google.com>2018-05-31 16:32:48 -0700
committerGravatar Muxi Yan <mxyan@google.com>2018-05-31 17:41:09 -0700
commitd810bdc00f4d5b21328d1a8c2b6d5abe5b3e7c7d (patch)
tree96dcbd9b85611eb721369765776d64c43525638b
parenta8709ae0497c7d5a0e87931aa5d1b5bb63a6172b (diff)
Address comments on build systems
-rw-r--r--src/core/lib/iomgr/cfstream_handle.cc6
-rw-r--r--src/core/lib/iomgr/cfstream_handle.h2
-rw-r--r--src/core/lib/iomgr/error_apple.cc4
-rw-r--r--src/core/lib/iomgr/polling_entity.cc5
-rw-r--r--src/core/lib/iomgr/resolve_address.h6
-rw-r--r--src/core/lib/transport/transport.cc8
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 51c8474e42..30f4e65632 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 1071120200..9e07dfb60a 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 d7af8c377f..bc375bae88 100644
--- a/src/core/lib/iomgr/error_apple.cc
+++ b/src/core/lib/iomgr/error_apple.cc
@@ -18,7 +18,7 @@
#include <grpc/support/port_platform.h>
-#ifdef GRPC_CFSTREAM
+#ifdef GPR_APPLE
#include <CoreFoundation/CoreFoundation.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);
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 1ca3d9f31f..dea07cae53 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 8638935060..6afe94a7a9 100644
--- a/src/core/lib/iomgr/resolve_address.h
+++ b/src/core/lib/iomgr/resolve_address.h
@@ -33,11 +33,7 @@
#include <ws2tcpip.h>
#endif
-#ifdef GRPC_POSIX_SOCKET
-#include <sys/socket.h>
-#endif
-
-#ifdef GRPC_CFSTREAM
+#if defined(GRPC_POSIX_SOCKET) || defined(GRPC_CFSTREAM)
#include <sys/socket.h>
#endif
diff --git a/src/core/lib/transport/transport.cc b/src/core/lib/transport/transport.cc
index c9f5def40d..039d603394 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.
}
}