From 20954e693f7c079e9137decf75ecabc4be6ff1ba Mon Sep 17 00:00:00 2001 From: Sergiu Deitsch Date: Mon, 20 May 2024 14:15:41 +0200 Subject: [PATCH] Eliminate CUDA set but unused variable warning This avoids warnings such as D:\a\ceres-solver\ceres-solver\internal\ceres\cuda_kernels_bsm_to_crs.cu.cc(143): warning #550-D: variable "row_nnz_e" was set but never used [D:\a\ceres-solver\ceres-solver\build_Release\internal\ceres\ceres_cuda_kernels.vcxproj] int row_nnz_e = 0; ^ detected during instantiation of "void ceres::internal::RowBlockIdAndNNZ(int, int, int, const int *, const ceres::internal::Cell *, const ceres::internal::Block *, const ceres::internal::Block *, int *, int *, int *) [with partitioned=false]" at line 240 Remark: The warnings can be suppressed with "-diag-suppress " that is caused by compile-time conditional use of the variable. Change-Id: I041b076a5208eeb662b8c7500d7b238965be833c --- internal/ceres/cuda_kernels_bsm_to_crs.cu.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/ceres/cuda_kernels_bsm_to_crs.cu.cc b/internal/ceres/cuda_kernels_bsm_to_crs.cu.cc index b9ca4cd98..ee574f085 100644 --- a/internal/ceres/cuda_kernels_bsm_to_crs.cu.cc +++ b/internal/ceres/cuda_kernels_bsm_to_crs.cu.cc @@ -140,7 +140,7 @@ __global__ void RowBlockIdAndNNZ( const auto& row_block = row_blocks[row_block_id]; auto first_cell = cells + first_cell_in_row_block[row_block_id]; const auto last_cell = cells + first_cell_in_row_block[row_block_id + 1]; - int row_nnz_e = 0; + [[maybe_unused]] int row_nnz_e = 0; if (partitioned && row_block_id < num_row_blocks_e) { // First cell is a cell from E row_nnz_e = col_blocks[first_cell->block_id].size;