Fix clang-tidy complaints
authorAndrey Alekseenko <al42and@gmail.com>
Mon, 11 Oct 2021 14:41:28 +0000 (16:41 +0200)
committerAndrey Alekseenko <al42and@gmail.com>
Wed, 13 Oct 2021 10:09:37 +0000 (10:09 +0000)
- False-positives after "if constexpr".
- "empty()" instead of "size() > 0".
- "auto *" instead of "auto".

src/gromacs/domdec/gpuhaloexchange_impl.cu
src/gromacs/listed_forces/pairs.cpp

index b0dab24e8a978a689a5d44dbb9f3e7d213675512..4a62a895324c1a98ea742cf109137e22a22f192c 100644 (file)
@@ -352,9 +352,9 @@ void GpuHaloExchange::Impl::communicateHaloForces(bool accumulateForces,
     // ToDo: We need further refinement here as communicateHaloData includes launch time for cudamemcpyasync
     wallcycle_start(wcycle_, WallCycleCounter::MoveF);
 
-    while (dependencyEvents->size() > 0)
+    while (!dependencyEvents->empty())
     {
-        auto dependency = dependencyEvents->back();
+        auto* dependency = dependencyEvents->back();
         dependency->enqueueWaitEvent(*haloStream_);
         dependencyEvents->pop_back();
     }
index 4d2d7ae88238db4c13c0887bcc170d266ed0695d..064c837756c639b5c7da10f8d9c8566a9717cc69 100644 (file)
@@ -242,6 +242,7 @@ static real free_energy_evaluate_single(real
             }
             sigma_pow[i] = sigma6[i];
         }
+        // NOLINTNEXTLINE(readability-misleading-indentation) remove when clang-tidy-13 is required
         if constexpr (softcoreType == KernelSoftcoreType::Gapsys)
         {
             if ((c6[i] > 0) && (c12[i] > 0))
@@ -258,6 +259,7 @@ static real free_energy_evaluate_single(real
         }
     }
 
+    // NOLINTNEXTLINE(readability-misleading-indentation) remove when clang-tidy-13 is required
     if constexpr (softcoreType == KernelSoftcoreType::Beutler)
     {
         /* only use softcore if one of the states has a zero endstate - softcore is for avoiding infinities!*/
@@ -272,6 +274,7 @@ static real free_energy_evaluate_single(real
             alpha_coul_eff = scParams.alphaCoulomb;
         }
     }
+    // NOLINTNEXTLINE(readability-misleading-indentation) remove when clang-tidy-13 is required
     if constexpr (softcoreType == KernelSoftcoreType::Gapsys)
     {
         /* only use softcore if one of the states has a zero endstate - softcore is for avoiding infinities!*/
@@ -288,6 +291,7 @@ static real free_energy_evaluate_single(real
     }
 
     /* Loop over A and B states again */
+    // NOLINTNEXTLINE(readability-misleading-indentation) remove when clang-tidy-13 is required
     for (i = 0; i < 2; i++)
     {
         fscal_elec[i] = 0;
@@ -314,6 +318,7 @@ static real free_energy_evaluate_single(real
                 r_coul = r;
             }
 
+            // NOLINTNEXTLINE(readability-misleading-indentation) remove when clang-tidy-13 is required
             if constexpr (softcoreType == KernelSoftcoreType::Gapsys)
             {
                 if ((facel != 0) && (LFC[i] < 1))
@@ -333,6 +338,7 @@ static real free_energy_evaluate_single(real
                 }
             }
 
+            // NOLINTNEXTLINE(readability-misleading-indentation) remove when clang-tidy-13 is required
             if ((softcoreType == KernelSoftcoreType::Gapsys) && (r < rQ))
             {
                 real rInvQ    = one / rQ;
@@ -397,6 +403,7 @@ static real free_energy_evaluate_single(real
                 }
             }
 
+            // NOLINTNEXTLINE(readability-misleading-indentation) remove when clang-tidy-13 is required
             if ((softcoreType == KernelSoftcoreType::Gapsys) && (r < rLJ))
             {
                 // scaled values for c6 and c12
@@ -487,6 +494,7 @@ static real free_energy_evaluate_single(real
             dvdl_coul_sum += dvdl_elec[i];
             dvdl_vdw_sum += dvdl_vdw[i];
         }
+        // NOLINTNEXTLINE(readability-misleading-indentation) remove when clang-tidy-13 is required
         dvdl_coul_sum += velec[i] * DLF[i];
         dvdl_vdw_sum += vvdw[i] * DLF[i];
         if constexpr (softcoreType == KernelSoftcoreType::Beutler)