Skip to content

Commit e7cb43a

Browse files
cyyeverpytorchmergebot
authored andcommittedJun 4, 2024
Check unused variables in tests (pytorch#127498)
Enables unused variable checks in CMake. Pull Request resolved: pytorch#127498 Approved by: https://github.com/ezyang
1 parent 2ad0e41 commit e7cb43a

File tree

4 files changed

+1
-12
lines changed

4 files changed

+1
-12
lines changed
 

‎caffe2/CMakeLists.txt

-3
Original file line numberDiff line numberDiff line change
@@ -1810,9 +1810,6 @@ if(BUILD_TEST)
18101810
target_include_directories(${test_name} PRIVATE $<INSTALL_INTERFACE:include>)
18111811
target_include_directories(${test_name} PRIVATE $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>)
18121812
target_include_directories(${test_name} PRIVATE ${Caffe2_CPU_INCLUDE})
1813-
if(NOT MSVC)
1814-
target_compile_options(${test_name} PRIVATE -Wno-unused-variable)
1815-
endif()
18161813
add_test(NAME ${test_name} COMMAND $<TARGET_FILE:${test_name}>)
18171814
if(INSTALL_TEST)
18181815
install(TARGETS ${test_name} DESTINATION test)

‎test/cpp/jit/CMakeLists.txt

-3
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,6 @@ endif(MSVC)
129129

130130
target_link_libraries(test_jit PRIVATE ${JIT_TEST_DEPENDENCIES})
131131
target_include_directories(test_jit PRIVATE ${ATen_CPU_INCLUDE})
132-
if(NOT MSVC)
133-
target_compile_options(test_jit PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-Wno-unused-variable>)
134-
endif()
135132

136133
if(LINUX)
137134
#Update to target_link_options when CMake version can be upgraded

‎test/cpp/tensorexpr/CMakeLists.txt

-3
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ add_executable(test_tensorexpr
4242
target_link_libraries(test_tensorexpr PRIVATE torch gtest)
4343
target_include_directories(test_tensorexpr PRIVATE ${ATen_CPU_INCLUDE})
4444
target_compile_definitions(test_tensorexpr PRIVATE USE_GTEST)
45-
if(NOT MSVC)
46-
target_compile_options(test_tensorexpr PRIVATE -Wno-unused-variable)
47-
endif()
4845

4946
add_executable(tutorial_tensorexpr ${TENSOREXPR_TEST_ROOT}/tutorial.cpp)
5047
target_link_libraries(tutorial_tensorexpr PRIVATE torch)

‎test/cpp/tensorexpr/test_llvm.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ TEST(LLVM, CharToFloatCastTest) {
179179
}
180180

181181
TEST(LLVM, BitCast) {
182-
constexpr int16_t ref16 = 1337;
182+
/* constexpr int16_t ref16 = 1337; */
183183
constexpr int32_t ref32 = 1337;
184184
constexpr int64_t ref64 = 1337;
185185
constexpr float reff32 = 1337.0f;
@@ -1395,7 +1395,6 @@ TEST(LLVM, EliminatedStmt) {
13951395
TEST(LLVM, SimpleReduction) {
13961396
int M = 128;
13971397
int N = 64;
1398-
const int kTotalSize = M * N;
13991398

14001399
BufHandle a("a", {1, M, N}, kFloat);
14011400

@@ -1429,7 +1428,6 @@ TEST(LLVM, SimpleReduction) {
14291428
TEST(LLVM, RFactorReduction) {
14301429
int M = 128;
14311430
int N = 64;
1432-
const int kTotalSize = M * N;
14331431

14341432
BufHandle a("a", {1, M, N}, kFloat);
14351433

0 commit comments

Comments
 (0)