Summary:
Due to how Conv.h uses the less_than template inside
not-actually-static static ifs clang still ends up validating generated
code inside a FOLLY_RANGE_CHECK which is never executed due to the
templated types. This code however still generates -Wsign-compare issues
so suppress that in order to allow includers to use this flag.
A simple example will illustrate this:
uint64_t foo = 1;
int bar = folly::to<int>(foo);
Test Plan: fbmake runtests
Reviewed By: meyering@fb.com, njormrod@fb.com
Subscribers: trunkagent, folly-diffs@, bmatheny, ranjeeth, subodh, kmdent, fma, shikong, pgriess, jdelong
FB internal diff:
D1731411
Signature: t1:
1731411:
1418243200:
ed1f34a1485669c9cb18f9f6029aca70e498953c
constexpr static bool check(T x) { return 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.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wsign-compare"
+
template <typename RHS, RHS rhs, typename LHS>
bool less_than_impl(
typename std::enable_if<
return false;
}
+#pragma GCC diagnostic pop
+
template <typename RHS, RHS rhs, typename LHS>
bool greater_than_impl(
typename std::enable_if<