mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Revert "Extend sign-compare warnings to gcc"
This reverts commit 34446653c7.
Reverted https://github.com/pytorch/pytorch/pull/75544 on behalf of https://github.com/janeyx99
This commit is contained in:
parent
761bb06292
commit
80e05b7df4
|
|
@ -787,6 +787,7 @@ if(NOT MSVC)
|
|||
string(APPEND CMAKE_CXX_FLAGS " -Wno-type-limits")
|
||||
string(APPEND CMAKE_CXX_FLAGS " -Wno-array-bounds")
|
||||
string(APPEND CMAKE_CXX_FLAGS " -Wno-unknown-pragmas")
|
||||
string(APPEND CMAKE_CXX_FLAGS " -Wno-sign-compare")
|
||||
string(APPEND CMAKE_CXX_FLAGS " -Wno-unused-parameter")
|
||||
string(APPEND CMAKE_CXX_FLAGS " -Wno-unused-function")
|
||||
string(APPEND CMAKE_CXX_FLAGS " -Wno-unused-result")
|
||||
|
|
@ -797,6 +798,8 @@ if(NOT MSVC)
|
|||
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||
string(APPEND CMAKE_CXX_FLAGS " -Wno-range-loop-analysis")
|
||||
string(APPEND CMAKE_CXX_FLAGS " -Wno-pass-failed")
|
||||
# sign-compare is not part of -Wall, see https://godbolt.org/z/s1YczM41T
|
||||
string(APPEND CMAKE_CXX_FLAGS " -Wsign-compare")
|
||||
endif()
|
||||
if(CMAKE_COMPILER_IS_GNUCXX AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0.0))
|
||||
string(APPEND CMAKE_CXX_FLAGS " -Wno-stringop-overflow")
|
||||
|
|
|
|||
|
|
@ -70,14 +70,6 @@ inline constexpr bool signs_differ(const T& a, const U& b) {
|
|||
return is_negative(a) != is_negative(b);
|
||||
}
|
||||
|
||||
// Suppress sign compare warning when compiling with GCC
|
||||
// as later does not account for short-circuit rule before
|
||||
// raising the warning, see https://godbolt.org/z/Tr3Msnz99
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wsign-compare"
|
||||
#endif
|
||||
|
||||
/// Returns true if x is greater than the greatest value of the type Limit
|
||||
template <typename Limit, typename T>
|
||||
inline constexpr bool greater_than_max(const T& x) {
|
||||
|
|
@ -86,10 +78,6 @@ inline constexpr bool greater_than_max(const T& x) {
|
|||
return can_overflow && x > std::numeric_limits<Limit>::max();
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
/// Returns true if x < lowest(Limit). Standard comparison
|
||||
template <typename Limit, typename T>
|
||||
static inline constexpr bool less_than_lowest(
|
||||
|
|
|
|||
|
|
@ -301,7 +301,8 @@ int LoadBalancer::acquire() {
|
|||
size_t minusers = SIZE_MAX;
|
||||
int minIdx = 0;
|
||||
for (size_t i = 0; i < n_; ++i, ++last) {
|
||||
if (last >= static_cast<int>(n_)) {
|
||||
// NOLINTNEXTLINE(clang-diagnostic-sign-compare)
|
||||
if (last >= n_) {
|
||||
last = 0;
|
||||
}
|
||||
uint64_t prev = 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user