Compile C10 with Wshadow (#86666)

This should prevent further regressions like https://github.com/pytorch/pytorch/pull/86646
Update `fmt` to `7.1.0` to fix variable shadowing in that library

Pull Request resolved: https://github.com/pytorch/pytorch/pull/86666
Approved by: https://github.com/seemethere
This commit is contained in:
Nikita Shulga 2022-10-11 22:39:58 +00:00 committed by PyTorch MergeBot
parent 0337f0ad47
commit 09364f4298
3 changed files with 4 additions and 6 deletions

View File

@ -927,9 +927,6 @@ if(NOT MSVC)
append_cxx_flag_if_supported("-fno-trapping-math" CMAKE_CXX_FLAGS) append_cxx_flag_if_supported("-fno-trapping-math" CMAKE_CXX_FLAGS)
append_cxx_flag_if_supported("-Werror=format" CMAKE_CXX_FLAGS) append_cxx_flag_if_supported("-Werror=format" CMAKE_CXX_FLAGS)
append_cxx_flag_if_supported("-Werror=cast-function-type" CMAKE_CXX_FLAGS) append_cxx_flag_if_supported("-Werror=cast-function-type" CMAKE_CXX_FLAGS)
check_cxx_compiler_flag("-Werror=sign-compare" HAS_WERROR_SIGN_COMPARE)
# This doesn't work globally so we use the test on specific
# target_compile_options
endif() endif()
if(USE_ASAN) if(USE_ASAN)

View File

@ -52,8 +52,9 @@ target_compile_options(c10 PRIVATE "-DC10_BUILD_MAIN_LIB")
if(${COMPILER_SUPPORTS_HIDDEN_VISIBILITY}) if(${COMPILER_SUPPORTS_HIDDEN_VISIBILITY})
target_compile_options(c10 PRIVATE "-fvisibility=hidden") target_compile_options(c10 PRIVATE "-fvisibility=hidden")
endif() endif()
if(HAS_WERROR_SIGN_COMPARE AND WERROR) if(WERROR)
target_compile_options(c10 PRIVATE "-Werror=sign-compare") target_compile_options_if_supported(c10 PRIVATE "-Werror=sign-compare")
target_compile_options_if_supported(c10 PRIVATE "-Werror=shadow")
endif() endif()
# ---[ Dependency of c10 # ---[ Dependency of c10

2
third_party/fmt vendored

@ -1 +1 @@
Subproject commit cd4af11efc9c622896a3e4cb599fa28668ca3d05 Subproject commit 7bdf0628b1276379886c7f6dda2cef2b3b374f0b