From: Yedidya Feldblum Date: Thu, 9 Nov 2017 02:55:00 +0000 (-0800) Subject: In SemiFuture members, fix DCHECK of pointer types X-Git-Tag: v2017.11.13.00~15 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=commitdiff_plain;h=3066914f085865bc104192f3431315be6ea9012a In SemiFuture members, fix DCHECK of pointer types Summary: [Folly] In `SemiFuture` members, fix `DCHECK` of pointer types. Use `nullptr !=` to avoid ` error: ISO C++ forbids comparison between pointer and integer`. Closes #708. Reviewed By: Orvid Differential Revision: D6277832 fbshipit-source-id: 8f65065d5347c6ac407b99cb780c38935e901362 --- diff --git a/folly/futures/Future-inl.h b/folly/futures/Future-inl.h index dea9e863..5818244c 100644 --- a/folly/futures/Future-inl.h +++ b/folly/futures/Future-inl.h @@ -473,7 +473,7 @@ void SemiFuture::boost_() { if (auto e = this->getExecutor()) { // We know in a SemiFuture that if we have an executor it should be // DeferredExecutor. Verify this in debug mode. - DCHECK(dynamic_cast(e)); + DCHECK(nullptr != dynamic_cast(e)); auto ka = static_cast(e)->getKeepAliveToken(); static_cast(e)->boost(); @@ -493,7 +493,7 @@ inline Future SemiFuture::via(Executor* executor, int8_t priority) && { if (oldExecutor && executor && (executor != oldExecutor)) { // We know in a SemiFuture that if we have an executor it should be // DeferredExecutor. Verify this in debug mode. - DCHECK(dynamic_cast(this->getExecutor())); + DCHECK(nullptr != dynamic_cast(this->getExecutor())); if (static_cast(oldExecutor)) { executor->add([oldExecutorKA = oldExecutor->getKeepAliveToken()]() { static_cast(oldExecutorKA.get())->boost(); @@ -520,7 +520,7 @@ SemiFuture::defer(F&& func) && { // We know in a SemiFuture that if we have an executor it should be // DeferredExecutor (either it was that way before, or we just created it). // Verify this in debug mode. - DCHECK(dynamic_cast(e)); + DCHECK(nullptr != dynamic_cast(e)); // Convert to a folly::future with a deferred executor // Will be low-cost if this is not a new executor as via optimises for that // case