turn on -Werror=unused-variable in our Bazel CPU build

Summary:
We also fix any existing issues. Note that we only do this for the CPU
build because nvcc is considered a C++ toolchain but it does not have
the same flag support. Adding flags to the GPU build will cause nvcc
errors.

Test Plan: Built locally, rely on CI to confirm.

Reviewers: malfet

Subscribers:

Tasks:

Tags:

Pull Request resolved: https://github.com/pytorch/pytorch/pull/79156

Approved by: https://github.com/seemethere, https://github.com/osalpekar, https://github.com/albanD
This commit is contained in:
Michael Andreas Dagitses
2022-06-10 15:14:27 -07:00
committed by PyTorch MergeBot
parent e727539c29
commit ab2ca95dd1
25 changed files with 49 additions and 129 deletions
+1 -1
View File
@@ -173,7 +173,7 @@ TEST(OptimTest, OptimizerAccessors) {
const auto& optimizer_ = Adagrad(params, options);
optimizer_.defaults();
// test for param_groups() with const reference return
const auto& params_2 = optimizer_.param_groups();
(void)optimizer_.param_groups();
// test for state() with const reference return
optimizer_.state();
}