8000 Compile C10 with `Wshadow` · pytorch/pytorch@e20e174 · GitHub
[go: up one dir, main page]

Skip to content

Commit e20e174

Browse files
committed
Compile C10 with Wshadow
This should prevent further regressions like #86646 Update `fmt` to `9.1.0` to fix variable shadowing in that library
1 parent d8b971e commit e20e174

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -927,9 +927,6 @@ if(NOT MSVC)
927927
append_cxx_flag_if_supported("-fno-trapping-math" CMAKE_CXX_FLAGS)
928928
append_cxx_flag_if_supported("-Werror=format" CMAKE_CXX_FLAGS)
929929
append_cxx_flag_if_supported("-Werror=cast-function-type" CMAKE_CXX_FLAGS)
930-
check_cxx_compiler_flag("-Werror=sign-compare" HAS_WERROR_SIGN_COMPARE)
931-
# This doesn't work globally so we use the test on specific
932-
# target_compile_options
933930
endif()
934931

935932
if(USE_ASAN)

c10/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,9 @@ target_compile_options(c10 PRIVATE "-DC10_BUILD_MAIN_LIB")
5252
if(${COMPILER_SUPPORTS_HIDDEN_VISIBILITY})
5353
target_compile_options(c10 PRIVATE "-fvisibility=hidden")
5454
endif()
55-
if(HAS_WERROR_SIGN_COMPARE AND WERROR)
56-
target_compile_options(c10 PRIVATE "-Werror=sign-compare")
55+
if(WERROR)
56+
target_compile_options_if_supported(c10 PRIVATE "-Werror=sign-compare")
57+
target_compile_options_if_supported(c10 PRIVATE "-Werror=shadow")
5758
endif()
5859

5960
# ---[ Dependency of c10

third_party/fmt

Submodule fmt updated 64 files

0 commit comments

Comments
 (0)
0