mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
turn on -Wall with a few exceptions in Bazel build
Summary: We add the following exceptions: * sign-compare: this is heavily violated in our codebase * unknown-pragmas: we use this intentionally for some loop unrolling in CUDA Because they are included in -Wall by default, we remove the following warnings from our explicit list: * unused-function * unused-variable Test Plan: Rely on CI. Reviewers: alband, seemethere Subscribers: Tasks: Tags: Pull Request resolved: https://github.com/pytorch/pytorch/pull/79306 Approved by: https://github.com/malfet
This commit is contained in:
committed by
PyTorch MergeBot
parent
52a5266aab
commit
70810a3691
13
.bazelrc
13
.bazelrc
@ -58,8 +58,17 @@ build:cpu-only --@rules_cuda//cuda:enable_cuda=False
|
||||
# macro-level opts will come earlier than target level overrides
|
||||
build --per_file_copt='^//.*\.(cpp|cc)$'@-Werror=type-limits
|
||||
build --per_file_copt='^//.*\.(cpp|cc)$'@-Werror=unused-but-set-variable
|
||||
build --per_file_copt='^//.*\.(cpp|cc)$'@-Werror=unused-function
|
||||
build --per_file_copt='^//.*\.(cpp|cc)$'@-Werror=unused-variable
|
||||
|
||||
build --per_file_copt='^//.*\.(cpp|cc)$'@-Werror=all
|
||||
# The following warnings come from -Wall. We downgrade them from error
|
||||
# to warnings here.
|
||||
#
|
||||
# sign-compare has a tremendous amount of violations in the
|
||||
# codebase. It will be a lot of work to fix them, just disable it for
|
||||
# now.
|
||||
build --per_file_copt='^//.*\.(cpp|cc)$'@-Wno-sign-compare
|
||||
# We intentionally use #pragma unroll, which is compiler specific.
|
||||
build --per_file_copt='^//.*\.(cpp|cc)$'@-Wno-error=unknown-pragmas
|
||||
|
||||
build --per_file_copt='//:aten/src/ATen/RegisterCompositeExplicitAutograd\.cpp$'@-Wno-error=unused-function
|
||||
build --per_file_copt='//:aten/src/ATen/RegisterCompositeImplicitAutograd\.cpp$'@-Wno-error=unused-function
|
||||
|
@ -5,8 +5,17 @@ NVCC_COPTS = [
|
||||
"--expt-extended-lambda",
|
||||
"--compiler-options=-Werror=type-limits",
|
||||
"--compiler-options=-Werror=unused-but-set-variable",
|
||||
"--compiler-options=-Werror=unused-function",
|
||||
"--compiler-options=-Werror=unused-variable",
|
||||
|
||||
"--compiler-options=-Werror=all",
|
||||
# The following warnings come from -Wall. We downgrade them from
|
||||
# error to warnings here.
|
||||
#
|
||||
# sign-compare has a tremendous amount of violations in the
|
||||
# codebase. It will be a lot of work to fix them, just disable it
|
||||
# for now.
|
||||
"--compiler-options=-Wno-sign-compare",
|
||||
# We intentionally use #pragma unroll, which is compiler specific.
|
||||
"--compiler-options=-Wno-error=unknown-pragmas",
|
||||
]
|
||||
|
||||
def cu_library(name, srcs, copts = [], **kwargs):
|
||||
|
Reference in New Issue
Block a user