Clang warnings: unreachable
authorRoland Schulz <roland.schulz@intel.com>
Tue, 10 Jul 2018 02:11:08 +0000 (19:11 -0700)
committerRoland Schulz <roland.schulz@intel.com>
Tue, 10 Jul 2018 06:28:36 +0000 (23:28 -0700)
Fixing:
-Wno-unreachable-code
-Wno-unreachable-code-return

Also disabling:
-Wno-missing-field-initializers (set by gmxCFlags)
-Wno-sign-conversion (was warning free)

Change-Id: I2c46ffbf08048b17f065647b4d3a84addbfaff4c

34 files changed:
src/gromacs/CMakeLists.txt
src/gromacs/commandline/pargs.cpp
src/gromacs/domdec/domdec.cpp
src/gromacs/domdec/domdec_setup.cpp
src/gromacs/domdec/redistribute.cpp
src/gromacs/fileio/enxio.cpp
src/gromacs/fileio/gmxfio.cpp
src/gromacs/fileio/tngio.cpp
src/gromacs/fileio/trrio.cpp
src/gromacs/gmxana/gmx_densorder.cpp
src/gromacs/gmxana/gmx_h2order.cpp
src/gromacs/gmxana/gmx_mindist.cpp
src/gromacs/gmxana/gmx_nmr.cpp
src/gromacs/gmxana/gmx_trjconv.cpp
src/gromacs/gmxana/gmx_wham.cpp
src/gromacs/gmxana/sfactor.cpp
src/gromacs/gmxlib/nonbonded/nonbonded.cpp
src/gromacs/gmxpreprocess/pdb2top.cpp
src/gromacs/gmxpreprocess/readir.cpp
src/gromacs/imd/imd.cpp
src/gromacs/listed-forces/bonded.cpp
src/gromacs/mdlib/calc_verletbuf.cpp
src/gromacs/mdlib/forcerec.cpp
src/gromacs/mdlib/membed.cpp
src/gromacs/mdlib/qmmm.cpp
src/gromacs/mdlib/qmmm.h
src/gromacs/mdlib/repl_ex.cpp
src/gromacs/mdtypes/inputrec.cpp
src/gromacs/pulling/pull.cpp
src/gromacs/selection/scanner_internal.cpp
src/gromacs/topology/symtab.cpp
src/gromacs/utility/basenetwork.cpp
src/gromacs/utility/futil.cpp
src/gromacs/utility/path.cpp

index b9a0664057b2a1800694392dde4e250cc0d64931..10ae3fc40e62b7235352dda68a09ab1d2b580886 100644 (file)
@@ -274,18 +274,14 @@ set(IGNORED_CLANG_ALL_WARNINGS
     "-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
+    "-Wno-covered-switch-default" #GCC gives maybe-uninitialized without default label and checks for illegal enum values.
     #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"
index 232f4a0d672c2a216c75b39c6e8f6b412041495f..20975cb5fba20b7d23652a29839f8426ad85df2b 100644 (file)
@@ -95,8 +95,6 @@ int opt2parg_int(const char *option, int nparg, t_pargs pa[])
     }
 
     gmx_fatal(FARGS, "No integer option %s in pargs", option);
-
-    return 0;
 }
 
 gmx_bool opt2parg_bool(const char *option, int nparg, t_pargs pa[])
@@ -129,8 +127,6 @@ real opt2parg_real(const char *option, int nparg, t_pargs pa[])
     }
 
     gmx_fatal(FARGS, "No real option %s in pargs", option);
-
-    return 0.0;
 }
 
 const char *opt2parg_str(const char *option, int nparg, t_pargs pa[])
@@ -146,8 +142,6 @@ const char *opt2parg_str(const char *option, int nparg, t_pargs pa[])
     }
 
     gmx_fatal(FARGS, "No string option %s in pargs", option);
-
-    return nullptr;
 }
 
 gmx_bool opt2parg_bSet(const char *option, int nparg, const t_pargs *pa)
@@ -180,8 +174,6 @@ const char *opt2parg_enum(const char *option, int nparg, t_pargs pa[])
     }
 
     gmx_fatal(FARGS, "No such option %s in pargs", option);
-
-    return nullptr;
 }
 
 /********************************************************************
index 4f5590d5509c551680c321dd4b4839fd7a1799b4..bceea5320884f662af4744433bb8bd0fbecdb0c9 100644 (file)
@@ -5184,7 +5184,6 @@ static void setup_dd_communication(gmx_domdec_t *dd,
             break;
         default:
             gmx_incons("unimplemented");
-            cg_cm = nullptr;
     }
 
     bBondComm = comm->bBondComm;
index dd4aabc99259479f583c3bb93126ea3d297b49f8..22e3687d7c6aa1d62d077569ce89256019db5227 100644 (file)
@@ -239,8 +239,6 @@ static int guess_npme(FILE *fplog, const gmx_mtop_t *mtop, const t_inputrec *ir,
         gmx_fatal(FARGS, "Could not find an appropriate number of separate PME ranks. i.e. >= %5f*#ranks (%d) and <= #ranks/2 (%d) and reasonable performance wise (grid_x=%d, grid_y=%d).\n"
                   "Use the -npme option of mdrun or change the number of ranks or the PME grid dimensions, see the manual for details.",
                   ratio, (int)(0.95*ratio*nrank_tot + 0.5), nrank_tot/2, ir->nkx, ir->nky);
-        /* Keep the compiler happy */
-        npme = 0;
     }
     else
     {
index a5c47e079732c556bbc2b45d9128fb447be01678..2d416ce94d61dedb0f406f94e077dc0607e2d69d 100644 (file)
@@ -686,7 +686,6 @@ void dd_redistribute_cg(FILE *fplog, gmx_int64_t step,
             break;
         default:
             gmx_incons("unimplemented");
-            home_pos_cg = 0;
     }
 
     int vec         = 0;
index 984591a63eba84b66cd50a5574edbaffc3ddcf19..cfff421eabb8424f17461717217b4089ca6854e6 100644 (file)
@@ -1147,8 +1147,6 @@ static real find_energy(const char *name, int nre, gmx_enxnm_t *enm,
     }
 
     gmx_fatal(FARGS, "Could not find energy term named '%s'. Either the energy file is from a different run or this state variable is not stored in the energy file. In the latter case (and if you did not modify the T/P-coupling setup), you can read the state in mdrun instead, by passing in a checkpoint file.", name);
-
-    return 0;
 }
 
 
index d92e5e8f8da5f1c78bf1e07f08c005974fb6d7d1..71a01324957e0e762671b91b7a8bb867bbde0f51 100644 (file)
@@ -495,7 +495,7 @@ static int gmx_fio_int_get_file_md5(t_fileio *fio, gmx_off_t offset,
              * infrequently we don't want to issue lots of warnings before we
              * have written anything to the log.
              */
-            if (0)
+            if (/* DISABLES CODE */ (false))
             {
                 fprintf(stderr, "\nTrying to get md5sum: EOF: %s\n", fio->fn);
             }
@@ -746,7 +746,6 @@ int gmx_fio_seek(t_fileio* fio, gmx_off_t fpos)
     else
     {
         gmx_file(fio->fn);
-        rc = -1;
     }
     gmx_fio_unlock(fio);
     return rc;
index be13c2a6a92bdb32580a6f6d4d90f2e61b04074b..f068e9fdd2aa4acf0ea4758e82dc3ba72c866869 100644 (file)
@@ -108,8 +108,6 @@ static const char *modeToVerb(char mode)
             break;
         default:
             gmx_fatal(FARGS, "Invalid file opening mode %c", mode);
-            p = "";
-            break;
     }
     return p;
 }
@@ -1266,7 +1264,6 @@ convert_array_to_real_array(void       *from,
             break;
         default:
             gmx_incons("Illegal datatype when converting values to a real array!");
-            return;
     }
 }
 
index 87cddfdd52aacaac36e6dc753671d6262e311ad2..50b3282af2e8d17fd2195aab1564251b27e338fc 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, by the GROMACS development team, led by
+ * Copyright (c) 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.
@@ -112,7 +112,6 @@ do_trr_frame_header(t_fileio *fio, bool bRead, gmx_trr_header_t *sh, gmx_bool *b
     {
         *bOK = FALSE;
         gmx_fatal(FARGS, "Failed to find GROMACS magic number in trr frame header, so this is not a trr file!\n");
-        return *bOK;
     }
 
     if (bRead)
index 8fb14e1a98e1fce467e6ec75ceccc8d26d770f35..d4cbcaa3dac2dce782a414dad369988a0d73611f 100644 (file)
@@ -266,7 +266,7 @@ static void density_in_time (const char *fn, int **index, const int gnx[], real
     gmx_rmpbc_done(gpbc);
     close_trx(status);
 
-    if (0)
+    if (/* DISABLES CODE */ (0))
     {
         FILE *fp;
         fp = fopen("koko.xvg", "w");
index 9a092248741a3060578195c35fa8f970c17c82fa..c5edc450a65d9e972f0ad95f4c7f3d0935468a99 100644 (file)
@@ -109,8 +109,6 @@ static void calc_h2order(const char *fn, const int index[], int ngx, rvec **slDi
             break;
         default:
             gmx_fatal(FARGS, "No valid value for -axis-. Exiting.\n");
-            /* make compiler happy */
-            normal[0] = 1; normal[1] = 0; normal[2] = 0;
     }
 
     clear_rvec(dipole);
index 84c04ff7dfccb5b1fd301113a6e9b604ac39a2b5..6312fdb033bf5b3b3a90a4f3d707fa57b0ab2cfa 100644 (file)
@@ -86,7 +86,6 @@ static void periodic_dist(int ePBC,
     {
         gmx_fatal(FARGS, "pbc = %s is not supported by g_mindist",
                   epbc_names[ePBC]);
-        nsz = 0; /* Keep compilers quiet */
     }
 
     nshift = 0;
index 035ab0eb11c39427ba60a7f6108adb18117e68e2..ad8ba9393f14db71f5c450db2cbd770c2b019cc7 100644 (file)
@@ -99,7 +99,6 @@ static real blk_value(t_enxblock *blk, int sub, int index)
     {
         gmx_incons("Unknown datatype in t_enxblock");
     }
-    return 0.0;
 }
 
 static int *select_it(int nre, char *nm[], int *nset)
index f62d901983f00c2c60324973cd83e18ee2031177..572ceb21986c8473dcce0c653ca30f31a22a340e 100644 (file)
@@ -1054,7 +1054,7 @@ int gmx_trjconv(int argc, char *argv[])
             /* Check for number of files disabled, as FOPEN_MAX is not the correct
              * number to check for. In my linux box it is only 16.
              */
-            if (0 && (clust->clust->nr > FOPEN_MAX-4))
+            if (/* DISABLES CODE */ (0) && (clust->clust->nr > FOPEN_MAX-4))
             {
                 gmx_fatal(FARGS, "Can not open enough (%d) files to write all the"
                           " trajectories.\ntry splitting the index file in %d parts.\n"
index 5e39155df8215961766bdf89cbbad49c89a5cc26..ac718cb6b89142fb779fa66874f81677085404e4 100644 (file)
@@ -1822,7 +1822,6 @@ static int whaminFileType(char *fn)
     {
         gmx_fatal(FARGS, "Unknown file type of %s. Should be tpr, xvg, or pdo.\n", fn);
     }
-    return whamin_unknown;
 }
 
 //! Read the files names in pdo-files.dat, pullf/x-files.dat, tpr-files.dat
index 3a67fd11e1ac0d445331e462c47d15df76e7ff49..14d903e616a24bde52c8d0c5a184e8fcf5ef7ba1 100644 (file)
@@ -417,8 +417,6 @@ extern int return_atom_type (const char *name, gmx_structurefactors_t *gsf)
 
         return fndx;
     }
-
-    return 0;
 }
 
 extern int gmx_structurefactors_get_sf(gmx_structurefactors_t *gsf, int elem, real a[4], real b[4], real *c)
index 5aca8f316d488ace404399dac0923ccda1e0544a..002ef95e1c167875d820d091b48d913522fda628 100644 (file)
@@ -344,7 +344,6 @@ void do_nonbonded(const t_forcerec  *fr,
     if (fr->bAllvsAll)
     {
         gmx_incons("All-vs-all kernels have not been implemented in version 4.6");
-        return;
     }
 
     if (eNL >= 0)
index e275d694be0d62699931799cf86fdd76a96a25c5..2eab21ae4909b32527f6d1f38cab5a850fefa8a4 100644 (file)
@@ -139,13 +139,12 @@ choose_ff_impl(const char *ffsel,
     const int nff = static_cast<int>(ffdirs.size());
 
     /* Replace with unix path separators */
-    if (DIR_SEPARATOR != '/')
+#if DIR_SEPARATOR != '/'
+    for (int i = 0; i < nff; ++i)
     {
-        for (int i = 0; i < nff; ++i)
-        {
-            std::replace(ffdirs[i].dir.begin(), ffdirs[i].dir.end(), DIR_SEPARATOR, '/');
-        }
+        std::replace(ffdirs[i].dir.begin(), ffdirs[i].dir.end(), DIR_SEPARATOR, '/');
     }
+#endif
 
     /* Store the force field names in ffs */
     std::vector<std::string> ffs;
index 3d1daed5d5b2f498bd6d88ffd1475ce70c4321dc..55bd2db67e5e0b36e2bf9f7e0dee83227c925620 100644 (file)
@@ -2569,9 +2569,6 @@ static int search_QMstring(const char *s, int ng, const char *gn[])
     }
 
     gmx_fatal(FARGS, "this QM method or basisset (%s) is not implemented\n!", s);
-
-    return -1;
-
 } /* search_QMstring */
 
 /* We would like gn to be const as well, but C doesn't allow this */
@@ -2596,8 +2593,6 @@ int search_string(const char *s, int ng, char *gn[])
               "names, in which case you must supply an index file to the '-n' option\n"
               "of grompp.",
               s);
-
-    return -1;
 }
 
 static gmx_bool do_numbering(int natoms, gmx_groups_t *groups, int ng, char *ptrs[],
index d46848f96b380e3623027e6a58fa17a9c927fe01..e0c646af956cb2675a8d0a6d197c37dfeea03792 100644 (file)
@@ -1278,7 +1278,6 @@ static void imd_check_integrator_parallel(t_inputrec *ir, const t_commrec *cr)
         if (((ir->eI) == eiSteep) || ((ir->eI) == eiCG) || ((ir->eI) == eiLBFGS) || ((ir->eI) == eiNM))
         {
             gmx_fatal(FARGS, "%s Energy minimization via steep, CG, lbfgs and nm in parallel is currently not supported by IMD.\n", IMDstr);
-            return;
         }
     }
 }
index cd3bfae3c271c3493f2b588a1b3a8ef30e8801b4..14483cf683ce2801b840b1246e8f4147e0b5cdf0 100644 (file)
@@ -2418,8 +2418,6 @@ real unimplemented(int gmx_unused nbonds,
                    int gmx_unused *global_atom_index)
 {
     gmx_impl("*** you are using a not implemented function");
-
-    return 0.0; /* To make the compiler happy */
 }
 
 real restrangles(int nbonds,
index c9d4ef810750c6448b61e49a5e423a2c1fd036c2..787b478d987d6f57537d2ddcdece28a936f26787 100644 (file)
@@ -778,7 +778,6 @@ static real surface_frac(int cluster_size, real particle_distance, real rlist)
             break;
         default:
             gmx_incons("surface_frac called with unsupported cluster_size");
-            area_rel = 1.0;
     }
 
     return area_rel/cluster_size;
index 4ac52381dfc8318d2ee6925bb3dfc506f83f18bd..5bef3693ca535d25ce29e5ac28cac96d96a16c2c 100644 (file)
@@ -1698,8 +1698,6 @@ const char *lookup_nbnxn_kernel_name(int kernel_type)
         case nbnxnkNR:
         default:
             gmx_fatal(FARGS, "Illegal kernel type selected");
-            returnvalue = nullptr;
-            break;
     }
     return returnvalue;
 };
index b86f7ee757cf759b7650a3f0e60ccea7f6ac804e..1195178d8a3b6bebb46c969084e1a4c9282b0c67 100644 (file)
@@ -136,8 +136,6 @@ static int get_molblock(int mol_id, const std::vector<gmx_molblock_t> &mblock)
     }
 
     gmx_fatal(FARGS, "mol_id %d larger than total number of molecules %d.\n", mol_id, nmol);
-
-    return -1;
 }
 
 /* Get a list of all the molecule types that are present in a group of atoms. *
@@ -1000,8 +998,6 @@ static int search_string(const char *s, int ng, char *gn[])
               "names, in which case you must supply an index file to the '-n' option\n"
               "of grompp.",
               s);
-
-    return -1;
 }
 
 gmx_membed_t *init_membed(FILE *fplog, int nfile, const t_filenm fnm[], gmx_mtop_t *mtop,
index a045c57a599ceb0a8db282e6dc7a5df4ea2d8083..1db60a41e678c494b203a3a5842c083f9aeb1e63 100644 (file)
@@ -111,9 +111,7 @@ call_gaussian(const t_forcerec *fr, t_QMrec *qm, t_MMrec *mm, rvec f[], rvec fsh
 #include "gromacs/mdlib/qm_orca.h"
 #endif
 
-
-
-
+#if GMX_QMMM
 /* this struct and these comparison functions are needed for creating
  * a QMMM input for the QM routines from the QMMM neighbor list.
  */
@@ -136,9 +134,6 @@ static real call_QMroutine(const t_commrec gmx_unused *cr, const t_forcerec gmx_
     /* makes a call to the requested QM routine (qm->QMmethod)
      * Note that f is actually the gradient, i.e. -f
      */
-    real
-        QMener = 0.0;
-
     /* do a semi-empiprical calculation */
 
     if (qm->QMmethod < eQMmethodRHF && !(mm->nrMMatoms))
@@ -146,11 +141,11 @@ static real call_QMroutine(const t_commrec gmx_unused *cr, const t_forcerec gmx_
 #if GMX_QMMM_MOPAC
         if (qm->bSH)
         {
-            QMener = call_mopac_SH(qm, mm, f, fshift);
+            return call_mopac_SH(qm, mm, f, fshift);
         }
         else
         {
-            QMener = call_mopac(qm, mm, f, fshift);
+            return call_mopac(qm, mm, f, fshift);
         }
 #else
         gmx_fatal(FARGS, "Semi-empirical QM only supported with Mopac.");
@@ -162,7 +157,7 @@ static real call_QMroutine(const t_commrec gmx_unused *cr, const t_forcerec gmx_
         if (qm->bSH && qm->QMmethod == eQMmethodCASSCF)
         {
 #if GMX_QMMM_GAUSSIAN
-            QMener = call_gaussian_SH(fr, qm, mm, f, fshift);
+            return call_gaussian_SH(fr, qm, mm, f, fshift);
 #else
             gmx_fatal(FARGS, "Ab-initio Surface-hopping only supported with Gaussian.");
 #endif
@@ -170,22 +165,18 @@ static real call_QMroutine(const t_commrec gmx_unused *cr, const t_forcerec gmx_
         else
         {
 #if GMX_QMMM_GAMESS
-            QMener = call_gamess(fr, qm, mm, f, fshift);
+            return call_gamess(fr, qm, mm, f, fshift);
 #elif GMX_QMMM_GAUSSIAN
-            QMener = call_gaussian(fr, qm, mm, f, fshift);
+            return call_gaussian(fr, qm, mm, f, fshift);
 #elif GMX_QMMM_ORCA
-            QMener = call_orca(fr, qm, mm, f, fshift);
+            return call_orca(fr, qm, mm, f, fshift);
 #else
             gmx_fatal(FARGS, "Ab-initio calculation only supported with Gamess, Gaussian or ORCA.");
 #endif
         }
     }
-    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)
@@ -856,7 +847,6 @@ void update_QMMMrec(const t_commrec  *cr,
     }
 } /* update_QMMM_rec */
 
-
 real calculate_QMMM(const t_commrec  *cr,
                     rvec              f[],
                     const t_forcerec *fr)
@@ -980,5 +970,32 @@ real calculate_QMMM(const t_commrec  *cr,
     }
     return(QMener);
 } /* calculate_QMMM */
+#else
+real calculate_QMMM(const t_commrec  * /*unused*/,
+                    rvec             * /*unused*/,
+                    const t_forcerec * /*unused*/)
+{
+    gmx_incons("Compiled without QMMM");
+}
+t_QMMMrec *mk_QMMMrec(void)
+{
+    return nullptr;
+}
+void init_QMMMrec(const t_commrec  * /*unused*/,
+                  gmx_mtop_t       * /*unused*/,
+                  t_inputrec       * /*unused*/,
+                  const t_forcerec * /*unused*/)
+{
+    gmx_incons("Compiled without QMMM");
+}
+void update_QMMMrec(const t_commrec  * /*unused*/,
+                    const t_forcerec * /*unused*/,
+                    const rvec       * /*unused*/,
+                    const t_mdatoms  * /*unused*/,
+                    const matrix       /*unused*/)
+{
+    gmx_incons("Compiled without QMMM");
+}
+#endif
 
 /* end of QMMM core routines */
index 568957bc1308d06b27a6d5b4a2268f1f51e42c3f..d1ec5a14f540d5fa0afcceab7797c01f7d7c3962 100644 (file)
 #ifndef GMX_MDLIB_QMMM_H
 #define GMX_MDLIB_QMMM_H
 
+#include "config.h"
+
 #include "gromacs/math/vectypes.h"
 #include "gromacs/mdlib/tgroup.h"
 
+#define GMX_QMMM (GMX_QMMM_MOPAC || GMX_QMMM_GAMESS || GMX_QMMM_GAUSSIAN || GMX_QMMM_ORCA)
+
 struct gmx_localtop_t;
 struct gmx_mtop_t;
 struct t_commrec;
@@ -109,6 +113,9 @@ void atomic_number(int nr, char ***atomtype, int *nucnum);
 t_QMMMrec *mk_QMMMrec(void);
 /* allocates memory for QMMMrec */
 
+#if !GMX_QMMM
+[[noreturn]]
+#endif
 void init_QMMMrec(const t_commrec  *cr,
                   gmx_mtop_t       *mtop,
                   t_inputrec       *ir,
@@ -120,7 +127,9 @@ void init_QMMMrec(const t_commrec  *cr,
  * resp. inputrec->QMmult the nelecs and multiplicity are determined
  * and md->cQMMM gives numbers of the MM and QM atoms
  */
-
+#if !GMX_QMMM
+[[noreturn]]
+#endif
 void update_QMMMrec(const t_commrec  *cr,
                     const t_forcerec *fr,
                     const rvec       *x,
@@ -132,7 +141,6 @@ void update_QMMMrec(const t_commrec  *cr,
  * routine should be called at every step, since it updates the MM
  * elements of the t_QMMMrec struct.
  */
-
 real calculate_QMMM(const t_commrec  *cr,
                     rvec              f[],
                     const t_forcerec *fr);
index efd89e5c4f0f16e300ccc059b6c60d5c2a0a746f..88a7108121396e219158e7a9a7b8dccf58ed25e1 100644 (file)
@@ -158,7 +158,7 @@ init_replica_exchange(FILE                            *fplog,
                       const ReplicaExchangeParameters &replExParams)
 {
     real                pres;
-    int                 i, j, k;
+    int                 i, j;
     struct gmx_repl_ex *re;
     gmx_bool            bTemp;
     gmx_bool            bLambda = FALSE;
@@ -307,10 +307,6 @@ init_replica_exchange(FILE                            *fplog,
                               erename[re->type],
                               re->q[re->type][i], re->q[re->type][j],
                               erename[re->type]);
-
-                    k          = re->ind[i];
-                    re->ind[i] = re->ind[j];
-                    re->ind[j] = k;
                 }
                 else if (re->q[re->type][re->ind[j]] == re->q[re->type][re->ind[i]])
                 {
index b8e1194080dcdea90e684a13a89c48929f96d7a9..3a4bbdf6638854a4d706b978c632a78add94520c 100644 (file)
@@ -126,7 +126,6 @@ int tcouple_min_integration_steps(int etc)
             break;
         default:
             gmx_incons("Unknown etc value");
-            n = 0;
     }
 
     return n;
@@ -193,7 +192,6 @@ int pcouple_min_integration_steps(int epc)
             break;
         default:
             gmx_incons("Unknown epc value");
-            n = 0;
     }
 
     return n;
index 5054b38d15565edcc3b36293cbfbdd6f9a45f546..31a7dd207afd06d597545e6240143d0b46eeb39f 100644 (file)
@@ -1168,9 +1168,6 @@ static void do_constraint(struct pull_t *pull, t_pbc *pbc,
                     break;
                 default:
                     gmx_incons("Invalid enumeration value for eGeom");
-                    /* Keep static analyzer happy */
-                    clear_dvec(dr0);
-                    clear_dvec(dr1);
             }
 
             /* DEBUG */
index 5dbeef8b419d283ebb8e5360ae21ace027ac6173..f2ae98e203f92ba2a8ee9ec16cc826294a171b84 100644 (file)
@@ -178,7 +178,6 @@ init_method_token(YYSTYPE *yylval, YYLTYPE *yylloc,
                 GMX_THROW(gmx::InternalError("Unsupported method type"));
         }
     }
-    return INVALID; /* Should not be reached */
 }
 
 int
@@ -329,7 +328,6 @@ _gmx_sel_lexer_process_identifier(YYSTYPE *yylval, YYLTYPE *yylloc,
             default:
                 delete yylval->sel;
                 GMX_THROW(gmx::InternalError("Unsupported variable type"));
-                return INVALID;
         }
         /* This position should not be reached. */
     }
index 55d3a59d47e343ae1dc4eaaaa996efeb496ded2a..5a9f65ca81c80301d685f7a4b3ee546957cefa7a 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.
@@ -114,7 +114,6 @@ int lookup_symtab(t_symtab *symtab, char **name)
         }
     }
     gmx_fatal(FARGS, "symtab lookup \"%s\" not found", *name);
-    return -1;
 }
 
 char **get_symtab_handle(t_symtab *symtab, int name)
@@ -135,7 +134,6 @@ char **get_symtab_handle(t_symtab *symtab, int name)
         }
     }
     gmx_fatal(FARGS, "symtab get_symtab_handle %d not found", name);
-    return nullptr;
 }
 
 static t_symbuf *new_symbuf(void)
index 533fe0cada09e38efda96ca092a9c2e5218f1a5f..63ae6a2426e3f7e6aa96f897b75fe1792484a918 100644 (file)
@@ -134,16 +134,12 @@ static int mpi_hostname_hash()
 
 int gmx_physicalnode_id_hash(void)
 {
-    int hash;
+    int hash = 0;
 
     if (GMX_MPI)
     {
         hash = mpi_hostname_hash();
     }
-    else
-    {
-        hash = 0;
-    }
 
     if (debug)
     {
index 53cc036ed96f9ce7ba16df41c320856f16b4f203..2ac9a038744bb97f91ba7686e2c795f986528da8 100644 (file)
@@ -547,7 +547,6 @@ FILE *low_libopen(const char *file, gmx_bool bFatal)
         return fp;
     }
     GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
-    return nullptr;
 }
 
 char *gmxlibfn(const char *file)
index bdb2e5e9406079cb38a47769ba530827d7e1eaba..9338d3e7c99402da49c76145ecf7e3beb5a238b1 100644 (file)
@@ -331,10 +331,9 @@ std::string Path::concatenateBeforeExtension(const std::string &input, const std
 std::string Path::normalize(const std::string &path)
 {
     std::string result(path);
-    if (DIR_SEPARATOR != '/')
-    {
-        std::replace(result.begin(), result.end(), '/', DIR_SEPARATOR);
-    }
+#if DIR_SEPARATOR != '/'
+    std::replace(result.begin(), result.end(), '/', DIR_SEPARATOR);
+#endif
     return result;
 }