Remove some unused-but-set variables
authorAndrey Alekseenko <al42and@gmail.com>
Wed, 9 Jun 2021 19:40:38 +0000 (22:40 +0300)
committerAndrey Alekseenko <al42and@gmail.com>
Wed, 9 Jun 2021 19:44:44 +0000 (22:44 +0300)
Detected by the -Wunused-but-set-variable option in the
open-source IntelLLVM (and, in theory, upstream Clang trunk).

There are also false-positive warnings there, so the
compilation log is noisy.
I'm not doing any silencing here, since it will, hopefully, change by
the time of Clang 13 release.
But the variables removed here appear to be genuinely unused.

src/gromacs/domdec/nsgrid.cpp
src/gromacs/ewald/pme_only.cpp
src/gromacs/gmxpreprocess/topio.cpp
src/gromacs/nbnxm/kernels_simd_2xmm/kernel_outer.h
src/gromacs/nbnxm/kernels_simd_4xm/kernel_outer.h

index 8506189d68a4acebb75e5f782170cad93f8f0864..0677c0a9f581a8ee71671a888cb224ded60c6bbd 100644 (file)
@@ -125,7 +125,7 @@ void get_nsgrid_boundaries(int           nboundeddim,
                            rvec          grid_x1)
 {
     rvec av, stddev;
-    real vol, bdens0, bdens1;
+    real bdens0, bdens1;
     int  d;
 
     if (nboundeddim < DIM)
@@ -133,14 +133,12 @@ void get_nsgrid_boundaries(int           nboundeddim,
         calc_x_av_stddev(ncg, cgcm, av, stddev);
     }
 
-    vol = 1;
     for (d = 0; d < DIM; d++)
     {
         if (d < nboundeddim)
         {
             grid_x0[d] = (gr0 != nullptr ? (*gr0)[d] : 0);
             grid_x1[d] = (gr1 != nullptr ? (*gr1)[d] : box[d][d]);
-            vol *= (grid_x1[d] - grid_x0[d]);
         }
         else
         {
@@ -171,7 +169,6 @@ void get_nsgrid_boundaries(int           nboundeddim,
                 grid_x1[d] = (*gr1)[d];
                 bdens1     = (*gr1)[d];
             }
-            vol *= (bdens1 - bdens0);
         }
 
         if (debug)
index aa3263aaf13db3ff350b035be5b7f3136e4262e2..50f5b48878452768e338c7739785edc9052b5539 100644 (file)
@@ -260,9 +260,8 @@ static int gmx_pme_recv_coeffs_coords(struct gmx_pme_t*            pme,
     int nat    = 0;
 
 #if GMX_MPI
-    unsigned int flags          = 0;
-    int          messages       = 0;
-    bool         atomSetChanged = false;
+    int  messages       = 0;
+    bool atomSetChanged = false;
 
     do
     {
@@ -272,9 +271,6 @@ static int gmx_pme_recv_coeffs_coords(struct gmx_pme_t*            pme,
         /* Receive the send count, box and time step from the peer PP node */
         MPI_Recv(&cnb, sizeof(cnb), MPI_BYTE, pme_pp->peerRankId, eCommType_CNB, pme_pp->mpi_comm_mysim, MPI_STATUS_IGNORE);
 
-        /* We accumulate all received flags */
-        flags |= cnb.flags;
-
         *step = cnb.step;
 
         if (debug)
index 42cfc075836347fa21d5c110ccd1d7fd1822d5b5..714b8680ea29446c01e8f832f1450a230c777d73 100644 (file)
@@ -1379,8 +1379,7 @@ void generate_qmexcl(gmx_mtop_t* sys, t_inputrec* ir, const gmx::MDLogger& logge
     int             mol, nat_mol, nr_mol_with_qm_atoms = 0;
     gmx_molblock_t* molb;
     bool            bQMMM;
-    int             index_offset = 0;
-    int             qm_nr        = 0;
+    int             qm_nr = 0;
 
     grpnr = sys->groups.groupNumbers[SimulationAtomGroupType::QuantumMechanics].data();
 
@@ -1453,7 +1452,6 @@ void generate_qmexcl(gmx_mtop_t* sys, t_inputrec* ir, const gmx::MDLogger& logge
             {
                 grpnr += nat_mol;
             }
-            index_offset += nat_mol;
         }
     }
 }
index bdf2524e519ccfcbdb1510ff7cfd43eefd60d208..620a6d535362236d6d0900c8d550ad5120f6aa08 100644 (file)
 
     const nbnxn_cj_t* l_cj = nbl->cj.data();
 
-    int ninner = 0;
     for (const nbnxn_ci_t& ciEntry : nbl->ci)
     {
         const int ish    = (ciEntry.shift & NBNXN_CI_SHIFT);
             }
         }
 #undef CALC_LJ
-        ninner += cjind1 - cjind0;
-
         /* Add accumulated i-forces to the force array */
         real fShiftX = reduceIncr4ReturnSumHsimd(f + scix, fix_S0, fix_S2);
         real fShiftY = reduceIncr4ReturnSumHsimd(f + sciy, fiy_S0, fiy_S2);
index 2af0345368940399d85aae7fc1964ff5105b0a6a..dae206ba6995f405a3061122032f52b5e6a996dc 100644 (file)
 
     const nbnxn_cj_t* l_cj = nbl->cj.data();
 
-    int ninner = 0;
-
     for (const nbnxn_ci_t& ciEntry : nbl->ci)
     {
         const int ish    = (ciEntry.shift & NBNXN_CI_SHIFT);
             }
         }
 #undef CALC_LJ
-        ninner += cjind1 - cjind0;
-
         /* Add accumulated i-forces to the force array */
         real fShiftX = reduceIncr4ReturnSum(f + scix, fix_S0, fix_S1, fix_S2, fix_S3);
         real fShiftY = reduceIncr4ReturnSum(f + sciy, fiy_S0, fiy_S1, fiy_S2, fiy_S3);