1load("@rules_cuda//cuda:defs.bzl", "cuda_library") 2 3NVCC_COPTS = [ 4 "--expt-relaxed-constexpr", 5 "--expt-extended-lambda", 6 "--compiler-options=-Werror=all", 7 # The following warnings come from -Wall. We downgrade them from 8 # error to warnings here. 9 # 10 # sign-compare has a tremendous amount of violations in the 11 # codebase. It will be a lot of work to fix them, just disable it 12 # for now. 13 "--compiler-options=-Wno-sign-compare", 14 # We intentionally use #pragma unroll, which is compiler specific. 15 "--compiler-options=-Wno-error=unknown-pragmas", 16 "--compiler-options=-Werror=extra", 17 # The following warnings come from -Wextra. We downgrade them from 18 # error to warnings here. 19 # 20 # unused-parameter-compare has a tremendous amount of violations 21 # in the codebase. It will be a lot of work to fix them, just 22 # disable it for now. 23 "--compiler-options=-Wno-unused-parameter", 24 # missing-field-parameters has both a large number of violations 25 # in the codebase, but it also is used pervasively in the Python C 26 # API. There are a couple of catches though: 27 # * we use multiple versions of the Python API and hence have 28 # potentially multiple different versions of each relevant 29 # struct. They may have different numbers of fields. It will be 30 # unwieldy to support multiple versions in the same source file. 31 # * Python itself for many of these structs recommends only 32 # initializing a subset of the fields. We should respect the API 33 # usage conventions of our dependencies. 34 # 35 # Hence, we just disable this warning altogether. We may want to 36 # clean up some of the clear-cut cases that could be risky, but we 37 # still likely want to have this disabled for the most part. 38 "-Wno-missing-field-initializers", 39] 40 41def cu_library(name, srcs, copts = [], **kwargs): 42 cuda_library(name, srcs = srcs, copts = NVCC_COPTS + copts, **kwargs) 43