From: Roland Schulz Date: Thu, 8 May 2014 02:40:31 +0000 (-0400) Subject: Fix GCC 4.8 warnings X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=commitdiff_plain;h=c86ff994a1c2fc0c267f1b44a440d6f11b671553;p=alexxy%2Fgromacs.git Fix GCC 4.8 warnings 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 --- diff --git a/src/gromacs/fileio/tngio_for_tools.cpp b/src/gromacs/fileio/tngio_for_tools.cpp index d8fae47a14..d6239afb1e 100644 --- a/src/gromacs/fileio/tngio_for_tools.cpp +++ b/src/gromacs/fileio/tngio_for_tools.cpp @@ -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++) diff --git a/src/gromacs/gmxpreprocess/calc_verletbuf.c b/src/gromacs/gmxpreprocess/calc_verletbuf.c index 0dd3d502c7..0a668def8c 100644 --- a/src/gromacs/gmxpreprocess/calc_verletbuf.c +++ b/src/gromacs/gmxpreprocess/calc_verletbuf.c @@ -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]]; diff --git a/src/gromacs/mdlib/force.c b/src/gromacs/mdlib/force.c index e3e6d4ab72..73a0f565f8 100644 --- a/src/gromacs/mdlib/force.c +++ b/src/gromacs/mdlib/force.c @@ -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); diff --git a/src/gromacs/utility/fatalerror.cpp b/src/gromacs/utility/fatalerror.cpp index 7ca511886b..a14a2a1833 100644 --- a/src/gromacs/utility/fatalerror.cpp +++ b/src/gromacs/utility/fatalerror.cpp @@ -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) { diff --git a/src/gromacs/utility/fatalerror.h b/src/gromacs/utility/fatalerror.h index 0bc323260c..29d24e72f9 100644 --- a/src/gromacs/utility/fatalerror.h +++ b/src/gromacs/utility/fatalerror.h @@ -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