From: Pádraig Brady Date: Fri, 10 Nov 2017 03:26:16 +0000 (-0800) Subject: folly: avoid compile warning/failure due to lvalue-to-rvalue conversion X-Git-Tag: v2017.11.13.00~6 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=commitdiff_plain;h=18de341f84035f76395347f77a8cc71d0461ab37;hp=b529367b595dd4da7e70569cbea36d30ace4fa39 folly: avoid compile warning/failure due to lvalue-to-rvalue conversion Summary: With gcc 7.2 we get the warning: folly/io/async/DelayedDestructionBase.h:252:20: error: parameter ‘right’ set but not used [-Werror=unused-but-set-parameter] std::nullptr_t right) { ^~~~~ I presume this is due to the implicit conversion, hence the named parameter is never assigned. Instead we use an explicit nullptr. Reviewed By: yfeldblum Differential Revision: D6279302 fbshipit-source-id: ed449601b0410c178777f20e82ed09d9097bd024 --- diff --git a/folly/io/async/DelayedDestructionBase.h b/folly/io/async/DelayedDestructionBase.h index 5edd64bd..9375baa0 100644 --- a/folly/io/async/DelayedDestructionBase.h +++ b/folly/io/async/DelayedDestructionBase.h @@ -247,25 +247,25 @@ inline bool operator !=( const DelayedDestructionBase::DestructorGuard& right) { return left.get() != right.get(); } -inline bool operator ==( +inline bool operator==( const DelayedDestructionBase::DestructorGuard& left, - std::nullptr_t right) { - return left.get() == right; + std::nullptr_t) { + return left.get() == nullptr; } -inline bool operator ==( - std::nullptr_t left, +inline bool operator==( + std::nullptr_t, const DelayedDestructionBase::DestructorGuard& right) { - return left == right.get(); + return nullptr == right.get(); } -inline bool operator !=( +inline bool operator!=( const DelayedDestructionBase::DestructorGuard& left, - std::nullptr_t right) { - return left.get() != right; + std::nullptr_t) { + return left.get() != nullptr; } -inline bool operator !=( - std::nullptr_t left, +inline bool operator!=( + std::nullptr_t, const DelayedDestructionBase::DestructorGuard& right) { - return left != right.get(); + return nullptr != right.get(); } template @@ -281,27 +281,27 @@ inline bool operator !=( return left.get() != right.get(); } template -inline bool operator ==( +inline bool operator==( const DelayedDestructionBase::IntrusivePtr& left, - std::nullptr_t right) { - return left.get() == right; + std::nullptr_t) { + return left.get() == nullptr; } template -inline bool operator ==( - std::nullptr_t left, +inline bool operator==( + std::nullptr_t, const DelayedDestructionBase::IntrusivePtr& right) { - return left == right.get(); + return nullptr == right.get(); } template -inline bool operator !=( +inline bool operator!=( const DelayedDestructionBase::IntrusivePtr& left, - std::nullptr_t right) { - return left.get() != right; + std::nullptr_t) { + return left.get() != nullptr; } template -inline bool operator !=( - std::nullptr_t left, +inline bool operator!=( + std::nullptr_t, const DelayedDestructionBase::IntrusivePtr& right) { - return left != right.get(); + return nullptr != right.get(); } } // namespace folly