Update testing matrices and fix warnings
authorMark Abraham <mark.j.abraham@gmail.com>
Sat, 10 Aug 2019 04:43:53 +0000 (06:43 +0200)
committerMark Abraham <mark.j.abraham@gmail.com>
Fri, 16 Aug 2019 19:08:31 +0000 (21:08 +0200)
Updated to test gcc 9, clang 8, and cmake 3.15.1.

Also fixes for compilation with gcc 9 and clang 9 (still in release
candidate, not yet released)

Added a gmx_source_file_warning_suppression() CMake helper function
(like the recently introduced gmx_target_warning_suppression()) to
manage per-source-file suppressions. This is used to suppress a
warning about the abuse of t_inputrec that is too difficult to fix
without replacing all of the handling of initialization and broadcast
of t_inputrec and subfields.

Refs #2899, #3006
Fixes #3007

Change-Id: I3a31a40c472d420adbb38d11ed5121702d7b3f7d

30 files changed:
admin/builds/post-submit-matrix.txt
admin/builds/pre-submit-matrix.txt
admin/builds/release-matrix.txt
cmake/gmxCFlags.cmake
src/external/CMakeLists.txt
src/gromacs/CMakeLists.txt
src/gromacs/applied_forces/densityfittingamplitudelookup.cpp
src/gromacs/domdec/domdec.cpp
src/gromacs/domdec/domdec_constraints.cpp
src/gromacs/domdec/domdec_topology.cpp
src/gromacs/ewald/pme_redistribute.cpp
src/gromacs/ewald/pme_solve.cpp
src/gromacs/fft/fft5d.cpp
src/gromacs/gmxana/gmx_bar.cpp
src/gromacs/gmxana/gmx_hbond.cpp
src/gromacs/mdlib/calcmu.cpp
src/gromacs/mdlib/constr.cpp
src/gromacs/mdlib/coupling.cpp
src/gromacs/mdlib/force.cpp
src/gromacs/mdlib/tgroup.cpp
src/gromacs/mdlib/update.cpp
src/gromacs/mdtypes/inputrec.cpp
src/gromacs/pbcutil/pbc.cpp
src/gromacs/selection/selhelp.cpp
src/gromacs/selection/selmethod.cpp
src/gromacs/selection/symrec.cpp
src/gromacs/utility/binaryinformation.cpp
src/programs/view/dialogs.cpp
src/programs/view/logo.cpp
src/programs/view/nleg.cpp

index 98ade087b37696891f0983d957dea8a338368d86..49479f913ab6178f20a0e2d80d18e76a06a0b9ca 100644 (file)
@@ -20,7 +20,7 @@ gcc-5 simd=ARM_NEON_ASIMD release-with-assert
 # Test the mdrun-only build
 # Test newest gcc at time of release
 # TODO In combination with gmx from another build, arrange to run regressiontests
-gcc-7 mpi no-openmp fftpack mdrun-only
+gcc-9 mpi no-openmp fftpack mdrun-only
 
 # Test MPMD PME with thread-MPI
 # Test oldest supported icc
@@ -48,7 +48,7 @@ clang-6 simd=sse4.1 openmp nranks=1 gpuhw=nvidia cuda-9.0 clang_cuda
 # Test clang + OpenMP
 # Test clang in double precision
 # Test AVX_128_FMA SIMD + Double (Important for Simd4N=Simd4 and sizeof(SimdInt32)!=4*GMX_SIMD_REAL_WIDTH)
-clang-5 double openmp simd=avx_128_fma npme=1 nranks=2 mpi
+clang-8 double openmp simd=avx_128_fma npme=1 nranks=2 mpi
 
 # Test SSE2 SIMD
 # Test CMAKE_BUILD_TYPE=Release
index 51cac1203745d483b2f479c18276679f8b538299..eef863a817b95997eaa13a9df9e4a6f1257e9b81 100644 (file)
 # Test MPMD PME with library MPI
 gcc-5 gpuhw=nvidia cuda-9.0 cmake-3.9.6 mpi npme=1 nranks=2 openmp
 
+# Test newest cmake at time of release
 # Test non-default use of mdrun -gpu_id
 # Test newest gcc supported by newest CUDA at time of release
 # Test thread-MPI with CUDA
 # Test SIMD implementation of pair search for GPU code-path
 # Test hwloc-2 support
-gcc-8 gpuhw=nvidia gpu_id=1 cuda-10.1 thread-mpi openmp cmake-3.10.0 release-with-assert simd=avx2_256 hwloc libhwloc-2.0.4
+gcc-8 gpuhw=nvidia gpu_id=1 cuda-10.1 thread-mpi openmp cmake-3.15.1 release-with-assert simd=avx2_256 hwloc libhwloc-2.0.4
 
 # Test with libcxx
 # Test with ThreadSanitizer + OpenMP + SIMD
@@ -50,7 +51,7 @@ clang-3.6 simd=sse2 thread-mpi no-openmp fftpack cmake-3.11.4 tng
 
 # Test newest clang at time of release
 # Test with AddressSanitizer (without OpenMP, see below)
-clang-7 no-openmp asan cmake-3.11.4
+clang-8 no-openmp asan cmake-3.11.4
 
 # Test with clang-tidy (without OpenMP)
 clang-7 no-openmp cmake-3.12.1 tidy
@@ -78,10 +79,9 @@ gcc-6 openmp gpuhw=nvidia opencl-1.2 clFFT-2.14 cmake-3.9.6 mpi no-mpiinplace si
 # Test external clFFT (for build speed)
 # Test newest gcc at time of release
 # Test hwloc-1 support
-gcc-8 openmp simd=avx2_256 gpuhw=amd opencl-1.2 clFFT-2.14 hwloc libhwloc-1.11.2
+gcc-9 openmp simd=avx2_256 gpuhw=amd opencl-1.2 clFFT-2.14 hwloc libhwloc-1.11.2 cmake-3.14.5
 
 # TODO
-# Test newest cmake at time of release
 # Add OpenMP support to ASAN build (but libomp.so in clang-4 reports leaks, so might need a suitable build or suppression)
 # Test newest supported LTS Ubuntu
 # Test AVX-512 when hardware is available
index 2ec302ceb28161ae9d0a865e959f0c26f752b478..61719851f90adcf355f8de617bf6c5d6a491063b 100644 (file)
 
 # Test mpi support
 # Test mdrun-only build
-gcc-6 mpi mdrun-only release cmake-3.9.6
+gcc-9 mpi mdrun-only release cmake-3.9.6
 
 # Test static linking with gcc
 # Test newest gcc at time of release
-gcc-8 static release
+gcc-9 static release
 
 # Test double precision
 # Test with newest supported Intel compiler
@@ -35,7 +35,7 @@ icc-19 double release
 # Test static linking with clang
 # Test double precision
 # Test newest supported clang version
-clang-5 static double release cmake-3.10.0
+clang-8 static double release cmake-3.10.0
 
 # Test oldest supported gcc at time of release
 # Test with GPU support
index 5400fc5f1b9a2f2ffaa00beb9f2effd54af2de39..e99ea66e177c02e513ead4696d720c032543665e 100644 (file)
@@ -110,7 +110,8 @@ endfunction()
 # targets may use the same suppression.
 #
 # This is generally used to suppress warnings judged not worth fixing
-# in code external to, or generated by, GROMACS.
+# in code external to, or generated by, GROMACS, or code that is
+# more efficient to work around and later replace, rather than fix.
 function(gmx_target_warning_suppression TARGET WARNING_FLAG VARNAME)
     check_cxx_compiler_flag(${WARNING_FLAG} ${VARNAME})
     if(${VARNAME})
@@ -118,6 +119,21 @@ function(gmx_target_warning_suppression TARGET WARNING_FLAG VARNAME)
     endif()
 endfunction()
 
+# Add the WARNING_FLAG to the compile flags for SOURCE_FILE if the
+# compiler supports that flag. VARNAME is used to cache the result of
+# the check whether the compiler supports that flag, as multiple
+# targets may use the same suppression.
+#
+# This is generally used to suppress warnings judged not worth fixing
+# in code external to, or generated by, GROMACS, or code that is
+# more efficient to work around and later replace, rather than fix.
+function(gmx_source_file_warning_suppression SOURCE_FILE WARNING_FLAG VARNAME)
+    check_cxx_compiler_flag(${WARNING_FLAG} ${VARNAME})
+    if(${VARNAME})
+        set_source_files_properties(${SOURCE_FILE} PROPERTIES COMPILE_FLAGS ${WARNING_FLAG})
+    endif()
+endfunction()
+
 # This is the actual exported function to be called
 macro (gmx_c_flags)
 
index b4c06781a2581b3e1edd385c104aff7a916e6971..6c7e8344ab2af1b509b0422334705f4a6b45507b 100644 (file)
@@ -59,6 +59,7 @@ if(BUILD_TESTING AND GMX_BUILD_UNITTESTS)
         target_compile_definitions(gtest PRIVATE _SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING)
         target_compile_definitions(gtest_main PRIVATE _SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING)
     endif()
+    gmx_target_warning_suppression(gmock -Wno-deprecated-copy HAVE_NO_DEPRECATED_COPY)
 
     set(GTEST_IS_THREADSAFE "${GTEST_IS_THREADSAFE}" PARENT_SCOPE)
 endif()
index e55714f37be2ec95c7c3980026a3613204e3e0b5..6e76dfa7d023dc0aa8044eb31e2278496e7a98c4 100644 (file)
@@ -210,6 +210,9 @@ if (NOT GMX_BUILD_MDRUN_ONLY)
     add_subdirectory(selection)
 endif()
 
+# Suppress a warning about our abuse of t_inputrec
+gmx_source_file_warning_suppression(mdtypes/inputrec.cpp -Wno-class-memaccess HAS_NO_CLASS_MEMACCESS)
+
 # Handle the object libraries that contain the source file
 # dependencies that need special handling because they are generated
 # or external code.
index d04927349f79bbcf0577c4448a3bf62c9d9d624f..d8bfb95b0bbd1f0f3cfe30faabdc24aacca075ac 100644 (file)
@@ -57,6 +57,8 @@ namespace gmx
 class DensityFittingAmplitudeLookupImpl
 {
     public:
+        DensityFittingAmplitudeLookupImpl() = default;
+        DensityFittingAmplitudeLookupImpl(const DensityFittingAmplitudeLookupImpl &) = default;
         virtual ~DensityFittingAmplitudeLookupImpl() = default;
 
         virtual const std::vector<real> &operator()(const t_mdatoms    &atoms,
@@ -69,7 +71,9 @@ namespace
 class UnitAmplitudes final : public DensityFittingAmplitudeLookupImpl
 {
     public:
-        ~UnitAmplitudes() override = default;
+        UnitAmplitudes() = default;
+        UnitAmplitudes(const UnitAmplitudes &) = default;
+        ~UnitAmplitudes() override             = default;
         std::unique_ptr<DensityFittingAmplitudeLookupImpl> clone() override;
         const std::vector<real> &operator()(const t_mdatoms    &atoms,
                                             ArrayRef<const int> localIndex) override;
@@ -80,9 +84,7 @@ class UnitAmplitudes final : public DensityFittingAmplitudeLookupImpl
 
 std::unique_ptr<DensityFittingAmplitudeLookupImpl> UnitAmplitudes::clone()
 {
-    auto clone = std::make_unique<UnitAmplitudes>();
-    clone->amplitude_ = amplitude_;
-    return std::move(clone);
+    return std::make_unique<UnitAmplitudes>(*this);
 };
 
 const std::vector<real> &UnitAmplitudes::operator()(const t_mdatoms     & /*atoms*/,
@@ -99,7 +101,9 @@ const std::vector<real> &UnitAmplitudes::operator()(const t_mdatoms     & /*atom
 class ChargesAsAmplitudes final : public DensityFittingAmplitudeLookupImpl
 {
     public:
-        ~ChargesAsAmplitudes() override = default;
+        ChargesAsAmplitudes() = default;
+        ChargesAsAmplitudes(const ChargesAsAmplitudes &) = default;
+        ~ChargesAsAmplitudes() override                  = default;
         std::unique_ptr<DensityFittingAmplitudeLookupImpl> clone() override;
         const std::vector<real> &operator()(const t_mdatoms    &atoms,
                                             ArrayRef<const int> localIndex) override;
@@ -110,9 +114,7 @@ class ChargesAsAmplitudes final : public DensityFittingAmplitudeLookupImpl
 
 std::unique_ptr<DensityFittingAmplitudeLookupImpl> ChargesAsAmplitudes::clone()
 {
-    auto clone = std::make_unique<ChargesAsAmplitudes>();
-    clone->amplitude_ = amplitude_;
-    return std::move(clone);
+    return std::make_unique<ChargesAsAmplitudes>(*this);
 };
 
 const std::vector<real> &ChargesAsAmplitudes::operator()(const t_mdatoms    &atoms,
@@ -132,7 +134,9 @@ const std::vector<real> &ChargesAsAmplitudes::operator()(const t_mdatoms    &ato
 class MassesAsAmplitudes final : public DensityFittingAmplitudeLookupImpl
 {
     public:
-        ~MassesAsAmplitudes() override = default;
+        MassesAsAmplitudes() = default;
+        MassesAsAmplitudes(const MassesAsAmplitudes &) = default;
+        ~MassesAsAmplitudes() override                 = default;
         std::unique_ptr<DensityFittingAmplitudeLookupImpl> clone() override;
         const std::vector<real> &operator()(const t_mdatoms    &atoms,
                                             ArrayRef<const int> localIndex) override;
@@ -143,9 +147,7 @@ class MassesAsAmplitudes final : public DensityFittingAmplitudeLookupImpl
 
 std::unique_ptr<DensityFittingAmplitudeLookupImpl> MassesAsAmplitudes::clone()
 {
-    auto clone = std::make_unique<MassesAsAmplitudes>();
-    clone->amplitude_ = amplitude_;
-    return std::move(clone);
+    return std::make_unique<MassesAsAmplitudes>(*this);
 };
 
 const std::vector<real> &MassesAsAmplitudes::operator()(const t_mdatoms    &atoms,
index 0cd58aac881ba6979804d31c573c85ba6e632c4d..8ec5ce80e5f40436a14f44c062527461dc8bbdac 100644 (file)
@@ -1308,6 +1308,7 @@ static void setup_neighbor_relations(gmx_domdec_t *dd)
     }
 
     int nzone  = (1 << dd->ndim);
+    GMX_ASSERT(dd->ndim < DIM, "Invalid number of dimensions");
     int nizone = (1 << std::max(dd->ndim - 1, 0));
     assert(nizone >= 1 && nizone <= DD_MAXIZONE);
 
index eacf0c7db0b8a30ae63c0d6dd40c86b0c2e15bb2..8954364bb040f9e711a4834a2e9b1889ee0af59d 100644 (file)
@@ -470,7 +470,6 @@ int dd_make_local_constraints(gmx_domdec_t *dd, int at_start,
     else
     {
         int t0_set;
-        int thread;
 
         /* Do the constraints, if present, on the first thread.
          * Do the settles on all other threads.
@@ -478,7 +477,7 @@ int dd_make_local_constraints(gmx_domdec_t *dd, int at_start,
         t0_set = ((!at2con_mt.empty() && dc->nthread > 1) ? 1 : 0);
 
 #pragma omp parallel for num_threads(dc->nthread) schedule(static)
-        for (thread = 0; thread < dc->nthread; thread++)
+        for (int thread = 0; thread < dc->nthread; thread++)
         {
             try
             {
@@ -524,7 +523,7 @@ int dd_make_local_constraints(gmx_domdec_t *dd, int at_start,
         }
 
         /* Combine the generate settles and requested indices */
-        for (thread = 1; thread < dc->nthread; thread++)
+        for (int thread = 1; thread < dc->nthread; thread++)
         {
             t_ilist   *ilst;
             int        ia;
index 72578df261400a11abe1c3dbb783cbbb411c5155..4f527afb7057f369eafefd23cd1489efc5c9dea1 100644 (file)
@@ -1734,7 +1734,6 @@ static int make_local_bondeds_excls(gmx_domdec_t *dd,
     int                izone, cg0, cg1;
     real               rc2;
     int                nbonded_local;
-    int                thread;
     gmx_reverse_top_t *rt;
 
     if (dd->reverse_top->bInterCGInteractions)
@@ -1781,7 +1780,7 @@ static int make_local_bondeds_excls(gmx_domdec_t *dd,
 
         const int numThreads = rt->th_work.size();
 #pragma omp parallel for num_threads(numThreads) schedule(static)
-        for (thread = 0; thread < numThreads; thread++)
+        for (int thread = 0; thread < numThreads; thread++)
         {
             try
             {
index bfe2a4d84fcd737bb6c5134eee33645c1adfec1a..11258fd0ad32cefd798f2643c34b0f9a2ecd0b04 100644 (file)
@@ -125,12 +125,10 @@ static void pme_calc_pidx_wrapper(gmx::ArrayRef<const gmx::RVec>  x,
                                   const matrix                    recipbox,
                                   PmeAtomComm                    *atc)
 {
-    int nthread, thread, slab;
-
-    nthread = atc->nthread;
+    int nthread = atc->nthread;
 
 #pragma omp parallel for num_threads(nthread) schedule(static)
-    for (thread = 0; thread < nthread; thread++)
+    for (int thread = 0; thread < nthread; thread++)
     {
         try
         {
@@ -144,9 +142,9 @@ static void pme_calc_pidx_wrapper(gmx::ArrayRef<const gmx::RVec>  x,
     }
     /* Non-parallel reduction, since nslab is small */
 
-    for (thread = 1; thread < nthread; thread++)
+    for (int thread = 1; thread < nthread; thread++)
     {
-        for (slab = 0; slab < atc->nslab; slab++)
+        for (int slab = 0; slab < atc->nslab; slab++)
         {
             atc->count_thread[0][slab] += atc->count_thread[thread][slab];
         }
index 1e944bce10867d32826fd630e05bf73c3dc40df5..23d181367e0eac9ba05916eec9927ede11ede298 100644 (file)
@@ -137,13 +137,12 @@ static void realloc_work(struct pme_solve_work_t *work, int nkx)
 
 void pme_init_all_work(struct pme_solve_work_t **work, int nthread, int nkx)
 {
-    int thread;
     /* Use fft5d, order after FFT is y major, z, x minor */
 
     snew(*work, nthread);
     /* Allocate the work arrays thread local to optimize memory access */
 #pragma omp parallel for num_threads(nthread) schedule(static)
-    for (thread = 0; thread < nthread; thread++)
+    for (int thread = 0; thread < nthread; thread++)
     {
         try
         {
index 82763e799da7bb6152701245ad4331399b468f39..f1ca537d7b5c5acfb84ef72b3ca88338e4f1881a 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2009,2010,2012,2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -146,7 +146,7 @@ static int vmax(const int* a, int s)
 fft5d_plan fft5d_plan_3d(int NG, int MG, int KG, MPI_Comm comm[2], int flags, t_complex** rlin, t_complex** rlout, t_complex** rlout2, t_complex** rlout3, int nthreads, gmx::PinningPolicy realGridAllocationPinningPolicy)
 {
 
-    int        P[2], prank[2], i, t;
+    int        P[2], prank[2], i;
     bool       bMaster;
     int        rNG, rMG, rKG;
     int       *N0 = nullptr, *N1 = nullptr, *M0 = nullptr, *M1 = nullptr, *K0 = nullptr, *K1 = nullptr, *oN0 = nullptr, *oN1 = nullptr, *oM0 = nullptr, *oM1 = nullptr, *oK0 = nullptr, *oK1 = nullptr;
@@ -583,7 +583,7 @@ fft5d_plan fft5d_plan_3d(int NG, int MG, int KG, MPI_Comm comm[2], int flags, t_
            (later is only important to not confuse valgrind)
          */
 #pragma omp parallel for num_threads(nthreads) schedule(static) ordered
-        for (t = 0; t < nthreads; t++)
+        for (int t = 0; t < nthreads; t++)
         {
 #pragma omp ordered
             {
index 82a428a4c088030aa1431e5089ad2810da10fba6..eca6efd29573a2d11a7bc4378f1e3d9519c96de8 100644 (file)
@@ -256,11 +256,12 @@ static gmx_bool lambda_components_check(const lambda_components_t *lc,
     {
         return FALSE;
     }
-    if (name == nullptr && lc->names[index] == nullptr)
+    if ((name == nullptr) && (lc->names[index] == nullptr))
     {
         return TRUE;
     }
-    if ((name == nullptr) != (lc->names[index] == nullptr))
+    if (((name != nullptr) && (lc->names[index] == nullptr)) ||
+        ((name == nullptr) && (lc->names[index] != nullptr)))
     {
         return FALSE;
     }
index 9fa96015cd0d27c8824df92938669262c9254f6b..88803c7cf937795752815451a1df04cc24cbcc48 100644 (file)
@@ -2524,8 +2524,8 @@ int gmx_hbond(int argc, char *argv[])
     matrix                box;
     real                  t, ccut, dist = 0.0, ang = 0.0;
     double                max_nhb, aver_nhb, aver_dist;
-    int                   h = 0, i = 0, j, k = 0, ogrp, nsel;
-    int                   xi, yi, zi, ai;
+    int                   h  = 0, i = 0, j, k = 0, ogrp, nsel;
+    int                   xi = 0, yi, zi, ai;
     int                   xj, yj, zj, aj, xjj, yjj, zjj;
     gmx_bool              bSelected, bHBmap, bStop, bTwo, bBox, bTric;
     int                  *adist, *rdist;
index 2cf1e3581674a1809bf54af7c412f67f51a4f829..cfd3fa127fee091e30ae281503513b1e0d7cf843 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2014,2015,2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015,2017,2018,2019, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -51,7 +51,7 @@ void calc_mu(int start, int homenr, gmx::ArrayRef<gmx::RVec> x, const real q[],
              int nChargePerturbed,
              dvec mu, dvec mu_B)
 {
-    int    i, end, m;
+    int    end, m;
     double mu_x, mu_y, mu_z;
 
     end   = start + homenr;
@@ -59,7 +59,7 @@ void calc_mu(int start, int homenr, gmx::ArrayRef<gmx::RVec> x, const real q[],
     mu_x = mu_y = mu_z = 0.0;
 #pragma omp parallel for reduction(+: mu_x, mu_y, mu_z) schedule(static) \
     num_threads(gmx_omp_nthreads_get(emntDefault))
-    for (i = start; i < end; i++)
+    for (int i = start; i < end; i++)
     {
         // Trivial OpenMP region that cannot throw
         mu_x += q[i]*x[i][XX];
@@ -80,7 +80,7 @@ void calc_mu(int start, int homenr, gmx::ArrayRef<gmx::RVec> x, const real q[],
         mu_x = mu_y = mu_z = 0.0;
 #pragma omp parallel for reduction(+: mu_x, mu_y, mu_z) schedule(static) \
         num_threads(gmx_omp_nthreads_get(emntDefault))
-        for (i = start; i < end; i++)
+        for (int i = start; i < end; i++)
         {
             // Trivial OpenMP region that cannot throw
             mu_x += qB[i]*x[i][XX];
index fe61663bfffb680e34666c494ee5658d23bf3c6d..0101aa7d859707312166772125937dbdba4fa748 100644 (file)
@@ -374,7 +374,7 @@ Constraints::Impl::apply(bool                  bLog,
     int         nsettle;
     t_pbc       pbc, *pbc_null;
     char        buf[22];
-    int         nth, th;
+    int         nth;
 
     wallcycle_start(wcycle, ewcCONSTR);
 
@@ -511,7 +511,7 @@ Constraints::Impl::apply(bool                  bLog,
         {
             case ConstraintVariable::Positions:
 #pragma omp parallel for num_threads(nth) schedule(static)
-                for (th = 0; th < nth; th++)
+                for (int th = 0; th < nth; th++)
                 {
                     try
                     {
@@ -546,7 +546,7 @@ Constraints::Impl::apply(bool                  bLog,
             case ConstraintVariable::Force:
             case ConstraintVariable::ForceDispl:
 #pragma omp parallel for num_threads(nth) schedule(static)
-                for (th = 0; th < nth; th++)
+                for (int th = 0; th < nth; th++)
                 {
                     try
                     {
index c9f1e29d7e0afc68f138201a23d917ace6312ba4..796142c71a3b4973be4fe5468a75d6d32c841b59 100644 (file)
@@ -686,7 +686,7 @@ void berendsen_pscale(const t_inputrec *ir, const matrix mu,
                       t_nrnb *nrnb)
 {
     ivec   *nFreeze = ir->opts.nFreeze;
-    int     n, d;
+    int     d;
     int     nthreads gmx_unused;
 
 #ifndef __clang_analyzer__
@@ -695,7 +695,7 @@ void berendsen_pscale(const t_inputrec *ir, const matrix mu,
 
     /* Scale the positions */
 #pragma omp parallel for num_threads(nthreads) schedule(static)
-    for (n = start; n < start+nr_atoms; n++)
+    for (int n = start; n < start+nr_atoms; n++)
     {
         // Trivial OpenMP region that does not throw
         int g;
index 6b6fbf83f584bb0655475e4e634cc039af1614c4..0796b08076c18161c6acc83e524eae54bb85177a 100644 (file)
@@ -222,8 +222,6 @@ do_force_lowlevel(t_forcerec                               *fr,
             /* Calculate Ewald surface terms, when necessary */
             if (haveEwaldSurfaceTerms)
             {
-                int nthreads, t;
-
                 wallcycle_sub_start(wcycle, ewcsEWALD_CORRECTION);
 
                 if (fr->n_tpi > 0)
@@ -231,9 +229,9 @@ do_force_lowlevel(t_forcerec                               *fr,
                     gmx_fatal(FARGS, "TPI with PME currently only works in a 3D geometry with tin-foil boundary conditions");
                 }
 
-                nthreads = fr->nthread_ewc;
+                int nthreads = fr->nthread_ewc;
 #pragma omp parallel for num_threads(nthreads) schedule(static)
-                for (t = 0; t < nthreads; t++)
+                for (int t = 0; t < nthreads; t++)
                 {
                     try
                     {
index d70d7ad3d5408cbb080e4e0551047932f681cedb..34672750acd07668e12a5be5a68a97ef675dfcf4 100644 (file)
@@ -82,7 +82,6 @@ void init_ekindata(FILE gmx_unused *log, const gmx_mtop_t *mtop, const t_grpopts
                    gmx_ekindata_t *ekind, real cos_accel)
 {
     int i;
-    int nthread, thread;
 
     /* bNEMD tells if we should remove remove the COM velocity
      * from the velocities during velocity scaling in T-coupling.
@@ -104,13 +103,13 @@ void init_ekindata(FILE gmx_unused *log, const gmx_mtop_t *mtop, const t_grpopts
         ekind->tcstat[i].ekinscalef_nhc = 1.0;
     }
 
-    nthread         = gmx_omp_nthreads_get(emntUpdate);
+    int nthread     = gmx_omp_nthreads_get(emntUpdate);
     ekind->nthreads = nthread;
     snew(ekind->ekin_work_alloc, nthread);
     snew(ekind->ekin_work, nthread);
     snew(ekind->dekindl_work, nthread);
 #pragma omp parallel for num_threads(nthread) schedule(static)
-    for (thread = 0; thread < nthread; thread++)
+    for (int thread = 0; thread < nthread; thread++)
     {
         try
         {
index af0eb54ddcc7daae012761a6a50f5cadb767df57..2e76a401ddc3d4b00b3ba49b130a6da2017389a5 100644 (file)
@@ -1037,7 +1037,6 @@ static void calc_ke_part_normal(const rvec v[], const t_grpopts *opts, const t_m
     int                         g;
     gmx::ArrayRef<t_grp_tcstat> tcstat  = ekind->tcstat;
     gmx::ArrayRef<t_grp_acc>    grpstat = ekind->grpstat;
-    int                         nthread, thread;
 
     /* three main: VV with AveVel, vv with AveEkin, leap with AveEkin.  Leap with AveVel is also
        an option, but not supported now.
@@ -1062,10 +1061,10 @@ static void calc_ke_part_normal(const rvec v[], const t_grpopts *opts, const t_m
         }
     }
     ekind->dekindl_old = ekind->dekindl;
-    nthread            = gmx_omp_nthreads_get(emntUpdate);
+    int nthread        = gmx_omp_nthreads_get(emntUpdate);
 
 #pragma omp parallel for num_threads(nthread) schedule(static)
-    for (thread = 0; thread < nthread; thread++)
+    for (int thread = 0; thread < nthread; thread++)
     {
         // This OpenMP only loops over arrays and does not call any functions
         // or memory allocation. It should not be able to throw, so for now
@@ -1125,7 +1124,7 @@ static void calc_ke_part_normal(const rvec v[], const t_grpopts *opts, const t_m
     }
 
     ekind->dekindl = 0;
-    for (thread = 0; thread < nthread; thread++)
+    for (int thread = 0; thread < nthread; thread++)
     {
         for (g = 0; g < opts->ngtc; g++)
         {
@@ -1535,7 +1534,6 @@ update_sd_second_half(int64_t           step,
     }
     if (inputrec->eI == eiSD1)
     {
-        int nth, th;
         int homenr = md->homenr;
 
         /* Cast delta_t from double to real to make the integrators faster.
@@ -1549,10 +1547,10 @@ update_sd_second_half(int64_t           step,
 
         wallcycle_start(wcycle, ewcUPDATE);
 
-        nth = gmx_omp_nthreads_get(emntUpdate);
+        int nth = gmx_omp_nthreads_get(emntUpdate);
 
 #pragma omp parallel for num_threads(nth) schedule(static)
-        for (th = 0; th < nth; th++)
+        for (int th = 0; th < nth; th++)
         {
             try
             {
index 5f7f16aa5f21437e41be6ad9fda12a95c3a3b9d2..6ac3b630703c688f79d3dfef77f9544923a4f239 100644 (file)
@@ -73,6 +73,8 @@ const int nstmin_harmonic          = 20;
 
 t_inputrec::t_inputrec()
 {
+    // TODO When this memset is removed, remove the suppression of
+    // gcc -Wno-class-memaccess in a CMakeLists.txt file.
     std::memset(this, 0, sizeof(*this)); // NOLINT(bugprone-undefined-memory-manipulation)
     snew(fepvals, 1);
     snew(expandedvals, 1);
index 55770da1f97532ecf5fa9ec87b0e645adcb68ee7..ffa41df8800d275ec8fff2bbbf51b7ee27d7e6f4 100644 (file)
@@ -1465,10 +1465,8 @@ void put_atoms_in_box(int ePBC, const matrix box, gmx::ArrayRef<gmx::RVec> x)
 
 void put_atoms_in_box_omp(int ePBC, const matrix box, gmx::ArrayRef<gmx::RVec> x, gmx_unused int nth)
 {
-    int t;
-
 #pragma omp parallel for num_threads(nth) schedule(static)
-    for (t = 0; t < nth; t++)
+    for (int t = 0; t < nth; t++)
     {
         try
         {
index c99411c744e9048f11e3e16d5e9908a89e619ce9..b7d161f80d0987dee066bc9c1509db174e0eea18 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -811,7 +811,7 @@ HelpTopicPointer createSelectionHelpTopic()
     root->registerSubTopic<SimpleHelpTopic<EvaluationHelpText> >();
     root->registerSubTopic<SimpleHelpTopic<LimitationsHelpText> >();
     root->registerSubTopic<SimpleHelpTopic<ExamplesHelpText> >();
-    return std::move(root);
+    return HelpTopicPointer(root.release());
 }
 //! \endcond
 
index 8aecaaa4aea17244e6a1876d95802e658a8a0c94..b2a456481b1f9298db3ce4241882df2093bfa670 100644 (file)
@@ -628,12 +628,11 @@ gmx_ana_selmethod_register_defaults(gmx::SelectionParserSymbolTable *symtab)
         {nullptr,         &sm_permute},
     };
 
-    size_t                  i;
     int                     rc;
     bool                    bOk;
 
     bOk = true;
-    for (i = 0; i < asize(smtable_def); ++i)
+    for (int i = 0; i < asize(smtable_def); ++i)
     {
         gmx_ana_selmethod_t *method = smtable_def[i].method;
 
index 1cbc5df4794de7171d0f4f8f3452782735c5ecdc..0d4e5b48dc57d58bbc4bde88def9a9f7c7f8f8f0 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2017, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2017,2019, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -190,7 +190,7 @@ SelectionParserSymbolTable::Impl::addReservedSymbols()
         "off"
     };
 
-    for (size_t i = 0; i < asize(sym_reserved); ++i)
+    for (int i = 0; i < asize(sym_reserved); ++i)
     {
         SymbolPointer sym(new SelectionParserSymbol(
                                   new SelectionParserSymbol::Impl(
index 5cfd06a019aeab682752a50a560db6933a7969e4..f7405352681081690639424994ff142cdd4ee92e 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -169,7 +169,7 @@ void printCopyright(gmx::TextWriter *writer)
             const int width = 18;
             char      buf[30];
             const int offset = centeringOffset(width, strlen(Contributors[i]));
-            GMX_RELEASE_ASSERT(strlen(Contributors[i]) + offset < asize(buf),
+            GMX_RELEASE_ASSERT(static_cast<int>(strlen(Contributors[i])) + offset < asize(buf),
                                "Formatting buffer is not long enough");
             std::fill(buf, buf+width, ' ');
             std::strcpy(buf+offset, Contributors[i]);
index 4005555dc194543c8ad6dbb0ee639e958efc922c..1d3c4b506507f9075cd945c5120ed1b3920fd3fe 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2013, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2019, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -416,10 +416,9 @@ void init_dlgs(t_x11 *x11, t_gmx *gmx)
         { "bonds.dlg",    BondsCB  }
     };
     static t_mmb *mi[emNR] = { quit_mb,    help_mb,    about_mb,   ni_mb };
-    unsigned int i;
 
     snew(gmx->dlgs, edNR);
-    for (i = 0; (i < asize(di)); i++)
+    for (int i = 0; (i < asize(di)); i++)
     {
         gmx->dlgs[i] = ReadDlg(x11, gmx->wd->self, di[i].dlgfile,
                                di[i].dlgfile,
@@ -429,7 +428,7 @@ void init_dlgs(t_x11 *x11, t_gmx *gmx)
     gmx->dlgs[edFilter] = select_filter(x11, gmx);
 
     snew(gmx->mboxes, emNR);
-    for (i = 0; (i < emNR); i++)
+    for (int i = 0; (i < emNR); i++)
     {
         gmx->mboxes[i] = mi[i](x11, gmx);
     }
index bb397e2af699eefc549285a184e78ba7d8a0307b..c385d1ec097eedf3390aa66f2064e3ffb839d10e 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2013, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2019, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -192,7 +192,7 @@ t_logo *init_logo(t_x11 *x11, Window parent, bool bQuitOnClick)
         "fixed"
     };
 #define NSF asize(sfname)
-    unsigned int       i;
+    int                i;
     unsigned long      bg;
     char              *newcol;
     t_logo            *logo;
index f9920c2d470604c6ea2230660b6a9d132ada4826..1cf4de0d1e5553628eecc59c72214b7b095486a0 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2013, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2019, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -70,13 +70,13 @@ static t_atomcolor ac[] = {
 
 static int search_ac(const char *type)
 {
-    unsigned int i, nb, mij, best, besti;
+    unsigned int nb, mij, best, besti;
 
     best  = 0;
     besti = 0;
     if (nullptr != type)
     {
-        for (i = 0; (i < NAC); i++)
+        for (int i = 0; (i < NAC); i++)
         {
             mij = std::min(static_cast<int>(std::strlen(type)), static_cast<int>(std::strlen(ac[i].tp)));
             for (nb = 0; (nb < mij); nb++)