From 18de341f84035f76395347f77a8cc71d0461ab37 Mon Sep 17 00:00:00 2001 From: =?utf8?q?P=C3=A1draig=20Brady?= Date: Thu, 9 Nov 2017 19:26:16 -0800 Subject: [PATCH] folly: avoid compile warning/failure due to lvalue-to-rvalue conversion MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- folly/io/async/DelayedDestructionBase.h | 48 ++++++++++++------------- 1 file changed, 24 insertions(+), 24 deletions(-) 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 -- 2.34.1