Enable more warnings for Clang 6
authorRoland Schulz <roland.schulz@intel.com>
Sun, 1 Jul 2018 21:24:36 +0000 (14:24 -0700)
committerRoland Schulz <roland.schulz@intel.com>
Wed, 4 Jul 2018 16:11:21 +0000 (18:11 +0200)
Many useful clang warnings are not enabled with -Wall -Wextra.
Enable all with -Weverything and document which are disabled
for what reason. Only do this for the most recent released
version to avoid having false postives from multiple
versions.

Fix the 9 of the least common issued warnings:
class-varargs range-loop-analysis
unused-template implicit-fallthrough non-virtual-dtor
zero-as-null-pointer-constant
header-hygiene unused-member-function missing-noreturn

Change-Id: I70df6553aa715cbd99963dd66d4b4bbd55ffc64d

38 files changed:
cmake/gmxCFlags.cmake
src/gromacs/CMakeLists.txt
src/gromacs/applied-forces/electricfield.cpp
src/gromacs/domdec/domdec.cpp
src/gromacs/domdec/domdec.h
src/gromacs/domdec/redistribute.cpp
src/gromacs/ewald/pme-simd4.h
src/gromacs/ewald/pme-spline-work.h
src/gromacs/ewald/pme.cpp
src/gromacs/fileio/checkpoint.cpp
src/gromacs/fileio/gmxfio-xdr.cpp
src/gromacs/fileio/trxio.cpp
src/gromacs/gmxana/gmx_bar.cpp
src/gromacs/gmxlib/network.h
src/gromacs/gmxpreprocess/insert-molecules.cpp
src/gromacs/gpu_utils/gpu_utils.h
src/gromacs/mdlib/broadcaststructs.h
src/gromacs/mdlib/constr.h
src/gromacs/mdlib/nbnxn_internal.h
src/gromacs/mdlib/nbnxn_kernels/simd_2xnn/nbnxn_kernel_simd_2xnn_common.h
src/gromacs/mdlib/nbnxn_kernels/simd_2xnn/nbnxn_kernel_simd_2xnn_outer.h
src/gromacs/mdlib/nbnxn_kernels/simd_2xnn/nbnxn_kernel_simd_2xnn_prune.cpp
src/gromacs/mdlib/nbnxn_kernels/simd_4xn/nbnxn_kernel_simd_4xn_common.h
src/gromacs/mdlib/nbnxn_kernels/simd_4xn/nbnxn_kernel_simd_4xn_outer.h
src/gromacs/mdlib/nbnxn_kernels/simd_4xn/nbnxn_kernel_simd_4xn_prune.cpp
src/gromacs/mdlib/nbnxn_search.cpp
src/gromacs/mdlib/nbnxn_search_simd_2xnn.h
src/gromacs/mdlib/nbnxn_search_simd_4xn.h
src/gromacs/mdlib/qmmm.cpp
src/gromacs/mdlib/sim_util.cpp
src/gromacs/mdlib/wall.cpp
src/gromacs/options/abstractsection.h
src/gromacs/pbcutil/pbc-simd.h
src/gromacs/selection/sm_position.cpp
src/gromacs/utility/arrayref.h
src/gromacs/utility/ikeyvaluetreeerror.h
src/gromacs/utility/keyvaluetreeserializer.cpp
src/gromacs/utility/path.h

index bfe3146c56653e461113aad27ce97db590ab32b5..0b375b20d1a683d16b2545232827d8bdbe10680e 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, by the GROMACS development team, led by
+# Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018, 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.
@@ -129,6 +129,9 @@ macro (gmx_c_flags)
         if(NOT GMX_OPENMP)
             GMX_TEST_CXXFLAG(CXXFLAGS_PRAGMA "-Wno-unknown-pragmas" GMXC_CXXFLAGS)
         endif()
+        if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "7.0.0")
+            GMX_TEST_CXXFLAG(CXXFLAGS_ATTRIBUTE "-Wno-attributes" GMXC_CXXFLAGS)
+        endif()
         if (GMX_COMPILER_WARNINGS)
             GMX_TEST_CXXFLAG(CXXFLAGS_WARN "-Wall" GMXC_CXXFLAGS)
             # Problematic with CUDA
@@ -194,6 +197,7 @@ GMX_TEST_CFLAG(CFLAGS_WARN "/W3 /wd177 /wd411 /wd593 /wd981 /wd1418 /wd1419 /wd1
             if(NOT GMX_OPENMP)
                 GMX_TEST_CXXFLAG(CXXFLAGS_PRAGMA "-wd3180" GMXC_CXXFLAGS)
             endif()
+            GMX_TEST_CXXFLAG(CXXFLAGS_ATTRIBUTE "-Wno-attributes" GMXC_CXXFLAGS)
             if (GMX_COMPILER_WARNINGS)
                 if (GMX_GPU)
 # Suppress warnings from CUDA headers
@@ -290,11 +294,13 @@ GMX_TEST_CFLAG(CFLAGS_WARN "/W3 /wd177 /wd411 /wd593 /wd981 /wd1418 /wd1419 /wd1
         #      unreferenced local variable (only C)
         #      conversion from 'size_t' to 'int', possible loss of data
         #      conversion from 'const char*' to 'void*', different 'const' qualifiers (only C)
+        #      attributes are ignored in this context
+        #      attribute '' is not recognized
         if(NOT CMAKE_CONFIGURATION_TYPES)
             GMX_TEST_CFLAG(CFLAGS_WARN "/wd4800 /wd4355 /wd4996 /wd4305 /wd4244 /wd4101 /wd4267 /wd4090" GMXC_CFLAGS)
-            GMX_TEST_CXXFLAG(CXXFLAGS_WARN "/wd4800 /wd4355 /wd4996 /wd4305 /wd4244 /wd4267" GMXC_CXXFLAGS)
+            GMX_TEST_CXXFLAG(CXXFLAGS_WARN "/wd4800 /wd4355 /wd4996 /wd4305 /wd4244 /wd4267 /wd5030 /wd4649" GMXC_CXXFLAGS)
         else() #Projects only use the C++ flags
-            GMX_TEST_CXXFLAG(CXXFLAGS_WARN "/wd4800 /wd4355 /wd4996 /wd4305 /wd4244 /wd4101 /wd4267 /wd4090" GMXC_CXXFLAGS)
+            GMX_TEST_CXXFLAG(CXXFLAGS_WARN "/wd4800 /wd4355 /wd4996 /wd4305 /wd4244 /wd4101 /wd4267 /wd4090 /wd5030 /wd4649" GMXC_CXXFLAGS)
         endif()
     endif()
 
@@ -309,6 +315,9 @@ GMX_TEST_CFLAG(CFLAGS_WARN "/W3 /wd177 /wd411 /wd593 /wd981 /wd1418 /wd1419 /wd1
     endif()
 
     if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+        if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.9.0")
+            GMX_TEST_CXXFLAG(CXXFLAGS_ATTRIBUTE "-Wno-attributes" GMXC_CXXFLAGS)
+        endif()
         if(NOT GMX_OPENMP)
             GMX_TEST_CXXFLAG(CXXFLAGS_PRAGMA "-Wno-unknown-pragmas" GMXC_CXXFLAGS)
         endif()
index d96d895b102fa38bfa8e4aefd44e57e6909a769e..5d87ea3b260ae84a3778fcf7c74f17689dc22e45 100644 (file)
@@ -267,6 +267,48 @@ set_target_properties(libgromacs PROPERTIES
 gmx_manage_lmfit()
 target_link_libraries(libgromacs PRIVATE lmfit)
 
+set(IGNORED_CLANG_ALL_WARNINGS
+    "-Wno-c++98-compat -Wno-c++98-compat-pedantic" #No intention of C++98 compability
+    "-Wno-source-uses-openmp" #Don't warn for no-omp build
+    "-Wno-c++17-extensions"   #Allowed in attributes (compilers are required to ignore unknown attributes)
+    "-Wno-documentation-unknown-command" #Custom commands are used
+    #Following ones are undecided/TODO
+    "-Wno-missing-field-initializers"
+    "-Wno-sign-conversion"
+    "-Wno-disabled-macro-expansion"
+    "-Wno-cast-align"
+    "-Wno-undefined-reinterpret-cast"
+    "-Wno-covered-switch-default"
+    "-Wno-reserved-id-macro"
+    "-Wno-global-constructors"
+    "-Wno-unreachable-code"
+    "-Wno-comma"
+    "-Wno-unreachable-code-return"
+    "-Wno-exit-time-destructors"
+    "-Wno-unused-macros"
+    "-Wno-weak-vtables"
+    "-Wno-extra-semi"
+    "-Wno-switch-enum"
+    "-Wno-shadow-field-in-constructor"
+    "-Wno-unreachable-code-break"
+    "-Wno-conditional-uninitialized"
+    "-Wno-missing-variable-declarations"
+    "-Wno-float-conversion"
+    "-Wno-format-nonliteral"
+    "-Wno-shadow"
+    "-Wno-cast-qual"
+    "-Wno-shorten-64-to-32"
+    "-Wno-documentation"
+    "-Wno-used-but-marked-unused"
+    "-Wno-padded"
+    "-Wno-float-equal"
+    "-Wno-old-style-cast"
+    "-Wno-conversion"
+    "-Wno-double-promotion")
+string(REPLACE " " ";" IGNORED_CLANG_ALL_WARNINGS "${IGNORED_CLANG_ALL_WARNINGS}")
+if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION MATCHES "^6\.0")
+   target_compile_options(libgromacs PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-Weverything ${IGNORED_CLANG_ALL_WARNINGS}>)
+endif()
 if (GMX_CLANG_TIDY)
    set(CLANG_TIDY "clang-tidy" CACHE STRING "Name of clang-tidy executable")
    find_program(CLANG_TIDY_EXE NAMES "${CLANG_TIDY}"
index 6c110ad9b7483c5d570841e095cb5d0ddb891f77..730aa55c432f63d8ff4a64d77175e3ced92d529c 100644 (file)
@@ -122,29 +122,8 @@ class ElectricFieldData
             }
         }
 
-        /*! \brief Initiate the field values
-         *
-         * \param[in] a     Amplitude
-         * \param[in] omega Frequency
-         * \param[in] t0    Peak of the pulse
-         * \param[in] sigma Width of the pulse
-         */
-        void setField(real a, real omega, real t0, real sigma)
-        {
-            a_     = a;
-            omega_ = omega;
-            t0_    = t0;
-            sigma_ = sigma;
-        }
-
         //! Return the amplitude
         real a()     const { return a_; }
-        //! Return the frequency
-        real omega() const { return omega_; }
-        //! Return the time for the peak of the pulse
-        real t0()    const { return t0_; }
-        //! Return the width of the pulse (0 means inifinite)
-        real sigma() const { return sigma_; }
 
     private:
         //! Coeffient (V / nm)
@@ -209,31 +188,6 @@ class ElectricField final : public IMDModule,
          */
         real field(int dim, real t) const;
 
-        /*! \brief Return amplitude of field
-         *
-         * \param[in] dim Direction of the field (XX, YY, ZZ)
-         * \return Amplitude of the field
-         */
-        real a(int dim)     const { return efield_[dim].a(); }
-        /*! \brief Return frequency of field (1/ps)
-         *
-         * \param[in] dim Direction of the field (XX, YY, ZZ)
-         * \return Frequency of the field
-         */
-        real omega(int dim) const { return efield_[dim].omega(); }
-        /*! \brief Return time of pulse peak
-         *
-         * \param[in] dim Direction of the field (XX, YY, ZZ)
-         * \return Time of pulse peak
-         */
-        real t0(int dim) const { return efield_[dim].t0(); }
-        /*! \brief Return width of the pulse
-         *
-         * \param[in] dim Direction of the field (XX, YY, ZZ)
-         * \return Width of the pulse
-         */
-        real sigma(int dim) const { return efield_[dim].sigma(); }
-
         /*! \brief Print the field components to a file
          *
          * \param[in] t   The time
index 5fd8b1a98e410a5e581167723d53ce9f43fc5768..4f5590d5509c551680c321dd4b4839fd7a1799b4 100644 (file)
@@ -354,7 +354,7 @@ void dd_move_x(gmx_domdec_t             *dd,
 
     comm = dd->comm;
 
-    const RangePartitioning &atomGrouping = dd->atomGrouping();
+    const gmx::RangePartitioning &atomGrouping = dd->atomGrouping();
 
     nzone   = 1;
     nat_tot = comm->atomRanges.numHomeAtoms();
@@ -467,7 +467,7 @@ void dd_move_f(gmx_domdec_t             *dd,
 
     comm = dd->comm;
 
-    const RangePartitioning &atomGrouping = dd->atomGrouping();
+    const gmx::RangePartitioning &atomGrouping = dd->atomGrouping();
 
     nzone   = comm->zones.n/2;
     nat_tot = comm->atomRanges.end(DDAtomRanges::Type::Zones);
@@ -605,7 +605,7 @@ void dd_atom_spread_real(gmx_domdec_t *dd, real v[])
 
     comm = dd->comm;
 
-    const RangePartitioning &atomGrouping = dd->atomGrouping();
+    const gmx::RangePartitioning &atomGrouping = dd->atomGrouping();
 
     nzone   = 1;
     nat_tot = comm->atomRanges.numHomeAtoms();
@@ -3560,8 +3560,8 @@ static void set_dd_limits_and_grid(FILE *fplog, t_commrec *cr, gmx_domdec_t *dd,
         comm->bInterCGMultiBody = FALSE;
     }
 
-    dd->bInterCGcons    = inter_charge_group_constraints(*mtop);
-    dd->bInterCGsettles = inter_charge_group_settles(*mtop);
+    dd->bInterCGcons    = gmx::inter_charge_group_constraints(*mtop);
+    dd->bInterCGsettles = gmx::inter_charge_group_settles(*mtop);
 
     if (ir->rlist == 0)
     {
@@ -3663,7 +3663,7 @@ static void set_dd_limits_and_grid(FILE *fplog, t_commrec *cr, gmx_domdec_t *dd,
     if (dd->bInterCGcons && options.constraintCommunicationRange <= 0)
     {
         /* There is a cell size limit due to the constraints (P-LINCS) */
-        rconstr = constr_r_max(fplog, mtop, ir);
+        rconstr = gmx::constr_r_max(fplog, mtop, ir);
         if (fplog)
         {
             fprintf(fplog,
@@ -4726,10 +4726,10 @@ static void merge_cg_buffers(int ncell,
     }
 }
 
-static void make_cell2at_index(gmx_domdec_comm_dim_t   *cd,
-                               int                      nzone,
-                               int                      atomGroupStart,
-                               const RangePartitioning &atomGroups)
+static void make_cell2at_index(gmx_domdec_comm_dim_t        *cd,
+                               int                           nzone,
+                               int                           atomGroupStart,
+                               const gmx::RangePartitioning &atomGroups)
 {
     /* Store the atom block boundaries for easy copying of communication buffers
      */
index 83120c9280c2f860fe9fa54f9cf81a6dabae0615..81119976717b82f02367eecf1b208460c4af569a 100644 (file)
@@ -388,6 +388,7 @@ gmx::ArrayRef<const int> dd_constraints_nlocalatoms(const gmx_domdec_t *dd);
 /* In domdec_top.c */
 
 /*! \brief Print error output when interactions are missing */
+[[ noreturn ]]
 void dd_print_missing_interactions(FILE *fplog, struct t_commrec *cr,
                                    int local_count,
                                    const gmx_mtop_t *top_global,
index ae83ec4d79a67c90cab26cdd6e88ab6f7a429bfc..a5c47e079732c556bbc2b45d9128fb447be01678 100644 (file)
@@ -273,6 +273,7 @@ static void print_cg_move(FILE *fplog,
             comm->cell_x0[dim], comm->cell_x1[dim]);
 }
 
+[[ noreturn ]]
 static void cg_move_error(FILE *fplog,
                           gmx_domdec_t *dd,
                           gmx_int64_t step, int cg, int dim, int dir,
index 7500db7cde465ed15283543c7a232c25435bc741..d1d40bd825abe9e5fab341d6ad74f6d892be552b 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,2013,2014,2015,2017, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2017,2018, 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.
@@ -45,6 +45,7 @@
  * This code does not assume any memory alignment for the grid.
  */
 {
+    using namespace gmx;
     Simd4Real ty_S0(thy[0]);
     Simd4Real ty_S1(thy[1]);
     Simd4Real ty_S2(thy[2]);
@@ -93,6 +94,7 @@
  * This code supports pme_order <= 5.
  */
 {
+    using namespace gmx;
     int              offset;
     int              index;
     Simd4Real        ty_S0(thy[0]);
index ae1297c5f69a58003c774fd9e2d28bb66628a1cb..6e77f6cdf01464c68c1583ea8a7c8a5a8c0e6941 100644 (file)
 
 #include "pme-simd.h"
 
-using namespace gmx; // TODO: Remove when this file is moved into gmx namespace
-
 struct pme_spline_work
 {
 #ifdef PME_SIMD4_SPREAD_GATHER
     /* Masks for 4-wide SIMD aligned spreading and gathering */
-    Simd4Bool        mask_S0[6], mask_S1[6];
+    gmx::Simd4Bool        mask_S0[6], mask_S1[6];
 #else
-    int              dummy; /* C89 requires that struct has at least one member */
+    int                   dummy; /* C89 requires that struct has at least one member */
 #endif
 };
 
index 0bd225d7dfe92787bbac0328ea7d4151344f16f6..369cb251b971c4a3e6282ce338371b60abba6032 100644 (file)
@@ -568,7 +568,7 @@ bool gmx_pme_check_restrictions(int pme_order,
         std::string message = gmx::formatString(
                     "pme_order (%d) is larger than the maximum allowed value (%d). Modify and recompile the code if you really need such a high order.",
                     pme_order, PME_ORDER_MAX);
-        GMX_THROW(InconsistentInputError(message));
+        GMX_THROW(gmx::InconsistentInputError(message));
     }
 
     const int minGridSize = minimalPmeGridSize(pme_order);
@@ -583,7 +583,7 @@ bool gmx_pme_check_restrictions(int pme_order,
         std::string message = gmx::formatString(
                     "The PME grid sizes need to be >= 2*(pme_order-1) (%d)",
                     minGridSize);
-        GMX_THROW(InconsistentInputError(message));
+        GMX_THROW(gmx::InconsistentInputError(message));
     }
 
     /* Check for a limitation of the (current) sum_fftgrid_dd code.
@@ -633,7 +633,7 @@ gmx_pme_t *gmx_pme_init(const t_commrec     *cr,
         fprintf(debug, "Creating PME data structures.\n");
     }
 
-    unique_cptr<gmx_pme_t, gmx_pme_destroy> pme(new gmx_pme_t());
+    gmx::unique_cptr<gmx_pme_t, gmx_pme_destroy> pme(new gmx_pme_t());
 
     pme->sum_qgrid_tmp       = nullptr;
     pme->sum_qgrid_dd_tmp    = nullptr;
index 8bf2c5e8dd6f9514afe0521cc16055b424e3a8ff..22eb8fc9835998983ccb964c04148df6d9268d17 100644 (file)
@@ -226,7 +226,7 @@ static void cp_warning(FILE *fp)
     fprintf(fp, "\nWARNING: Checkpoint file is corrupted or truncated\n\n");
 }
 
-static void cp_error()
+[[ noreturn ]] static void cp_error()
 {
     gmx_fatal(FARGS, "Checkpoint file corrupted/truncated, or maybe you are out of disk space?");
 }
index a9f4253050f98403c668c79885ec991426c00a3b..84ed0ffb517d551a663a8f0509b11db197df2586 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, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018, 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.
@@ -92,6 +92,7 @@ static void gmx_fio_check_nitem(int eio, int nitem, const char *file, int line)
 }
 
 /* output a data type error. */
+[[ noreturn ]]
 static void gmx_fio_fe(t_fileio *fio, int eio, const char *desc,
                        const char *srcfile, int line)
 {
index 3c548f54be6d636610b6897b3c2891845ea47ef8..d23b22747a008d32195301fa0add0dec28c20275 100644 (file)
@@ -382,7 +382,7 @@ int write_trxframe_indexed(t_trxstatus *status, const t_trxframe *fr, int nind,
                     copy_rvec(fr->f[ind[i]], fout[i]);
                 }
             }
-        // fallthrough
+            [[fallthrough]];
         case efXTC:
             if (fr->bX)
             {
@@ -452,7 +452,7 @@ int write_trxframe_indexed(t_trxstatus *status, const t_trxframe *fr, int nind,
             {
                 sfree(fout);
             }
-        // fallthrough
+            [[fallthrough]];
         case efXTC:
             sfree(xout);
             break;
index 6c1d7f6ac2ee2bb3549e6e3de5b246006dbce057..6c8b87c6eab6a0923f85092edb4095ff38d0eec2 100644 (file)
@@ -3168,7 +3168,8 @@ static void read_barsim_edr(const char *fn, real *temp, sim_data_t *sd)
     snew(fr, 1);
 
     snew(native_lambda, 1);
-    start_lambda.lc = nullptr;
+    start_lambda.lc  = nullptr;
+    start_lambda.val = nullptr;
 
     while (do_enx(fp, fr))
     {
@@ -3320,7 +3321,7 @@ static void read_barsim_edr(const char *fn, real *temp, sim_data_t *sd)
             if (!lambda_vec_same(&start_lambda, native_lambda) )
             {
                 gmx_fatal(FARGS, "Native lambda not constant in file %s: started at %f, and becomes %f at time %f",
-                          fn, native_lambda, start_lambda, start_time);
+                          fn, native_lambda->val, start_lambda.val, start_time);
             }
             /* check the number of samples against the previous number */
             if ( ((nblocks_raw+nblocks_hist) != nsamples) || (nlam != 1 ) )
index e690525d68760ecfab263fc68b236b3e1f45c178..c668c37d17b013590a3309e6f2d16bca456a5ea6 100644 (file)
@@ -116,7 +116,7 @@ const char *opt2fn_master(const char *opt, int nfile,
 /* Return the filename belonging to cmd-line option opt, or NULL when
  * no such option or not running on master */
 
-void
+[[ noreturn ]] void
 gmx_fatal_collective(int f_errno, const char *file, int line,
                      MPI_Comm comm, gmx_bool bMaster,
                      const char *fmt, ...);
index 19af47de76168bb24e0cb3b7df624f121f144542..dba2916cc8efa72d9d903805236f50a21f5acf86 100644 (file)
@@ -350,8 +350,6 @@ class InsertMolecules : public ICommandLineOptionsModule, public ITopologyProvid
         virtual int run();
 
     private:
-        void loadSolute();
-
         SelectionCollection selections_;
 
         std::string         inputConfFile_;
index 35921e84465d9eb13f45da387b6fe26eaa6927d9..c4d15153cb43cc4f3c2cb498646523cc8f1f1d3e 100644 (file)
@@ -176,7 +176,7 @@ void free_gpu(const gmx_device_info_t *CUDA_FUNC_ARGUMENT(deviceInfo)) CUDA_FUNC
  */
 GPU_FUNC_QUALIFIER
 gmx_device_info_t *getDeviceInfo(const gmx_gpu_info_t &GPU_FUNC_ARGUMENT(gpu_info),
-                                 int GPU_FUNC_ARGUMENT(deviceId)) GPU_FUNC_TERM_WITH_RETURN(NULL)
+                                 int GPU_FUNC_ARGUMENT(deviceId)) GPU_FUNC_TERM_WITH_RETURN(nullptr)
 
 /*! \brief Returns the device ID of the CUDA GPU currently in use.
  *
index fa5503ed37fccee6c75d9e4261d3ffc3ea1d451e..65a1f3d4bd4cb4437e8ccf71fe4439f66e6de9f3 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2016, by the GROMACS development team, led by
+ * Copyright (c) 2016,2018, 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.
@@ -74,14 +74,14 @@ void snew_bc(const t_commrec *cr, T * &data, int numElements)
 }
 //! Convenience wrapper for gmx_bcast of a C-style array which needs allocation on non-master ranks.
 template <typename T>
-static void nblock_abc(const t_commrec *cr, int numElements, T **v)
+void nblock_abc(const t_commrec *cr, int numElements, T **v)
 {
     snew_bc(cr, v, numElements);
     nblock_bc(cr, numElements, *v);
 }
 //! Convenience wrapper for gmx_bcast of a std::vector which needs resizing on non-master ranks.
 template <typename T>
-static void nblock_abc(const t_commrec *cr, int numElements, std::vector<T> *v)
+void nblock_abc(const t_commrec *cr, int numElements, std::vector<T> *v)
 {
     if (!MASTER(cr))
     {
index 9cb5efbe9cd286679406579cb42657bdaca7a03c..389be723b4ceedc854d8050bcfead2f531a47a1c 100644 (file)
@@ -195,7 +195,7 @@ class Constraints
 };
 
 /*! \brief Generate a fatal error because of too many LINCS/SETTLE warnings. */
-void too_many_constraint_warnings(int eConstrAlg, int warncount);
+[[ noreturn ]] void too_many_constraint_warnings(int eConstrAlg, int warncount);
 
 /*! \brief Returns whether constraint with parameter \p iparamsIndex is a flexible constraint */
 static inline bool isConstraintFlexible(const t_iparams *iparams,
index c8815f8091ab8a20e8d4d3d2ef7fffd3dfad28a5..a9ac48efb85657e1e0de808228d743d04667ae50 100644 (file)
@@ -48,8 +48,6 @@
 #include "gromacs/utility/arrayref.h"
 #include "gromacs/utility/real.h"
 
-using namespace gmx; // TODO: Remove when this file is moved into gmx namespace
-
 struct gmx_domdec_zones_t;
 
 
@@ -179,12 +177,12 @@ struct nbnxn_grid_t
     std::vector<int> nsubc;         /* The number of sub cells for each super cell */
 
     /* Bounding boxes */
-    std::vector<float>                                    bbcz;           /* Bounding boxes in z for the cells */
-    std::vector < nbnxn_bb_t, AlignedAllocator < nbnxn_bb_t>> bb;         /* 3D bounding boxes for the sub cells */
-    std::vector < nbnxn_bb_t, AlignedAllocator < nbnxn_bb_t>> bbjStorage; /* 3D j-bounding boxes for the case where
-                                                                           * the i- and j-cluster sizes are different */
-    gmx::ArrayRef<nbnxn_bb_t>                              bbj;           /* 3D j-bounding boxes */
-    std::vector < float, AlignedAllocator < float>>            pbb;       /* 3D b. boxes in xxxx format per super cell   */
+    std::vector<float>                                    bbcz;                /* Bounding boxes in z for the cells */
+    std::vector < nbnxn_bb_t, gmx::AlignedAllocator < nbnxn_bb_t>> bb;         /* 3D bounding boxes for the sub cells */
+    std::vector < nbnxn_bb_t, gmx::AlignedAllocator < nbnxn_bb_t>> bbjStorage; /* 3D j-bounding boxes for the case where
+                                                                                * the i- and j-cluster sizes are different */
+    gmx::ArrayRef<nbnxn_bb_t>                              bbj;                /* 3D j-bounding boxes */
+    std::vector < float, gmx::AlignedAllocator < float>>            pbb;       /* 3D b. boxes in xxxx format per super cell   */
 
     /* Bit-flag information */
     std::vector<int>          flags;     /* Flags for properties of clusters in each cell */
index 5baf7f1aedec70a1575823f137734a7674b752b8..f02e5a40765d6ae48c466e94088e6ae9a6806c5c 100644 (file)
@@ -57,9 +57,6 @@
 /* The stride of all the atom data arrays is equal to half the SIMD width */
 #define STRIDE     UNROLLJ
 
-// TODO: Remove when all kernels are in the gmx namespace
-using namespace gmx;
-
 #if !defined GMX_NBNXN_SIMD_2XNN && !defined GMX_NBNXN_SIMD_4XN
 #error "Must define an NBNxN kernel flavour before including NBNxN kernel utility functions"
 #endif
@@ -74,7 +71,7 @@ using namespace gmx;
  * a single SIMD register.
  */
 static inline void
-add_ener_grp_halves(SimdReal e_S, real *v0, real *v1, const int *offset_jj)
+add_ener_grp_halves(gmx::SimdReal e_S, real *v0, real *v1, const int *offset_jj)
 {
     for (int jj = 0; jj < (UNROLLJ/2); jj++)
     {
@@ -85,9 +82,9 @@ add_ener_grp_halves(SimdReal e_S, real *v0, real *v1, const int *offset_jj)
 #endif
 
 #if GMX_SIMD_HAVE_INT32_LOGICAL
-typedef SimdInt32    SimdBitMask;
+typedef gmx::SimdInt32    SimdBitMask;
 #else
-typedef SimdReal     SimdBitMask;
+typedef gmx::SimdReal     SimdBitMask;
 #endif
 
 
@@ -95,9 +92,10 @@ static inline void gmx_simdcall
 gmx_load_simd_2xnn_interactions(int                  excl,
                                 SimdBitMask          filter_S0,
                                 SimdBitMask          filter_S2,
-                                SimdBool            *interact_S0,
-                                SimdBool            *interact_S2)
+                                gmx::SimdBool       *interact_S0,
+                                gmx::SimdBool       *interact_S2)
 {
+    using namespace gmx;
 #if GMX_SIMD_HAVE_INT32_LOGICAL
     SimdInt32 mask_pr_S(excl);
     *interact_S0  = cvtIB2B( testBits( mask_pr_S & filter_S0 ) );
index ae56ddbf3be5fe52547f4e42283473c9b05f9efa..1d0aa52aa05600a00d35e426dd4ef65714bbaddb 100644 (file)
@@ -35,6 +35,7 @@
 
 
 {
+    using namespace gmx;
     const nbnxn_ci_t   *nbln;
     const nbnxn_cj_t   *l_cj;
     const real         *q;
 #elif !defined LJ_COMB_LB && !defined FIX_LJ_C
         const real *nbfp0     = nbfp_ptr + type[sci  ]*nbat->ntype*c_simdBestPairAlignment;
         const real *nbfp1     = nbfp_ptr + type[sci+1]*nbat->ntype*c_simdBestPairAlignment;
-        const real *nbfp2     = NULL, *nbfp3 = NULL;
+        const real *nbfp2     = nullptr, *nbfp3 = nullptr;
         if (!half_LJ)
         {
             nbfp2 = nbfp_ptr + type[sci+2]*nbat->ntype*c_simdBestPairAlignment;
index ea0c2011f6e85e07473bf746f083ff21899c7456..99aaaf01b664e84c288e28164ab6b1e2b051c6d7 100644 (file)
@@ -54,6 +54,7 @@ nbnxn_kernel_prune_2xnn(nbnxn_pairlist_t *         nbl,
                         real                       rlistInner)
 {
 #ifdef GMX_NBNXN_SIMD_2XNN
+    using namespace gmx;
     const nbnxn_ci_t * gmx_restrict ciOuter  = nbl->ciOuter;
     nbnxn_ci_t       * gmx_restrict ciInner  = nbl->ci;
 
index 4ed2ae9b493a69b89e7c43647e06c67fbfdc2574..2c101a61789da4e6653d64b600da35bbfad29c8f 100644 (file)
@@ -58,8 +58,6 @@
 #define STRIDE     (UNROLLI)
 #endif
 
-// TODO: Remove when all kernels are in the gmx namespace
-using namespace gmx;
 
 #if !defined GMX_NBNXN_SIMD_2XNN && !defined GMX_NBNXN_SIMD_4XN
 #error "Must define an NBNxN kernel flavour before including NBNxN kernel utility functions"
@@ -73,8 +71,9 @@ using namespace gmx;
 
 #ifdef UNROLLJ
 /* Add energy register to possibly multiple terms in the energy array */
-static inline void add_ener_grp(SimdReal e_S, real *v, const int *offset_jj)
+static inline void add_ener_grp(gmx::SimdReal e_S, real *v, const int *offset_jj)
 {
+    using namespace gmx;
     int jj;
 
     /* We need to balance the number of store operations with
@@ -92,9 +91,9 @@ static inline void add_ener_grp(SimdReal e_S, real *v, const int *offset_jj)
 #endif
 
 #if GMX_SIMD_HAVE_INT32_LOGICAL
-typedef SimdInt32    SimdBitMask;
+typedef gmx::SimdInt32    SimdBitMask;
 #else
-typedef SimdReal     SimdBitMask;
+typedef gmx::SimdReal     SimdBitMask;
 #endif
 
 static inline void gmx_simdcall
@@ -104,11 +103,12 @@ gmx_load_simd_4xn_interactions(int                               excl,
                                SimdBitMask gmx_unused            filter_S2,
                                SimdBitMask gmx_unused            filter_S3,
                                real gmx_unused                  *simd_interaction_array,
-                               SimdBool                         *interact_S0,
-                               SimdBool                         *interact_S1,
-                               SimdBool                         *interact_S2,
-                               SimdBool                         *interact_S3)
+                               gmx::SimdBool                    *interact_S0,
+                               gmx::SimdBool                    *interact_S1,
+                               gmx::SimdBool                    *interact_S2,
+                               gmx::SimdBool                    *interact_S3)
 {
+    using namespace gmx;
 #if GMX_SIMD_HAVE_INT32_LOGICAL
     /* Load integer interaction mask */
     SimdInt32 mask_pr_S(excl);
index 696d53a7fac0c40363c73692559199a7d119cf05..9447cf848ee9aad55dbf614431f7c74d10ede788 100644 (file)
@@ -35,6 +35,7 @@
 
 
 {
+    using namespace gmx;
     const nbnxn_ci_t   *nbln;
     const nbnxn_cj_t   *l_cj;
     const real *        q;
index f310497e4016d5b4e8c81213b232a12fe0481048..9086e3431cba1e890d2b64da6243cf56faa15353 100644 (file)
@@ -54,6 +54,7 @@ nbnxn_kernel_prune_4xn(nbnxn_pairlist_t *         nbl,
                        real                       rlistInner)
 {
 #ifdef GMX_NBNXN_SIMD_4XN
+    using namespace gmx;
     const nbnxn_ci_t * gmx_restrict ciOuter  = nbl->ciOuter;
     nbnxn_ci_t       * gmx_restrict ciInner  = nbl->ci;
 
index 7851926c5855a71bd3a960ac5d561821b304668c..7e8263869e5e3abc1c83c9d4c4c7c19a53a477a0 100644 (file)
@@ -131,19 +131,14 @@ enum class NbnxnLayout
     Gpu8x8x8   // i-cluster size 8, j-cluster size 8 + super-clustering
 };
 
+#if GMX_SIMD
 /* Returns the j-cluster size */
 template <NbnxnLayout layout>
 static constexpr int jClusterSize()
 {
-#if GMX_SIMD
     static_assert(layout == NbnxnLayout::NoSimd4x4 || layout == NbnxnLayout::Simd4xN || layout == NbnxnLayout::Simd2xNN, "Currently jClusterSize only supports CPU layouts");
 
     return layout == NbnxnLayout::Simd4xN ? GMX_SIMD_REAL_WIDTH : (layout == NbnxnLayout::Simd2xNN ? GMX_SIMD_REAL_WIDTH/2 : NBNXN_CPU_CLUSTER_I_SIZE);
-#else
-    static_assert(layout == NbnxnLayout::NoSimd4x4, "Currently without SIMD, jClusterSize only supports NoSimd4x4");
-
-    return NBNXN_CPU_CLUSTER_I_SIZE;
-#endif
 }
 
 /* Returns the j-cluster index given the i-cluster index */
@@ -219,6 +214,7 @@ static inline int xIndexFromCj(int cj)
         return cj*STRIDE_P8;
     }
 }
+#endif //GMX_SIMD
 
 gmx_bool nbnxn_kernel_pairlist_simple(int nb_kernel_type)
 {
index 1a06376f074e0a60692a9996e7b6f3ef71ea408c..e0ee80c75c59e9bd0c7a69ae5d350bd87187287e 100644 (file)
@@ -33,8 +33,6 @@
  * the research papers on the package. Check out http://www.gromacs.org.
  */
 
-using namespace gmx; // TODO: Remove when this file is moved into gmx namespace
-
 #if GMX_SIMD_REAL_WIDTH >= 2*NBNXN_CPU_CLUSTER_I_SIZE
 #define STRIDE_S  (GMX_SIMD_REAL_WIDTH/2)
 #else
@@ -89,6 +87,7 @@ makeClusterListSimd2xnn(const nbnxn_grid_t *      gridj,
                         float                     rbb2,
                         int * gmx_restrict        numDistanceChecks)
 {
+    using namespace gmx;
     const real * gmx_restrict           x_ci_simd = nbl->work->x_ci_simd;
     const nbnxn_bb_t * gmx_restrict     bb_ci     = nbl->work->bb_ci;
 
index c226d86021ec42a182a25162b5e09d13a67d9568..dda0dc683a52a799b334590c752fdb4348fe42f5 100644 (file)
@@ -33,8 +33,6 @@
  * the research papers on the package. Check out http://www.gromacs.org.
  */
 
-using namespace gmx; // TODO: Remove when this file is moved into gmx namespace
-
 #if GMX_SIMD_REAL_WIDTH >= NBNXN_CPU_CLUSTER_I_SIZE
 #define STRIDE_S  (GMX_SIMD_REAL_WIDTH)
 #else
@@ -95,6 +93,7 @@ makeClusterListSimd4xn(const nbnxn_grid_t *      gridj,
                        float                     rbb2,
                        int * gmx_restrict        numDistanceChecks)
 {
+    using namespace gmx;
     const real * gmx_restrict          x_ci_simd = nbl->work->x_ci_simd;
     const nbnxn_bb_t * gmx_restrict    bb_ci     = nbl->work->bb_ci;
 
index 27886e15f19ae6e535111a2d2f217d2a8dfa3e75..a045c57a599ceb0a8db282e6dc7a5df4ea2d8083 100644 (file)
@@ -183,6 +183,9 @@ static real call_QMroutine(const t_commrec gmx_unused *cr, const t_forcerec gmx_
     return (QMener);
 }
 
+#if !(GMX_QMMM_MOPAC || GMX_QMMM_GAMESS || GMX_QMMM_GAUSSIAN || GMX_QMMM_ORCA)
+[[ noreturn ]]
+#endif
 static void init_QMroutine(const t_commrec gmx_unused *cr, t_QMrec gmx_unused *qm, t_MMrec gmx_unused *mm)
 {
     /* makes a call to the requested QM routine (qm->QMmethod)
index 893e848163709566bb7804efba9f921671152466..3bfcb57736efe23428ff40dcd7c1004ca00a78b4 100644 (file)
@@ -234,12 +234,12 @@ static void sum_forces(rvec f[], gmx::ArrayRef<const gmx::RVec> forceToAdd)
     }
 }
 
-static void pme_gpu_reduce_outputs(gmx_wallcycle_t            wcycle,
-                                   ForceWithVirial           *forceWithVirial,
-                                   ArrayRef<const gmx::RVec>  pmeForces,
-                                   gmx_enerdata_t            *enerd,
-                                   const tensor               vir_Q,
-                                   real                       Vlr_q)
+static void pme_gpu_reduce_outputs(gmx_wallcycle_t                 wcycle,
+                                   gmx::ForceWithVirial           *forceWithVirial,
+                                   gmx::ArrayRef<const gmx::RVec>  pmeForces,
+                                   gmx_enerdata_t                 *enerd,
+                                   const tensor                    vir_Q,
+                                   real                            Vlr_q)
 {
     wallcycle_start(wcycle, ewcPME_GPU_F_REDUCTION);
     GMX_ASSERT(forceWithVirial, "Invalid force pointer");
@@ -279,8 +279,8 @@ static void calc_virial(int start, int homenr, rvec x[], rvec f[],
 
 static void pull_potential_wrapper(const t_commrec *cr,
                                    const t_inputrec *ir,
-                                   matrix box, ArrayRef<const RVec> x,
-                                   ForceWithVirial *force,
+                                   matrix box, gmx::ArrayRef<const gmx::RVec> x,
+                                   gmx::ForceWithVirial *force,
                                    const t_mdatoms *mdatoms,
                                    gmx_enerdata_t *enerd,
                                    real *lambda,
@@ -303,10 +303,10 @@ static void pull_potential_wrapper(const t_commrec *cr,
     wallcycle_stop(wcycle, ewcPULLPOT);
 }
 
-static void pme_receive_force_ener(const t_commrec *cr,
-                                   ForceWithVirial *forceWithVirial,
-                                   gmx_enerdata_t  *enerd,
-                                   gmx_wallcycle_t  wcycle)
+static void pme_receive_force_ener(const t_commrec      *cr,
+                                   gmx::ForceWithVirial *forceWithVirial,
+                                   gmx_enerdata_t       *enerd,
+                                   gmx_wallcycle_t       wcycle)
 {
     real   e_q, e_lj, dvdl_q, dvdl_lj;
     float  cycles_ppdpme, cycles_seppme;
@@ -369,21 +369,21 @@ static void print_large_forces(FILE            *fp,
     }
 }
 
-static void post_process_forces(const t_commrec      *cr,
-                                gmx_int64_t           step,
-                                t_nrnb               *nrnb,
-                                gmx_wallcycle_t       wcycle,
-                                const gmx_localtop_t *top,
-                                matrix                box,
-                                rvec                  x[],
-                                rvec                  f[],
-                                ForceWithVirial      *forceWithVirial,
-                                tensor                vir_force,
-                                const t_mdatoms      *mdatoms,
-                                t_graph              *graph,
-                                t_forcerec           *fr,
-                                const gmx_vsite_t    *vsite,
-                                int                   flags)
+static void post_process_forces(const t_commrec           *cr,
+                                gmx_int64_t                step,
+                                t_nrnb                    *nrnb,
+                                gmx_wallcycle_t            wcycle,
+                                const gmx_localtop_t      *top,
+                                matrix                     box,
+                                rvec                       x[],
+                                rvec                       f[],
+                                gmx::ForceWithVirial      *forceWithVirial,
+                                tensor                     vir_force,
+                                const t_mdatoms           *mdatoms,
+                                t_graph                   *graph,
+                                t_forcerec                *fr,
+                                const gmx_vsite_t         *vsite,
+                                int                        flags)
 {
     if (fr->haveDirectVirialContributions)
     {
@@ -824,23 +824,23 @@ static void checkPotentialEnergyValidity(gmx_int64_t           step,
  * \todo Convert all other algorithms called here to ForceProviders.
  */
 static void
-computeSpecialForces(FILE                *fplog,
-                     const t_commrec     *cr,
-                     const t_inputrec    *inputrec,
-                     gmx::Awh            *awh,
-                     gmx_int64_t          step,
-                     double               t,
-                     gmx_wallcycle_t      wcycle,
-                     ForceProviders      *forceProviders,
-                     matrix               box,
-                     ArrayRef<const RVec> x,
-                     const t_mdatoms     *mdatoms,
-                     real                *lambda,
-                     int                  forceFlags,
-                     ForceWithVirial     *forceWithVirial,
-                     gmx_enerdata_t      *enerd,
-                     const gmx_edsam     *ed,
-                     gmx_bool             bNS)
+computeSpecialForces(FILE                          *fplog,
+                     const t_commrec               *cr,
+                     const t_inputrec              *inputrec,
+                     gmx::Awh                      *awh,
+                     gmx_int64_t                    step,
+                     double                         t,
+                     gmx_wallcycle_t                wcycle,
+                     ForceProviders                *forceProviders,
+                     matrix                         box,
+                     gmx::ArrayRef<const gmx::RVec> x,
+                     const t_mdatoms               *mdatoms,
+                     real                          *lambda,
+                     int                            forceFlags,
+                     gmx::ForceWithVirial          *forceWithVirial,
+                     gmx_enerdata_t                *enerd,
+                     const gmx_edsam               *ed,
+                     gmx_bool                       bNS)
 {
     const bool computeForces = (forceFlags & GMX_FORCE_FORCES);
 
@@ -849,8 +849,8 @@ computeSpecialForces(FILE                *fplog,
      */
     if (computeForces)
     {
-        ForceProviderInput  forceProviderInput(x, *mdatoms, t, box, *cr);
-        ForceProviderOutput forceProviderOutput(forceWithVirial, enerd);
+        gmx::ForceProviderInput  forceProviderInput(x, *mdatoms, t, box, *cr);
+        gmx::ForceProviderOutput forceProviderOutput(forceWithVirial, enerd);
 
         /* Collect forces from modules */
         forceProviders->calculateForces(forceProviderInput, &forceProviderOutput);
@@ -953,14 +953,14 @@ static void launchPmeGpuFftAndGather(gmx_pme_t        *pmedata,
  * \param[in]     flags            Force flags
  * \param[in]     wcycle           The wallcycle structure
  */
-static void alternatePmeNbGpuWaitReduce(nonbonded_verlet_t             *nbv,
-                                        const gmx_pme_t                *pmedata,
-                                        gmx::PaddedArrayRef<gmx::RVec> *force,
-                                        ForceWithVirial                *forceWithVirial,
-                                        rvec                            fshift[],
-                                        gmx_enerdata_t                 *enerd,
-                                        int                             flags,
-                                        gmx_wallcycle_t                 wcycle)
+static void alternatePmeNbGpuWaitReduce(nonbonded_verlet_t                  *nbv,
+                                        const gmx_pme_t                     *pmedata,
+                                        gmx::PaddedArrayRef<gmx::RVec>      *force,
+                                        gmx::ForceWithVirial                *forceWithVirial,
+                                        rvec                                 fshift[],
+                                        gmx_enerdata_t                      *enerd,
+                                        int                                  flags,
+                                        gmx_wallcycle_t                      wcycle)
 {
     bool isPmeGpuDone = false;
     bool isNbGpuDone  = false;
@@ -1448,7 +1448,7 @@ static void do_force_cutsVERLET(FILE *fplog,
     }
 
     /* forceWithVirial uses the local atom range only */
-    ForceWithVirial forceWithVirial(forceRef, flags & GMX_FORCE_VIRIAL);
+    gmx::ForceWithVirial forceWithVirial(forceRef, flags & GMX_FORCE_VIRIAL);
 
     if (inputrec->bPull && pull_have_constraint(inputrec->pull_work))
     {
@@ -1971,7 +1971,7 @@ static void do_force_cutsGROUP(FILE *fplog,
     }
 
     /* forceWithVirial might need the full force atom range */
-    ForceWithVirial forceWithVirial(forceRef, flags & GMX_FORCE_VIRIAL);
+    gmx::ForceWithVirial forceWithVirial(forceRef, flags & GMX_FORCE_VIRIAL);
 
     if (inputrec->bPull && pull_have_constraint(inputrec->pull_work))
     {
@@ -2166,7 +2166,7 @@ void do_force(FILE                                     *fplog,
 }
 
 
-void do_constrain_first(FILE *fplog, Constraints *constr,
+void do_constrain_first(FILE *fplog, gmx::Constraints *constr,
                         t_inputrec *ir, t_mdatoms *md,
                         t_state *state)
 {
@@ -2205,7 +2205,7 @@ void do_constrain_first(FILE *fplog, Constraints *constr,
                   as_rvec_array(state->x.data()), as_rvec_array(state->x.data()), nullptr,
                   state->box,
                   state->lambda[efptBONDED], &dvdl_dum,
-                  nullptr, nullptr, ConstraintVariable::Positions);
+                  nullptr, nullptr, gmx::ConstraintVariable::Positions);
     if (EI_VV(ir->eI))
     {
         /* constrain the inital velocity, and save it */
@@ -2215,7 +2215,7 @@ void do_constrain_first(FILE *fplog, Constraints *constr,
                       as_rvec_array(state->x.data()), as_rvec_array(state->v.data()), as_rvec_array(state->v.data()),
                       state->box,
                       state->lambda[efptBONDED], &dvdl_dum,
-                      nullptr, nullptr, ConstraintVariable::Velocities);
+                      nullptr, nullptr, gmx::ConstraintVariable::Velocities);
     }
     /* constrain the inital velocities at t-dt/2 */
     if (EI_STATE_VELOCITY(ir->eI) && ir->eI != eiVV)
@@ -2245,7 +2245,7 @@ void do_constrain_first(FILE *fplog, Constraints *constr,
                       as_rvec_array(state->x.data()), savex, nullptr,
                       state->box,
                       state->lambda[efptBONDED], &dvdl_dum,
-                      as_rvec_array(state->v.data()), nullptr, ConstraintVariable::Positions);
+                      as_rvec_array(state->v.data()), nullptr, gmx::ConstraintVariable::Positions);
 
         for (i = start; i < end; i++)
         {
index c99a879175182f489488c0af7218497ce6d5c18e..b18874a029cecca74e41ef03c8d86f3ab334cbb0 100644 (file)
@@ -106,7 +106,7 @@ void make_wall_tables(FILE *fplog,
     }
 }
 
-static void wall_error(int a, const rvec *x, real r)
+[[ noreturn ]] static void wall_error(int a, const rvec *x, real r)
 {
     gmx_fatal(FARGS,
               "An atom is beyond the wall: coordinates %f %f %f, distance %f\n"
index ba54295d526b5703d5f96c72bf6387d391e586a4..8ff6c8d7e1d02428e2f9909db4a9206f5f5e968a 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2016, by the GROMACS development team, led by
+ * Copyright (c) 2016,2018, 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.
@@ -72,7 +72,8 @@ class AbstractOptionSection
         //! \cond libapi
         //! Initializes option properties with the given name.
         explicit AbstractOptionSection(const char *name) : name_(name) {}
-
+        //! Destructor
+        virtual ~AbstractOptionSection() {}
         /*! \brief
          * Creates a storage object corresponding to this section.
          *
index ee7c438cc009be8ba1eee2598281c85440bf2f63..2040b8efa0d135da90de8b6a4a67f0638df8efff 100644 (file)
@@ -50,8 +50,6 @@
 #include "gromacs/pbcutil/pbc.h"
 #include "gromacs/simd/simd.h"
 
-using namespace gmx; // TODO: Remove when this file is moved into gmx namespace
-
 struct gmx_domdec_t;
 
 /*! \brief Set the SIMD PBC data from a normal t_pbc struct.
@@ -84,11 +82,12 @@ void set_pbc_simd(const t_pbc *pbc,
  * routine should be low. On e.g. Intel Haswell/Broadwell it takes 8 cycles.
  */
 static inline void gmx_simdcall
-pbc_correct_dx_simd(SimdReal         *dx,
-                    SimdReal         *dy,
-                    SimdReal         *dz,
-                    const real       *pbc_simd)
+pbc_correct_dx_simd(gmx::SimdReal         *dx,
+                    gmx::SimdReal         *dy,
+                    gmx::SimdReal         *dz,
+                    const real            *pbc_simd)
 {
+    using namespace gmx;
     SimdReal shz, shy, shx;
 
     shz = round(*dz * load<SimdReal>(pbc_simd+0*GMX_SIMD_REAL_WIDTH)); // load inv_bzz
@@ -117,10 +116,10 @@ pbc_correct_dx_simd(SimdReal         *dx,
  * This is the SIMD equivalent of the scalar version declared in pbc.h.
  */
 static inline void gmx_simdcall
-pbc_dx_aiuc(const real       *pbc_simd,
-            const SimdReal   *x1,
-            const SimdReal   *x2,
-            SimdReal         *dx)
+pbc_dx_aiuc(const real            *pbc_simd,
+            const gmx::SimdReal   *x1,
+            const gmx::SimdReal   *x2,
+            gmx::SimdReal         *dx)
 {
     for (int d = 0; d < DIM; d++)
     {
index d1b1f457b16b41058ab67121eb2c0279f7d35dba..6d28630cc10696016ade2fd34ff9d1158abe4e31 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, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018, 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.
@@ -253,7 +253,7 @@ static void set_pos_method_flags(gmx_ana_selmethod_t *method,
     {
         case gmx::PositionCalculationCollection::RequiredTopologyInfo::TopologyAndMasses:
             method->flags |= SMETH_REQMASS;
-        // fallthrough
+            [[fallthrough]];
         case gmx::PositionCalculationCollection::RequiredTopologyInfo::Topology:
             method->flags |= SMETH_REQTOP;
             break;
index 67454bdc958d27df3c658f25925a8c9a1945f7cc..ee0ae7733e5d8ff9c9da70eb84530fd6729cf37f 100644 (file)
@@ -138,7 +138,7 @@ class ArrayRef
         /*! \brief
          * Constructs an empty reference.
          */
-        ArrayRef() : begin_(NULL), end_(NULL) {}
+        ArrayRef() : begin_(nullptr), end_(nullptr) {}
         /*! \brief
          * Constructs an empty reference.
          *
index 5917cb5fe4cbbd56d6cc709c382197432fc6a047..bf1318371931cdfc67cfd6846085e0fccb4be2c3 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2016, by the GROMACS development team, led by
+ * Copyright (c) 2016,2018, 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.
@@ -55,7 +55,7 @@ class IKeyValueTreeErrorHandler
         virtual bool onError(UserInputError *ex, const KeyValueTreePath &context) = 0;
 
     protected:
-        ~IKeyValueTreeErrorHandler();
+        virtual ~IKeyValueTreeErrorHandler();
 };
 
 //! \cond libapi
index 60ca5da2da204e3db62a9316bb18234924c4c15d..958cfce52b45900b58e7f473999f11c9dfbca83d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018, 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.
@@ -56,7 +56,7 @@ class ValueSerializer
         static KeyValueTreeValue deserialize(ISerializer *serializer);
 
     private:
-        ValueSerializer();
+        ValueSerializer() = delete;
 
         typedef void (*SerializerFunction)(const KeyValueTreeValue &value, ISerializer *serializer);
         typedef void (*DeserializerFunction)(KeyValueTreeValueBuilder *builder, ISerializer *serializer);
@@ -257,7 +257,7 @@ void ValueSerializer::initSerializers()
         SERIALIZER('f', float),
         SERIALIZER('d', double),
     };
-    for (const auto item : s_serializers)
+    for (const auto &item : s_serializers)
     {
         s_deserializers[item.second.typeTag] = item.second.deserialize;
     }
index 9fda9242ef813ab68b637fdd35ecbbe47c158a85..09d6724a76baac9dccdf70bb01eeb79a43dc2127 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2011,2012,2013,2014,2015,2016,2018, 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.
@@ -116,7 +116,7 @@ class File
 
         static void returnFalseOnError(const NotFoundInfo &info);
         static void throwOnError(const NotFoundInfo &info);
-        static void throwOnNotFound(const NotFoundInfo &info);
+        [[ noreturn ]] static void throwOnNotFound(const NotFoundInfo &info);
 
         typedef void (*NotFoundHandler)(const NotFoundInfo &info);