From d724a9193560216234df13d2f55f71845daa72ba Mon Sep 17 00:00:00 2001 From: Nirav Mehta Date: Tue, 4 Oct 2022 19:43:54 +0000 Subject: [PATCH] Adding Wunused-local-typedef build flag (#86154) # Summary In the past, we have seen PRs causing internal breakages caused by `-Wunused-local-typedef` flag which than had to be fixed. For example: [#79978](https://github.com/pytorch/pytorch/pull/79978) As part of this change, we want to catch this error in the PR Checks itself. Pull Request resolved: https://github.com/pytorch/pytorch/pull/86154 Approved by: https://github.com/huydhn, https://github.com/seemethere, https://github.com/osalpekar --- CMakeLists.txt | 2 ++ defs.bzl | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6becf22d8946..c2c6fb2496de 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -832,6 +832,7 @@ if(NOT MSVC) append_cxx_flag_if_supported("-Wno-type-limits" CMAKE_CXX_FLAGS) append_cxx_flag_if_supported("-Wno-array-bounds" CMAKE_CXX_FLAGS) append_cxx_flag_if_supported("-Wno-unknown-pragmas" CMAKE_CXX_FLAGS) + append_cxx_flag_if_supported("-Wunused-local-typedefs" CMAKE_CXX_FLAGS) append_cxx_flag_if_supported("-Wno-unused-parameter" CMAKE_CXX_FLAGS) append_cxx_flag_if_supported("-Wno-unused-function" CMAKE_CXX_FLAGS) append_cxx_flag_if_supported("-Wno-unused-result" CMAKE_CXX_FLAGS) @@ -895,6 +896,7 @@ if(NOT MSVC) append_cxx_flag_if_supported("-Wno-constexpr-not-const" CMAKE_CXX_FLAGS) append_cxx_flag_if_supported("-Wno-missing-braces" CMAKE_CXX_FLAGS) append_cxx_flag_if_supported("-Wunused-lambda-capture" CMAKE_CXX_FLAGS) + append_cxx_flag_if_supported("-Wunused-local-typedef" CMAKE_CXX_FLAGS) append_cxx_flag_if_supported("-Qunused-arguments" CMAKE_CXX_FLAGS) if(${USE_COLORIZE_OUTPUT}) endif() diff --git a/defs.bzl b/defs.bzl index 1ccc35f1e839..00cf0fa8f061 100644 --- a/defs.bzl +++ b/defs.bzl @@ -15,7 +15,6 @@ default_compiler_flags = [ "-Wno-unused-function", "-Wno-unused-parameter", "-Wno-error=strict-aliasing", - "-Wno-unused-local-typedefs", "-Wno-shadow-compatible-local", "-Wno-maybe-uninitialized", # aten is built with gcc as part of HHVM "-Wno-unknown-pragmas",