Skip to content

Commit

Permalink
Suppress new GCC 5 warning -Wbool-compare
Browse files Browse the repository at this point in the history
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
  • Loading branch information
marksantaniello authored and Facebook Github Bot 9 committed May 13, 2016
1 parent 2b6dd2e commit 2f1ac69
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions folly/Traits.h
Expand Up @@ -337,10 +337,13 @@ struct is_negative_impl<T, false> {

// 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 <typename RHS, RHS rhs, typename LHS>
bool less_than_impl(LHS const lhs) {
Expand All @@ -350,8 +353,6 @@ bool less_than_impl(LHS const lhs) {
lhs < rhs;
}

#pragma GCC diagnostic pop

template <typename RHS, RHS rhs, typename LHS>
bool greater_than_impl(LHS const lhs) {
return
Expand All @@ -360,6 +361,8 @@ bool greater_than_impl(LHS const lhs) {
lhs > rhs;
}

#pragma GCC diagnostic pop

} // namespace detail {

// same as `x < 0`
Expand Down

0 comments on commit 2f1ac69

Please sign in to comment.