mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Compile without -Wno-unused-variable (take 2) (#66041)
Summary: Delete `-Wno-unused-variable` from top level `CMakeLists.txt` Still suppress those warnings for tests and `torch_python` Delete number of unused variables from caffe2 code Use `(void)var;` to suppress unused variable in range loops Use `C10_UNUSED` for global constructors and use `constexpr` instead of `static` for global constants Do not delete `caffe2::OperatorBase::Output` calls as they have side effects Pull Request resolved: https://github.com/pytorch/pytorch/pull/66041 Reviewed By: ngimel Differential Revision: D31360142 Pulled By: malfet fbshipit-source-id: 6fdfb9f91efdc49ca984a2f2a17ee377d28210c8
This commit is contained in:
committed by
Facebook GitHub Bot
parent
6b0aa2958d
commit
4c4525fa5c
@ -236,8 +236,8 @@ void THP_encodeInt16Buffer(uint8_t* dst, const int16_t* src, THPByteOrder order,
|
||||
{
|
||||
memcpy(dst, src, sizeof(int16_t) * len);
|
||||
if (order != THP_nativeByteOrder()) {
|
||||
// NOLINTNEXTLINE(clang-analyzer-deadcode.DeadStores,clang-diagnostic-unused-variable)
|
||||
for(const auto i : c10::irange(len)) {
|
||||
(void)i;
|
||||
swapBytes16(dst);
|
||||
dst += sizeof(int16_t);
|
||||
}
|
||||
@ -248,8 +248,8 @@ void THP_encodeInt32Buffer(uint8_t* dst, const int32_t* src, THPByteOrder order,
|
||||
{
|
||||
memcpy(dst, src, sizeof(int32_t) * len);
|
||||
if (order != THP_nativeByteOrder()) {
|
||||
// NOLINTNEXTLINE(clang-analyzer-deadcode.DeadStores,clang-diagnostic-unused-variable)
|
||||
for(const auto i : c10::irange(len)) {
|
||||
(void)i;
|
||||
swapBytes32(dst);
|
||||
dst += sizeof(int32_t);
|
||||
}
|
||||
@ -260,8 +260,8 @@ void THP_encodeInt64Buffer(uint8_t* dst, const int64_t* src, THPByteOrder order,
|
||||
{
|
||||
memcpy(dst, src, sizeof(int64_t) * len);
|
||||
if (order != THP_nativeByteOrder()) {
|
||||
// NOLINTNEXTLINE(clang-analyzer-deadcode.DeadStores,clang-diagnostic-unused-variable)
|
||||
for(const auto i : c10::irange(len)) {
|
||||
(void)i;
|
||||
swapBytes64(dst);
|
||||
dst += sizeof(int64_t);
|
||||
}
|
||||
@ -272,8 +272,8 @@ void THP_encodeFloatBuffer(uint8_t* dst, const float* src, THPByteOrder order, s
|
||||
{
|
||||
memcpy(dst, src, sizeof(float) * len);
|
||||
if (order != THP_nativeByteOrder()) {
|
||||
// NOLINTNEXTLINE(clang-analyzer-deadcode.DeadStores,clang-diagnostic-unused-variable)
|
||||
for(const auto i : c10::irange(len)) {
|
||||
(void)i;
|
||||
swapBytes32(dst);
|
||||
dst += sizeof(float);
|
||||
}
|
||||
@ -284,8 +284,8 @@ void THP_encodeDoubleBuffer(uint8_t* dst, const double* src, THPByteOrder order,
|
||||
{
|
||||
memcpy(dst, src, sizeof(double) * len);
|
||||
if (order != THP_nativeByteOrder()) {
|
||||
// NOLINTNEXTLINE(clang-analyzer-deadcode.DeadStores,clang-diagnostic-unused-variable)
|
||||
for(const auto i : c10::irange(len)) {
|
||||
(void)i;
|
||||
swapBytes64(dst);
|
||||
dst += sizeof(double);
|
||||
}
|
||||
|
Reference in New Issue
Block a user