Fix GCC 4.8 warnings
authorRoland Schulz <roland@utk.edu>
Thu, 8 May 2014 02:40:31 +0000 (22:40 -0400)
committerRoland Schulz <roland@rschulz.eu>
Fri, 9 May 2014 02:44:35 +0000 (04:44 +0200)
Those warnings only present without OpenMP were not fixed prior.

Defines GMX_ATTRIBUTE_NORETURN for GCC and Clang. TODO is
left because it still doesn't define it for all compilers.

Change-Id: I7197e58f87c01de7d2deeba91a82026af74ba213

src/gromacs/fileio/tngio_for_tools.cpp
src/gromacs/gmxpreprocess/calc_verletbuf.c
src/gromacs/mdlib/force.c
src/gromacs/utility/fatalerror.cpp
src/gromacs/utility/fatalerror.h

index d8fae47a14d65440bd54dee499f341d2929fce40..d6239afb1e71680ba1f7128eda3d3b4505ed562d 100644 (file)
@@ -524,7 +524,6 @@ gmx_bool gmx_read_next_tng_frame(tng_trajectory_t            input,
                         size = sizeof(double);
                         break;
                     default:
-                        size = 0; /* Just to make the compiler happy. */
                         gmx_incons("Illegal datatype of box shape values!");
                 }
                 for (int i = 0; i < DIM; i++)
index 0dd3d502c7d06ab88c3da2acb9906ed161cdccd1..0a668def8ce0003950ad91580b73a39f87c7a05d 100644 (file)
@@ -210,7 +210,7 @@ static void get_vsite_masses(const gmx_moltype_t  *moltype,
             for (i = 0; i < il->nr; i += 1+NRAL(ft))
             {
                 const t_iparams *ip;
-                real             cam[5], inv_mass, m_aj;
+                real             cam[5] = {0}, inv_mass, m_aj;
                 int              a1, j, aj, coeff;
 
                 ip = &ffparams->iparams[il->iatoms[i]];
index e3e6d4ab72b401181045b3c7d59ad889a8ad9cfa..73a0f565f897899b0f38ddebd0332f6c079a34a2 100644 (file)
@@ -449,11 +449,19 @@ void do_force_lowlevel(FILE       *fplog,   gmx_int64_t step,
     where();
 
     *cycles_pme = 0;
+    clear_mat(fr->vir_el_recip);
+    clear_mat(fr->vir_lj_recip);
+
+    /* Do long-range electrostatics and/or LJ-PME, including related short-range
+     * corrections.
+     */
     if (EEL_FULL(fr->eeltype) || EVDW_PME(fr->vdwtype))
     {
-        real Vlr             = 0, Vcorr = 0;
-        real dvdl_long_range = 0;
-        int  status          = 0;
+        real Vlr               = 0, Vcorr = 0;
+        real dvdl_long_range   = 0;
+        int  status            = 0;
+        real Vlr_q             = 0, Vlr_lj = 0, Vcorr_q = 0, Vcorr_lj = 0;
+        real dvdl_long_range_q = 0, dvdl_long_range_lj = 0;
 
         bSB = (ir->nwall == 2);
         if (bSB)
@@ -462,20 +470,6 @@ void do_force_lowlevel(FILE       *fplog,   gmx_int64_t step,
             svmul(ir->wall_ewald_zfac, boxs[ZZ], boxs[ZZ]);
             box_size[ZZ] *= ir->wall_ewald_zfac;
         }
-    }
-
-    /* Do long-range electrostatics and/or LJ-PME, including related short-range
-     * corrections.
-     */
-
-    clear_mat(fr->vir_el_recip);
-    clear_mat(fr->vir_lj_recip);
-
-    if (EEL_FULL(fr->eeltype) || EVDW_PME(fr->vdwtype))
-    {
-        real Vlr_q             = 0, Vlr_lj = 0, Vcorr_q = 0, Vcorr_lj = 0;
-        real dvdl_long_range_q = 0, dvdl_long_range_lj = 0;
-        int  status            = 0;
 
         if (EEL_PME_EWALD(fr->eeltype) || EVDW_PME(fr->vdwtype))
         {
@@ -581,11 +575,8 @@ void do_force_lowlevel(FILE       *fplog,   gmx_int64_t step,
             PRINT_SEPDVDL("Ewald excl. corr. LJ", Vcorr_lj, dvdl_long_range_correction_lj);
             enerd->dvdl_lin[efptCOUL] += dvdl_long_range_correction_q;
             enerd->dvdl_lin[efptVDW]  += dvdl_long_range_correction_lj;
-        }
 
-        if ((EEL_PME(fr->eeltype) || EVDW_PME(fr->vdwtype)))
-        {
-            if (cr->duty & DUTY_PME)
+            if ((EEL_PME(fr->eeltype) || EVDW_PME(fr->vdwtype)) && (cr->duty & DUTY_PME))
             {
                 /* Do reciprocal PME for Coulomb and/or LJ. */
                 assert(fr->n_tpi >= 0);
index 7ca511886b10c5ad6e38c39e3d42fffe173c1f42..a14a2a18337db775b2c4383f5fe1377a874c7590 100644 (file)
@@ -190,7 +190,7 @@ static void call_error_handler(const char *key, const char *file, int line, cons
     gmx_error_handler(buf);
 }
 
-static void do_exit(bool bMaster, bool bFinalize)
+GMX_ATTRIBUTE_NORETURN static void do_exit(bool bMaster, bool bFinalize)
 {
     if (debug)
     {
index 0bc323260c02074cec8a9055f216cff11226ef66..29d24e72f96a2e8d865ec8fb64dbe32382006ce2 100644 (file)
@@ -68,8 +68,8 @@ extern "C" {
  * code generation.
  */
 #ifndef GMX_ATTRIBUTE_NORETURN
-#if __has_feature(attribute_analyzer_noreturn)
-#define GMX_ATTRIBUTE_NORETURN __attribute__((analyzer_noreturn))
+#if defined(__GNUC__) || __has_feature(attribute_analyzer_noreturn)
+#define GMX_ATTRIBUTE_NORETURN __attribute__((noreturn))
 #else
 #define GMX_ATTRIBUTE_NORETURN
 #endif