From 2f1ac6903006adf712cc3ae1641ba527e1b45dee Mon Sep 17 00:00:00 2001 From: Mark Santaniello Date: Fri, 13 May 2016 08:41:37 -0700 Subject: [PATCH] Suppress new GCC 5 warning -Wbool-compare Summary: This -Wbool-compare is apparently new in GCC 5. We should ignore it, similar to the existing suppression of -Wsign-compare. Reviewed By: pixelb, yfeldblum Differential Revision: D3293675 fbshipit-source-id: 5f90b0dbf049a06c0f6c3df2cdfcc8055358e367 --- folly/Traits.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/folly/Traits.h b/folly/Traits.h index 45f005cb444..39136a72d8c 100644 --- a/folly/Traits.h +++ b/folly/Traits.h @@ -337,10 +337,13 @@ struct is_negative_impl { // folly::to integral specializations can end up generating code // inside what are really static ifs (not executed because of the templated -// types) that violate -Wsign-compare so suppress them in order to not prevent -// all calling code from using it. +// types) that violate -Wsign-compare and/or -Wbool-compare so suppress them +// in order to not prevent all calling code from using it. #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wsign-compare" +#if __GNUC_PREREQ(5, 0) +#pragma GCC diagnostic ignored "-Wbool-compare" +#endif template bool less_than_impl(LHS const lhs) { @@ -350,8 +353,6 @@ bool less_than_impl(LHS const lhs) { lhs < rhs; } -#pragma GCC diagnostic pop - template bool greater_than_impl(LHS const lhs) { return @@ -360,6 +361,8 @@ bool greater_than_impl(LHS const lhs) { lhs > rhs; } +#pragma GCC diagnostic pop + } // namespace detail { // same as `x < 0`