From 9909487191ec1f8910b65713b70ff669743778bb Mon Sep 17 00:00:00 2001 From: Teemu Murtola Date: Wed, 3 Jul 2013 14:00:39 +0300 Subject: [PATCH] More files to C++. Switch a few more files to C++ compilation and resolve issues found: add several extern "C" declarations, remove unused variables, move some static variables from headers to source files. Move gmx_ctime_r() declaration to string2.h; it must be better to have one extra declaration in an installed header than a mass of repeated declarations in source files. Remove a hack in smalloc.h; the code that prompted that seems to have been removed in the kernel reorganization for 4.6, and we are anyways not yet compiling a lot of legacy code with C++. Suppress most scanf() warnings in these files. Make cppcheck correctly parse #ifdef __cplusplus blocks. Add gmx_isnan(). The motivation for this selection of files is that these files write output files where either command_line() or Program() is used to indicate the currently running program. Will replace those calls with a uniform mechanism in a subsequent commit. Change-Id: Ic1e90fcc08b1be6d4d6d257215f9523625ab347a --- src/gromacs/gmxana/binsearch.h | 9 +++ src/gromacs/gmxana/dens_filter.h | 9 +++ src/gromacs/gmxana/gmx_covar.c | 5 -- .../{gmx_densorder.c => gmx_densorder.cpp} | 29 +++++----- .../gmxana/{gmx_dipoles.c => gmx_dipoles.cpp} | 58 +++++++++---------- src/gromacs/gmxana/powerspect.h | 9 +++ src/gromacs/gmxlib/checkpoint.c | 6 -- src/gromacs/gmxlib/{main.c => main.cpp} | 19 +----- src/gromacs/gmxlib/maths.c | 6 ++ src/gromacs/gmxlib/{matio.c => matio.cpp} | 20 ++++--- src/gromacs/gmxlib/{xvgr.c => xvgr.cpp} | 11 +--- src/gromacs/gmxpreprocess/CMakeLists.txt | 2 +- src/gromacs/gmxpreprocess/add_par.h | 9 +++ src/gromacs/gmxpreprocess/gen_vsite.h | 9 +++ .../gmxpreprocess/{pdb2top.c => pdb2top.cpp} | 56 ++++++++---------- src/gromacs/gmxpreprocess/pgutil.h | 9 +++ src/gromacs/gmxpreprocess/readir.c | 7 +++ src/gromacs/gmxpreprocess/readir.h | 8 --- src/gromacs/gmxpreprocess/topdirs.h | 9 +++ src/gromacs/legacyheaders/maths.h | 1 + src/gromacs/legacyheaders/pdb2top.h | 8 +++ src/gromacs/legacyheaders/smalloc.h | 43 +++++++------- src/gromacs/legacyheaders/string2.h | 3 + src/gromacs/legacyheaders/typedefs.h | 4 +- src/gromacs/mdlib/sim_util.c | 11 ---- tests/CppCheck.cmake | 4 ++ 26 files changed, 201 insertions(+), 163 deletions(-) rename src/gromacs/gmxana/{gmx_densorder.c => gmx_densorder.cpp} (97%) rename src/gromacs/gmxana/{gmx_dipoles.c => gmx_dipoles.cpp} (97%) rename src/gromacs/gmxlib/{main.c => main.cpp} (97%) rename src/gromacs/gmxlib/{matio.c => matio.cpp} (98%) rename src/gromacs/gmxlib/{xvgr.c => xvgr.cpp} (98%) rename src/gromacs/gmxpreprocess/{pdb2top.c => pdb2top.cpp} (97%) diff --git a/src/gromacs/gmxana/binsearch.h b/src/gromacs/gmxana/binsearch.h index 0bd47832bb..adc04d374b 100644 --- a/src/gromacs/gmxana/binsearch.h +++ b/src/gromacs/gmxana/binsearch.h @@ -39,6 +39,11 @@ #include "types/simple.h" +#ifdef __cplusplus +extern "C" +{ +#endif + extern void rangeArray(int *ar, int size); extern void insertionSort(real *ar, int *perm, int start, int end, int direction); @@ -51,4 +56,8 @@ extern int start_binsearch(real *array, int *perm, int low, int high, extern int LinearSearch(double *array, int startindx, int stopindx, double key, int *count, int direction); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/gromacs/gmxana/dens_filter.h b/src/gromacs/gmxana/dens_filter.h index 2c8069866d..3fbed9a0b8 100644 --- a/src/gromacs/gmxana/dens_filter.h +++ b/src/gromacs/gmxana/dens_filter.h @@ -39,10 +39,19 @@ #include "types/simple.h" +#ifdef __cplusplus +extern "C" +{ +#endif + extern gmx_bool convolution(int dataSize, real* in, int kernelSize, real* kernel); extern gmx_bool periodic_convolution(int dsize, real *in, int ksize, real* kernel); extern void gausskernel(real *out, int size, real var); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/gromacs/gmxana/gmx_covar.c b/src/gromacs/gmxana/gmx_covar.c index 956fc2fb39..46b8d4bda9 100644 --- a/src/gromacs/gmxana/gmx_covar.c +++ b/src/gromacs/gmxana/gmx_covar.c @@ -69,11 +69,6 @@ #include "gromacs/linearalgebra/eigensolver.h" -/* Portable version of ctime_r implemented in src/gmxlib/string2.c, but we do not want it declared in public installed headers */ -char * -gmx_ctime_r(const time_t *clock, char *buf, int n); - - int gmx_covar(int argc, char *argv[]) { const char *desc[] = { diff --git a/src/gromacs/gmxana/gmx_densorder.c b/src/gromacs/gmxana/gmx_densorder.cpp similarity index 97% rename from src/gromacs/gmxana/gmx_densorder.c rename to src/gromacs/gmxana/gmx_densorder.cpp index a7d7286598..841b464c20 100644 --- a/src/gromacs/gmxana/gmx_densorder.c +++ b/src/gromacs/gmxana/gmx_densorder.cpp @@ -118,7 +118,7 @@ static void density_in_time (const char *fn, atom_id **index, int gnx[], real bw gmx_rmpbc_t gpbc = NULL; matrix box; /* Box - 3x3 -each step*/ rvec *x0; /* List of Coord without PBC*/ - int natoms, i, j, k, n, /* loop indices, checks etc*/ + int i, j, /* loop indices, checks etc*/ ax1 = 0, ax2 = 0, /* tangent directions */ framenr = 0, /* frame number in trajectory*/ slicex, slicey, slicez; /*slice # of x y z position */ @@ -144,7 +144,7 @@ static void density_in_time (const char *fn, atom_id **index, int gnx[], real bw gmx_fatal(FARGS, "Invalid axes. Terminating\n"); } - if ( (natoms = read_first_x(oenv, &status, fn, &t, &x0, box)) == 0) + if (read_first_x(oenv, &status, fn, &t, &x0, box) == 0) { gmx_fatal(FARGS, "Could not read coordinates from file"); /* Open trajectory for read*/ @@ -182,7 +182,9 @@ static void density_in_time (const char *fn, atom_id **index, int gnx[], real bw bbww[ZZ] = box[axis][axis]/ *zslices; gmx_rmpbc(gpbc, top->atoms.nr, box, x0); /*Reset Densslice every nsttblock steps*/ - if (framenr % nsttblock == 0) + /* The first conditional is for clang to understand that this branch is + * always taken the first time. */ + if (Densslice == NULL || framenr % nsttblock == 0) { snew(Densslice, *xslices); for (i = 0; i < *xslices; i++) @@ -194,12 +196,13 @@ static void density_in_time (const char *fn, atom_id **index, int gnx[], real bw } } - /*Allocate Memory to extra frame in Densdevel - rather stupid approach: *A single frame each time, although only every nsttblock steps.*/ + /* Allocate Memory to extra frame in Densdevel - rather stupid approach: + * A single frame each time, although only every nsttblock steps. + */ srenew(*Densdevel, *tblock+1); - + (*Densdevel)[*tblock] = Densslice; } - dscale = (*xslices)*(*yslices)*(*zslices)*AMU/ (box[ax1][ax1]*box[ax2][ax2]*box[axis][axis]*nsttblock*(NANO*NANO*NANO)); if (bCenter) @@ -244,8 +247,6 @@ static void density_in_time (const char *fn, atom_id **index, int gnx[], real bw slicey = ((int) (y/bbww[YY])) % *yslices; slicez = ((int) (z/bbww[ZZ])) % *zslices; Densslice[slicex][slicey][slicez] += (top->atoms.atom[index[0][j]].m*dscale); - - } framenr++; @@ -254,7 +255,6 @@ static void density_in_time (const char *fn, atom_id **index, int gnx[], real bw { /*Implicit incrementation of Densdevel via renewal of Densslice*/ /*only every nsttblock steps*/ - (*Densdevel)[*tblock] = Densslice; (*tblock)++; } @@ -322,9 +322,8 @@ static void outputfield(const char *fldfn, real ****Densmap, static void filterdensmap(real ****Densmap, int xslices, int yslices, int zslices, int tblocks, int ftsize) { real *kernel; - real *output; real std, var; - int i, j, k, n, order; + int i, j, n, order; order = ftsize/2; std = ((real)order/2.0); var = std*std; @@ -355,8 +354,8 @@ static void interfaces_txy (real ****Densmap, int xslices, int yslices, int zsli real *zDensavg; /* zDensavg[z]*/ int i, j, k, n; int xysize; - int ndx1, ndx2, deltandx, *zperm; - real densmid, densl, densr, alpha, pos, spread; + int ndx1, ndx2, *zperm; + real densmid; real splitpoint, startpoint, endpoint; real *sigma1, *sigma2; real beginfit1[4]; @@ -657,7 +656,7 @@ int gmx_densorder(int argc, char *argv[]) output_env_t oenv; t_topology *top; - char title[STRLEN], **grpname; + char **grpname; int ePBC, *ngx; static real binw = 0.2; static real binwz = 0.05; @@ -666,7 +665,7 @@ int gmx_densorder(int argc, char *argv[]) static int ftorder = 0; static int nsttblock = 100; static int axis = 2; - static char *axtitle = "Z"; + static const char *axtitle = "Z"; atom_id **index; /* Index list for single group*/ int xslices, yslices, zslices, tblock; static gmx_bool bGraph = FALSE; diff --git a/src/gromacs/gmxana/gmx_dipoles.c b/src/gromacs/gmxana/gmx_dipoles.cpp similarity index 97% rename from src/gromacs/gmxana/gmx_dipoles.c rename to src/gromacs/gmxana/gmx_dipoles.cpp index ce92da2b90..1f0c2edf06 100644 --- a/src/gromacs/gmxana/gmx_dipoles.c +++ b/src/gromacs/gmxana/gmx_dipoles.cpp @@ -38,6 +38,8 @@ #include #include +#include + #include "macros.h" #include "statutil.h" #include "sysstuff.h" @@ -85,30 +87,28 @@ static t_gkrbin *mk_gkrbin(real radius, real rcmax, gmx_bool bPhi, int ndegrees) if ((ptr = getenv("GKRWIDTH")) != NULL) { - double bw; - - sscanf(ptr, "%lf", &bw); + double bw = strtod(ptr, NULL); gb->spacing = bw; } else { gb->spacing = 0.01; /* nm */ } - gb->nelem = 1 + radius/gb->spacing; + gb->nelem = 1 + static_cast(radius/gb->spacing); if (rcmax == 0) { gb->nx = gb->nelem; } else { - gb->nx = 1 + rcmax/gb->spacing; + gb->nx = 1 + static_cast(rcmax/gb->spacing); } gb->radius = radius; snew(gb->elem, gb->nelem); snew(gb->count, gb->nelem); snew(gb->cmap, gb->nx); - gb->ny = max(2, ndegrees); + gb->ny = std::max(2, ndegrees); for (i = 0; (i < gb->nx); i++) { snew(gb->cmap[i], gb->ny); @@ -141,13 +141,13 @@ static void add2gkr(t_gkrbin *gb, real r, real cosa, real phi) alpha = acos(cosa); if (gb->bPhi) { - cy = (M_PI+phi)*gb->ny/(2*M_PI); + cy = static_cast((M_PI+phi)*gb->ny/(2*M_PI)); } else { - cy = (alpha*gb->ny)/M_PI; /*((1+cosa)*0.5*(gb->ny));*/ + cy = static_cast((alpha*gb->ny)/M_PI); /*((1+cosa)*0.5*(gb->ny));*/ } - cy = min(gb->ny-1, max(0, cy)); + cy = std::min(gb->ny-1, std::max(0, cy)); if (debug) { fprintf(debug, "CY: %10f %5d\n", alpha, cy); @@ -171,8 +171,8 @@ void do_gkr(t_gkrbin *gb, int ncos, int *ngrp, int *molindex[], int ePBC, matrix box, t_atom *atom, int *nAtom) { static rvec *xcm[2] = { NULL, NULL}; - int gi, gj, j0, j1, i, j, k, n, index, grp0, grp1; - real qtot, q, r2, cosa, rr, phi; + int gi, gj, j0, j1, i, j, k, n, grp0, grp1; + real qtot, q, cosa, rr, phi; rvec dx; t_pbc pbc; @@ -247,7 +247,7 @@ void do_gkr(t_gkrbin *gb, int ncos, int *ngrp, int *molindex[], cosa = cos_angle(mu[gi], mu[gj]); phi = 0; } - if (debug || (cosa != cosa)) + if (debug || gmx_isnan(cosa)) { fprintf(debug ? debug : stderr, "mu[%d] = %5.2f %5.2f %5.2f |mi| = %5.2f, mu[%d] = %5.2f %5.2f %5.2f |mj| = %5.2f rr = %5.2f cosa = %5.2f\n", @@ -265,7 +265,8 @@ void do_gkr(t_gkrbin *gb, int ncos, int *ngrp, int *molindex[], static real normalize_cmap(t_gkrbin *gb) { int i, j; - double hi, vol; + real hi; + double vol; hi = 0; for (i = 0; (i < gb->nx); i++) @@ -274,7 +275,7 @@ static real normalize_cmap(t_gkrbin *gb) for (j = 0; (j < gb->ny); j++) { gb->cmap[i][j] /= vol; - hi = max(hi, gb->cmap[i][j]); + hi = std::max(hi, gb->cmap[i][j]); } } if (hi <= 0) @@ -336,7 +337,7 @@ static void print_gkrbin(const char *fn, t_gkrbin *gb, */ FILE *fp; const char *leg[] = { "G\\sk\\N(r)", "< cos >", "h\\sOO\\N", "g\\sOO\\N", "Energy" }; - int i, j, n, last; + int i, last; real x0, x1, ggg, Gkr, vol_s, rho, gOO, hOO, cosav, ener; double fac; @@ -492,7 +493,6 @@ static void mol_quad(int k0, int k1, rvec x[], t_atom atom[], rvec quad) real q, r2, mass, masstot; rvec com; /* center of mass */ rvec r; /* distance of atoms to center of mass */ - real rcom_m, rcom_n; double **inten; double dd[DIM], **ev, tmp; @@ -688,7 +688,7 @@ static void dump_slab_dipoles(const char *fn, int idim, int nslice, static void compute_avercos(int n, rvec dip[], real *dd, rvec axis, gmx_bool bPairs) { int i, j, k; - double dc, dc1, d, n5, ddc1, ddc2, ddc3; + double dc, d, ddc1, ddc2, ddc3; rvec xxx = { 1, 0, 0 }; rvec yyy = { 0, 1, 0 }; rvec zzz = { 0, 0, 1 }; @@ -779,19 +779,18 @@ static void do_dip(t_topology *top, int ePBC, real volume, t_enxframe *fr; int nframes = 1000, nre, timecheck = 0, ncolour = 0; ener_file_t fmu = NULL; - int i, j, k, n, m, natom = 0, nmol, gnx_tot, teller, tel3; + int i, n, m, natom = 0, gnx_tot, teller, tel3; t_trxstatus *status; - int *dipole_bin, ndipbin, ibin, iVol, step, idim = -1; + int *dipole_bin, ndipbin, ibin, iVol, idim = -1; unsigned long mode; - char buf[STRLEN]; - real rcut = 0, t, t0, t1, dt, lambda, dd, rms_cos; + real rcut = 0, t, t0, t1, dt, dd, rms_cos; rvec dipaxis; matrix box; gmx_bool bCorr, bTotal, bCont; double M_diff = 0, epsilon, invtel, vol_aver; double mu_ave, mu_mol, M2_ave = 0, M_ave2 = 0, M_av[DIM], M_av2[DIM]; double M[3], M2[3], M4[3], Gk = 0, g_k = 0; - gmx_stats_t Mx, My, Mz, Msq, Vol, *Qlsq, mulsq, muframelsq = NULL; + gmx_stats_t *Qlsq, mulsq, muframelsq = NULL; ivec iMu; real **muall = NULL; rvec *slab_dipoles = NULL; @@ -996,9 +995,8 @@ static void do_dip(t_topology *top, int ePBC, real volume, } /* Calculate spacing for dipole bin (simple histogram) */ - ndipbin = 1+(mu_max/0.01); + ndipbin = 1 + static_cast(mu_max/0.01); snew(dipole_bin, ndipbin); - epsilon = 0.0; mu_ave = 0.0; for (m = 0; (m < DIM); m++) { @@ -1016,7 +1014,7 @@ static void do_dip(t_topology *top, int ePBC, real volume, gpbc = gmx_rmpbc_init(&top->idef, ePBC, natom); /* Start while loop over frames */ - t1 = t0 = t; + t0 = t; teller = 0; do { @@ -1068,7 +1066,7 @@ static void do_dip(t_topology *top, int ePBC, real volume, { for (i = 0; (i < gnx[n]); i++) { - int gi, ind0, ind1; + int ind0, ind1; ind0 = mols->index[molindex[n][i]]; ind1 = mols->index[molindex[n][i]+1]; @@ -1393,7 +1391,7 @@ static void do_dip(t_topology *top, int ePBC, real volume, } if (!bMU) { - real aver, sigma, error, lsq; + real aver, sigma, error; gmx_stats_get_ase(mulsq, &aver, &sigma, &error); printf("\nDipole moment (Debye)\n"); @@ -1403,7 +1401,6 @@ static void do_dip(t_topology *top, int ePBC, real volume, if (bQuad) { rvec a, s, e; - int mm; for (m = 0; (m < DIM); m++) { gmx_stats_get_ase(mulsq, &(a[m]), &(s[m]), &(e[m])); @@ -1530,7 +1527,7 @@ int gmx_dipoles(int argc, char *argv[]) }; real mu_max = 5, mu_aver = -1, rcmax = 0; real epsilonRF = 0.0, temp = 300; - gmx_bool bAverCorr = FALSE, bMolCorr = FALSE, bPairs = TRUE, bPhi = FALSE, bQuad = FALSE; + gmx_bool bPairs = TRUE, bPhi = FALSE, bQuad = FALSE; const char *corrtype[] = {NULL, "none", "mol", "molsep", "total", NULL}; const char *axtitle = "Z"; int nslices = 10; /* nr of slices defined */ @@ -1577,7 +1574,7 @@ int gmx_dipoles(int argc, char *argv[]) int nFF[2]; atom_id **grpindex; char **grpname = NULL; - gmx_bool bCorr, bGkr, bMU, bSlab; + gmx_bool bGkr, bMU, bSlab; t_filenm fnm[] = { { efEDR, "-en", NULL, ffOPTRD }, { efTRX, "-f", NULL, ffREAD }, @@ -1633,7 +1630,6 @@ int gmx_dipoles(int argc, char *argv[]) opt2parg_bSet("-axis", asize(pa), pa)); if (bMU) { - bAverCorr = TRUE; if (bQuad) { printf("WARNING: Can not determine quadrupoles from energy file\n"); diff --git a/src/gromacs/gmxana/powerspect.h b/src/gromacs/gmxana/powerspect.h index 7d6c087157..21351358d3 100644 --- a/src/gromacs/gmxana/powerspect.h +++ b/src/gromacs/gmxana/powerspect.h @@ -39,10 +39,19 @@ #include "typedefs.h" #include "interf.h" +#ifdef __cplusplus +extern "C" +{ +#endif + extern void powerspectavg(real ***interface, int t, int xbins, int ybins, char **outfiles); extern void powerspectavg_intf(t_interf ***if1, t_interf ***if2, int t, int xbins, int ybins, char **outfiles); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/gromacs/gmxlib/checkpoint.c b/src/gromacs/gmxlib/checkpoint.c index 23aa493db5..8aab4c436a 100644 --- a/src/gromacs/gmxlib/checkpoint.c +++ b/src/gromacs/gmxlib/checkpoint.c @@ -64,12 +64,6 @@ #include "corewrap.h" #endif - -/* Portable version of ctime_r implemented in src/gmxlib/string2.c, but we do not want it declared in public installed headers */ -char * -gmx_ctime_r(const time_t *clock, char *buf, int n); - - #define CPT_MAGIC1 171817 #define CPT_MAGIC2 171819 #define CPTSTRLEN 1024 diff --git a/src/gromacs/gmxlib/main.c b/src/gromacs/gmxlib/main.cpp similarity index 97% rename from src/gromacs/gmxlib/main.c rename to src/gromacs/gmxlib/main.cpp index 05b262d5c4..1784c29ab1 100644 --- a/src/gromacs/gmxlib/main.c +++ b/src/gromacs/gmxlib/main.cpp @@ -75,12 +75,6 @@ #include #endif - -/* Portable version of ctime_r implemented in src/gmxlib/string2.c, but we do not want it declared in public installed headers */ -char * -gmx_ctime_r(const time_t *clock, char *buf, int n); - - #define BUFSIZE 1024 @@ -88,8 +82,6 @@ static void par_fn(char *base, int ftp, const t_commrec *cr, gmx_bool bAppendSimId, gmx_bool bAppendNodeId, char buf[], int bufsize) { - int n; - if ((size_t)bufsize < (strlen(base)+10)) { gmx_mem("Character buffer too small!"); @@ -252,7 +244,7 @@ char *gmx_gethostname(char *name, size_t len) void gmx_log_open(const char *lognm, const t_commrec *cr, gmx_bool bMasterOnly, gmx_bool bAppendFiles, FILE** fplog) { - int len, testlen, pid; + int len, pid; char buf[256], host[256]; time_t t; char timebuf[STRLEN]; @@ -400,8 +392,8 @@ void init_multisystem(t_commrec *cr, int nsim, char **multidirs, char buf[256]; #ifdef GMX_MPI MPI_Group mpi_group_world; -#endif int *rank; +#endif #ifndef GMX_MPI if (nsim > 1) @@ -478,7 +470,6 @@ void init_multisystem(t_commrec *cr, int nsim, char **multidirs, if (multidirs) { - int ret; if (debug) { fprintf(debug, "Changing to directory %s\n", multidirs[cr->ms->sim]); @@ -509,15 +500,11 @@ void init_multisystem(t_commrec *cr, int nsim, char **multidirs, t_commrec *init_par(int gmx_unused *argc, char ***argv_ptr) { t_commrec *cr; - char **argv; - int i; - gmx_bool pe = FALSE; snew(cr, 1); - argv = argv_ptr ? *argv_ptr : NULL; - #if defined GMX_MPI && !defined GMX_THREAD_MPI + char **argv = argv_ptr ? *argv_ptr : NULL; cr->sim_nodeid = gmx_setup(argc, argv, &cr->nnodes); if (!PAR(cr) && (cr->sim_nodeid != 0)) diff --git a/src/gromacs/gmxlib/maths.c b/src/gromacs/gmxlib/maths.c index 46b34640a0..c857856bb0 100644 --- a/src/gromacs/gmxlib/maths.c +++ b/src/gromacs/gmxlib/maths.c @@ -749,6 +749,12 @@ gmx_bool gmx_isfinite(real x) return returnval; } +gmx_bool gmx_isnan(real x) +{ + /* cppcheck-suppress duplicateExpression */ + return x != x; +} + gmx_bool check_int_multiply_for_overflow(gmx_large_int_t a, gmx_large_int_t b, diff --git a/src/gromacs/gmxlib/matio.c b/src/gromacs/gmxlib/matio.cpp similarity index 98% rename from src/gromacs/gmxlib/matio.c rename to src/gromacs/gmxlib/matio.cpp index f13351cc2f..7ab142ba7b 100644 --- a/src/gromacs/gmxlib/matio.c +++ b/src/gromacs/gmxlib/matio.cpp @@ -38,6 +38,9 @@ #include #include + +#include + #include "sysstuff.h" #include "futil.h" #include "string2.h" @@ -283,7 +286,7 @@ void read_xpm_entry(FILE *in, t_matrix *mm) { t_mapping *map; char *line_buf = NULL, *line = NULL, *str, buf[256] = {0}; - int i, m, col_len, nch, n_axis_x, n_axis_y, llmax; + int i, m, col_len, nch = 0, n_axis_x, n_axis_y, llmax; int llalloc = 0; unsigned int r, g, b; double u; @@ -351,7 +354,7 @@ void read_xpm_entry(FILE *in, t_matrix *mm) { gmx_fatal(FARGS, "Dimensions of xpm-file have to be larger than 0\n"); } - llmax = max(STRLEN, mm->nx+10); + llmax = std::max(STRLEN, mm->nx+10); bGetOnWithIt = TRUE; } } @@ -360,6 +363,10 @@ void read_xpm_entry(FILE *in, t_matrix *mm) fprintf(debug, "mm->nx %d mm->ny %d mm->nmap %d nch %d\n", mm->nx, mm->ny, mm->nmap, nch); } + if (nch == 0) + { + gmx_fatal(FARGS, "Number of characters per pixel not found in xpm\n"); + } /* Read color map */ snew(map, mm->nmap); @@ -441,7 +448,6 @@ void read_xpm_entry(FILE *in, t_matrix *mm) /* Read axes, if there are any */ n_axis_x = 0; n_axis_y = 0; - bGetOnWithIt = FALSE; bSetLine = FALSE; do { @@ -659,7 +665,8 @@ static int calc_nmid(int nlevels, real lo, real mid, real hi) { /* Take care that we have at least 1 entry in the mid to hi range */ - return min(max(0, ((mid-lo)/(hi-lo))*(nlevels-1)), nlevels-1); + return std::min(std::max(0, static_cast(((mid-lo)/(hi-lo))*(nlevels-1))), + nlevels-1); } void write_xpm_map3(FILE *out, int n_x, int n_y, int *nlevels, @@ -766,7 +773,7 @@ static void pr_discrete_cmap(FILE *out, int *nlevel, int i0) int i, n; - *nlevel = min(16, *nlevel); + *nlevel = std::min(16, *nlevel); n = *nlevel; for (i = 0; (i < n); i++) { @@ -789,8 +796,7 @@ void write_xpm_map_split(FILE *out, int n_x, int n_y, int *nlevel_bot, real lo_bot, real hi_bot, t_rgb rlo_bot, t_rgb rhi_bot) { - int i, ntot; - real r, g, b, fac; + int ntot; ntot = *nlevel_top + *nlevel_bot; if (ntot > NMAP) diff --git a/src/gromacs/gmxlib/xvgr.c b/src/gromacs/gmxlib/xvgr.cpp similarity index 98% rename from src/gromacs/gmxlib/xvgr.c rename to src/gromacs/gmxlib/xvgr.cpp index 24d9598447..4dff383479 100644 --- a/src/gromacs/gmxlib/xvgr.c +++ b/src/gromacs/gmxlib/xvgr.cpp @@ -56,11 +56,6 @@ #include "vec.h" #include "gmxfio.h" -/* Portable version of ctime_r implemented in src/gmxlib/string2.c, but we do not want it declared in public installed headers */ -char * -gmx_ctime_r(const time_t *clock, char *buf, int n); - - gmx_bool output_env_get_print_xvgr_codes(const output_env_t oenv) { int xvg_format; @@ -284,7 +279,6 @@ FILE *xvgropen_type(const char *fn, const char *title, const char *xaxis, const output_env_t oenv) { FILE *fp; - time_t t; fp = gmx_fio_fopen(fn, "w"); @@ -441,7 +435,6 @@ void xvgr_box(FILE *out, /* reads a line into ptr, adjusting len and renewing ptr if neccesary */ static char *fgets3(FILE *fp, char **ptr, int *len, int maxlen) { - char *p; int len_remaining = *len; /* remaining amount of allocated bytes in buf */ int curp = 0; /* current position in buf to read into */ @@ -551,7 +544,7 @@ int read_xvg_legend(const char *fn, double ***y, int *ny, char **subtitle, char ***legend) { FILE *fp; - char *ptr, *ptr0, *ptr1; + char *ptr; char *base = NULL; char *fmt = NULL; int k, line = 0, nny, nx, maxx, rval, legend_nalloc, set, nchar; @@ -738,7 +731,7 @@ real **read_xvg_time(const char *fn, char line0[MAXLINELEN]; char *line; int t_nalloc, *val_nalloc, a, narg, n, sin, set, nchar; - double dbl, tend = 0; + double dbl; gmx_bool bEndOfSet, bTimeInRange, bFirstLine = TRUE; real **val; diff --git a/src/gromacs/gmxpreprocess/CMakeLists.txt b/src/gromacs/gmxpreprocess/CMakeLists.txt index c50ad9e6cb..db57c809d0 100644 --- a/src/gromacs/gmxpreprocess/CMakeLists.txt +++ b/src/gromacs/gmxpreprocess/CMakeLists.txt @@ -1,3 +1,3 @@ -file(GLOB GMXPREPROCESS_SOURCES *.c) +file(GLOB GMXPREPROCESS_SOURCES *.c *.cpp) set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${GMXPREPROCESS_SOURCES} PARENT_SCOPE) diff --git a/src/gromacs/gmxpreprocess/add_par.h b/src/gromacs/gmxpreprocess/add_par.h index 355625e219..a6f52f35ee 100644 --- a/src/gromacs/gmxpreprocess/add_par.h +++ b/src/gromacs/gmxpreprocess/add_par.h @@ -39,6 +39,11 @@ #include "typedefs.h" #include "pdb2top.h" +#ifdef __cplusplus +extern "C" +{ +#endif + extern void add_param(t_params *ps, int ai, int aj, real *c, char *s); extern void add_imp_param(t_params *ps, int ai, int aj, int ak, int al, @@ -65,4 +70,8 @@ extern void add_vsite4_atoms(t_params *ps, int ai, int aj, int ak, int al, extern int search_jtype(t_restp *rp, char *name, gmx_bool bFirstRes); +#ifdef __cplusplus +} +#endif + #endif /* _add_par_h */ diff --git a/src/gromacs/gmxpreprocess/gen_vsite.h b/src/gromacs/gmxpreprocess/gen_vsite.h index 19e889f4da..ffd8f4f1b7 100644 --- a/src/gromacs/gmxpreprocess/gen_vsite.h +++ b/src/gromacs/gmxpreprocess/gen_vsite.h @@ -41,6 +41,11 @@ #include "gpp_atomtype.h" #include "hackblock.h" +#ifdef __cplusplus +extern "C" +{ +#endif + /* stuff for pdb2gmx */ extern void do_vsites(int nrtp, t_restp rtp[], gpp_atomtype_t atype, @@ -52,4 +57,8 @@ extern void do_vsites(int nrtp, t_restp rtp[], gpp_atomtype_t atype, extern void do_h_mass(t_params *psb, int vsite_type[], t_atoms *at, real mHmult, gmx_bool bDeuterate); +#ifdef __cplusplus +} +#endif + #endif /* _gen_vsite_h */ diff --git a/src/gromacs/gmxpreprocess/pdb2top.c b/src/gromacs/gmxpreprocess/pdb2top.cpp similarity index 97% rename from src/gromacs/gmxpreprocess/pdb2top.c rename to src/gromacs/gmxpreprocess/pdb2top.cpp index 0237afc893..b4815c43f5 100644 --- a/src/gromacs/gmxpreprocess/pdb2top.c +++ b/src/gromacs/gmxpreprocess/pdb2top.cpp @@ -75,7 +75,7 @@ static int missing_atoms(t_restp *rp, int resind, t_atoms *at, int i0, int i) { int j, k, nmiss; char *name; - gmx_bool bFound, bRet; + gmx_bool bFound; nmiss = 0; for (j = 0; j < rp->natom; j++) @@ -294,13 +294,14 @@ choose_ff(const char *ffsel, } sfree(desc); + sel = -1; do { pret = fgets(buf, STRLEN, stdin); if (pret != NULL) { - sscanf(buf, "%d", &sel); + sel = strtol(buf, NULL, 10); sel--; } } @@ -408,13 +409,14 @@ void choose_watermodel(const char *wmsel, const char *ffdir, ffclose(fp); fprintf(stderr, "%2d: %s\n", nwm+1, "None"); + sel = -1; do { pret = fgets(buf, STRLEN, stdin); if (pret != NULL) { - sscanf(buf, "%d", &sel); + sel = strtol(buf, NULL, 10); sel--; } } @@ -441,14 +443,13 @@ static int name2type(t_atoms *at, int **cgnr, gpp_atomtype_t atype, { int i, j, prevresind, resind, i0, prevcg, cg, curcg; char *name; - gmx_bool bProt, bNterm; + gmx_bool bNterm; double qt; int nmissat; nmissat = 0; resind = -1; - bProt = FALSE; bNterm = FALSE; i0 = 0; snew(*cgnr, at->nr); @@ -463,6 +464,7 @@ static int name2type(t_atoms *at, int **cgnr, gpp_atomtype_t atype, prevresind = resind; if (at->atom[i].resind != resind) { + gmx_bool bProt; resind = at->atom[i].resind; bProt = gmx_residuetype_is_protein(rt, *(at->resinfo[resind].name)); bNterm = bProt && (resind == 0); @@ -545,7 +547,6 @@ void print_top_comment(FILE *out, const char *ffdir, gmx_bool bITP) { - char tmp[256]; char ffdir_parent[STRLEN]; char *p; @@ -800,9 +801,9 @@ static void at2bonds(t_params *psb, t_hackblock *hb, * for missing atoms in bonds, as the hydrogens and terminal atoms * have not been added yet. */ - ai = search_atom(hb[resind].rb[ebtsBONDS].b[j].AI, i, atoms, + ai = search_atom(hb[resind].rb[ebtsBONDS].b[j].a[0], i, atoms, ptr, TRUE); - aj = search_atom(hb[resind].rb[ebtsBONDS].b[j].AJ, i, atoms, + aj = search_atom(hb[resind].rb[ebtsBONDS].b[j].a[1], i, atoms, ptr, TRUE); if (ai != NO_ATID && aj != NO_ATID) { @@ -827,7 +828,7 @@ static void at2bonds(t_params *psb, t_hackblock *hb, { if ( ( hb[resind].hack[j].tp > 0 || hb[resind].hack[j].oname == NULL ) && - strcmp(hb[resind].hack[j].AI, *(atoms->atomname[i])) == 0) + strcmp(hb[resind].hack[j].a[0], *(atoms->atomname[i])) == 0) { switch (hb[resind].hack[j].tp) { @@ -857,10 +858,10 @@ static int pcompar(const void *a, const void *b) pa = (t_param *)a; pb = (t_param *)b; - d = pa->AI - pb->AI; + d = pa->a[0] - pb->a[0]; if (d == 0) { - d = pa->AJ - pb->AJ; + d = pa->a[1] - pb->a[1]; } if (d == 0) { @@ -882,11 +883,11 @@ static void clean_bonds(t_params *ps) /* swap atomnumbers in bond if first larger than second: */ for (i = 0; (i < ps->nr); i++) { - if (ps->param[i].AJ < ps->param[i].AI) + if (ps->param[i].a[1] < ps->param[i].a[0]) { - a = ps->param[i].AI; - ps->param[i].AI = ps->param[i].AJ; - ps->param[i].AJ = a; + a = ps->param[i].a[0]; + ps->param[i].a[0] = ps->param[i].a[1]; + ps->param[i].a[1] = a; } } @@ -897,8 +898,8 @@ static void clean_bonds(t_params *ps) j = 1; for (i = 1; (i < ps->nr); i++) { - if ((ps->param[i].AI != ps->param[j-1].AI) || - (ps->param[i].AJ != ps->param[j-1].AJ) ) + if ((ps->param[i].a[0] != ps->param[j-1].a[0]) || + (ps->param[i].a[1] != ps->param[j-1].a[1]) ) { if (j != i) { @@ -1031,10 +1032,8 @@ void get_hackblocks_rtp(t_hackblock **hb, t_restp **restp, int i, j, k, l; char *key; t_restp *res; - char buf[STRLEN]; - const char *Hnum = "123456"; int tern, terc; - gmx_bool bN, bC, bRM; + gmx_bool bRM; snew(*hb, nres); snew(*restp, nres); @@ -1114,7 +1113,7 @@ void get_hackblocks_rtp(t_hackblock **hb, t_restp **restp, for (l = 0; l < (*restp)[i].natom; l++) { if ( ( (*hb)[i].hack[j].oname == NULL && - strcmp((*hb)[i].hack[j].AI, *(*restp)[i].atomname[l]) == 0 ) || + strcmp((*hb)[i].hack[j].a[0], *(*restp)[i].atomname[l]) == 0 ) || ( (*hb)[i].hack[j].oname != NULL && strcmp((*hb)[i].hack[j].oname, *(*restp)[i].atomname[l]) == 0 ) ) { @@ -1139,7 +1138,7 @@ void get_hackblocks_rtp(t_hackblock **hb, t_restp **restp, "atom %s not found in buiding block %d%s " "while combining tdb and rtp", (*hb)[i].hack[j].oname != NULL ? - (*hb)[i].hack[j].oname : (*hb)[i].hack[j].AI, + (*hb)[i].hack[j].oname : (*hb)[i].hack[j].a[0], i+1, *resinfo[i].rtp); } } @@ -1234,7 +1233,7 @@ static gmx_bool match_atomnames_with_rtp_atom(t_atoms *pdba, rvec *x, int atind, gmx_bool bVerbose) { int resnr; - int i, j, k; + int j, k; char *oldnm, *newnm; int anmnr; char *start_at, buf[STRLEN]; @@ -1390,20 +1389,13 @@ void match_atomnames_with_rtp(t_restp restp[], t_hackblock hb[], t_atoms *pdba, rvec *x, gmx_bool bVerbose) { - int i, j, k; - char *oldnm, *newnm; - int resnr; + int i, j; + char *oldnm; t_restp *rptr; - t_hackblock *hbr; - int anmnr; - char *start_at, buf[STRLEN]; - int start_nr; - gmx_bool bFoundInAdd; for (i = 0; i < pdba->nr; i++) { oldnm = *pdba->atomname[i]; - resnr = pdba->resinfo[pdba->atom[i].resind].nr; rptr = &restp[pdba->atom[i].resind]; for (j = 0; (j < rptr->natom); j++) { diff --git a/src/gromacs/gmxpreprocess/pgutil.h b/src/gromacs/gmxpreprocess/pgutil.h index bedc68468d..e193ee10ee 100644 --- a/src/gromacs/gmxpreprocess/pgutil.h +++ b/src/gromacs/gmxpreprocess/pgutil.h @@ -38,6 +38,11 @@ #include "typedefs.h" +#ifdef __cplusplus +extern "C" +{ +#endif + extern atom_id search_atom(const char *type, int start, t_atoms *atoms, const char *bondtype, gmx_bool bAllowMissing); @@ -50,4 +55,8 @@ extern atom_id search_atom(const char *type, int start, extern void set_at(t_atom *at, real m, real q, int type, int resind); +#ifdef __cplusplus +} +#endif + #endif /* _pgutil_h */ diff --git a/src/gromacs/gmxpreprocess/readir.c b/src/gromacs/gmxpreprocess/readir.c index a0221554e5..666f5eae7f 100644 --- a/src/gromacs/gmxpreprocess/readir.c +++ b/src/gromacs/gmxpreprocess/readir.c @@ -100,6 +100,13 @@ enum { * make a rest group for the remaining particles. */ }; +static const char *constraints[eshNR+1] = { + "none", "h-bonds", "all-bonds", "h-angles", "all-angles", NULL +}; + +static const char *couple_lam[ecouplamNR+1] = { + "vdw-q", "vdw", "q", "none", NULL +}; void init_ir(t_inputrec *ir, t_gromppopts *opts) { diff --git a/src/gromacs/gmxpreprocess/readir.h b/src/gromacs/gmxpreprocess/readir.h index 4bf1c5334f..613d9b878d 100644 --- a/src/gromacs/gmxpreprocess/readir.h +++ b/src/gromacs/gmxpreprocess/readir.h @@ -45,18 +45,10 @@ enum { eshNONE, eshHBONDS, eshALLBONDS, eshHANGLES, eshALLANGLES, eshNR }; -static const char *constraints[eshNR+1] = { - "none", "h-bonds", "all-bonds", "h-angles", "all-angles", NULL -}; - enum { ecouplamVDWQ, ecouplamVDW, ecouplamQ, ecouplamNONE, ecouplamNR }; -static const char *couple_lam[ecouplamNR+1] = { - "vdw-q", "vdw", "q", "none", NULL -}; - typedef struct { int warnings; int nshake; diff --git a/src/gromacs/gmxpreprocess/topdirs.h b/src/gromacs/gmxpreprocess/topdirs.h index ff049e32ba..17889d75e8 100644 --- a/src/gromacs/gmxpreprocess/topdirs.h +++ b/src/gromacs/gmxpreprocess/topdirs.h @@ -38,6 +38,11 @@ #include "grompp.h" +#ifdef __cplusplus +extern "C" +{ +#endif + typedef struct tagDirStack { directive d; struct tagDirStack *prev; @@ -59,4 +64,8 @@ extern int DS_Search (DirStack *DS, directive d); extern int DS_Check_Order (DirStack *DS, directive d); +#ifdef __cplusplus +} +#endif + #endif /* _topdirs_h */ diff --git a/src/gromacs/legacyheaders/maths.h b/src/gromacs/legacyheaders/maths.h index 854f10df33..567119624b 100644 --- a/src/gromacs/legacyheaders/maths.h +++ b/src/gromacs/legacyheaders/maths.h @@ -97,6 +97,7 @@ float gmx_erfcf(float x); #endif gmx_bool gmx_isfinite(real x); +gmx_bool gmx_isnan(real x); /*! \brief Check if two numbers are within a tolerance * diff --git a/src/gromacs/legacyheaders/pdb2top.h b/src/gromacs/legacyheaders/pdb2top.h index 16bc1b4137..6f6fc9c14a 100644 --- a/src/gromacs/legacyheaders/pdb2top.h +++ b/src/gromacs/legacyheaders/pdb2top.h @@ -42,6 +42,11 @@ #include "toputil.h" #include "hackblock.h" +#ifdef __cplusplus +extern "C" +{ +#endif + /* this *MUST* correspond to array in pdb2top.c */ enum { ehisA, ehisB, ehisH, ehis1, ehisNR @@ -120,5 +125,8 @@ void pdb2top(FILE *top_file, char *posre_fn, char *molname, void print_sums(t_atoms *atoms, gmx_bool bSystem); +#ifdef __cplusplus +} +#endif #endif /* _pdb2top_h */ diff --git a/src/gromacs/legacyheaders/smalloc.h b/src/gromacs/legacyheaders/smalloc.h index b7f9b4ad28..72869c3878 100644 --- a/src/gromacs/legacyheaders/smalloc.h +++ b/src/gromacs/legacyheaders/smalloc.h @@ -152,52 +152,55 @@ void save_free_aligned(const char *name, const char *file, int line, void *ptr); /* Use of sizeof(T) in _snew() and _srenew() can cause obscure bugs if * several files define distinct data structures with identical names and - * allocate memory for them using the macros below. - * For this reason, the size of an element is passed as a parameter. - * + * allocate memory for them using the macros below. Note that by the standard, + * such declarations cause undefined behavior. * The C versions work fine in such cases, but when compiled with a C++ * compiler (and if the compiler does not inline the calls), the linker cannot * tell that data structures with identical names are actually different and * links calls to these template functions incorrectly, which can result in * allocation of an incorrect amount of memory if the element size is computed - * within the function. Even with the size passed as a parameter, incorrect - * linkage will occur, but as the type is now only present in the cast, it - * should not cause problems. + * within the function. + * + * This could be solved by passing the size as a parameter, but this has other + * issues: it provokes warnings from cppcheck for some invokations. + * Even with the size passed as a parameter, incorrect linkage will occur. + * When converting files to C++, locally declared structs should be enclosed in + * anonymous namespaces or some other means taken to ensure they are unique. */ -template +template inline void _snew(const char *name, const char *file, int line, - T * &ptr, size_t nelem, size_t elsize) + T * &ptr, size_t nelem) { - ptr = (T *)save_calloc(name, file, line, nelem, elsize); + ptr = (T *)save_calloc(name, file, line, nelem, sizeof(T)); } -template +template inline void _srenew(const char *name, const char *file, int line, - T * &ptr, size_t nelem, size_t elsize) + T * &ptr, size_t nelem) { - ptr = (T *)save_realloc(name, file, line, ptr, nelem, elsize); + ptr = (T *)save_realloc(name, file, line, ptr, nelem, sizeof(T)); } -template +template inline void _smalloc(const char *name, const char *file, int line, T * &ptr, size_t size) { ptr = (T *)save_malloc(name, file, line, size); } -template +template inline void _srealloc(const char *name, const char *file, int line, T * &ptr, size_t size) { ptr = (T *)save_realloc(name, file, line, ptr, size, sizeof(char)); } -template +template inline void _snew_aligned(const char *name, const char *file, int line, - T * &ptr, size_t nelem, size_t elsize, size_t alignment) + T * &ptr, size_t nelem, size_t alignment) { - ptr = (T *)save_calloc_aligned(name, file, line, nelem, elsize, alignment); + ptr = (T *)save_calloc_aligned(name, file, line, nelem, sizeof(T), alignment); } -#define snew(ptr, nelem) _snew(#ptr, __FILE__, __LINE__, (ptr), (nelem), sizeof(*(ptr))) -#define srenew(ptr, nelem) _srenew(#ptr, __FILE__, __LINE__, (ptr), (nelem), sizeof(*(ptr))) +#define snew(ptr, nelem) _snew(#ptr, __FILE__, __LINE__, (ptr), (nelem)) +#define srenew(ptr, nelem) _srenew(#ptr, __FILE__, __LINE__, (ptr), (nelem)) #define smalloc(ptr, size) _smalloc(#ptr, __FILE__, __LINE__, (ptr), (size)) #define srealloc(ptr, size) _srealloc(#ptr, __FILE__, __LINE__, (ptr), (size)) -#define snew_aligned(ptr, nelem, alignment) _snew_aligned(#ptr, __FILE__, __LINE__, (ptr), (nelem), sizeof(*(ptr)), alignment) +#define snew_aligned(ptr, nelem, alignment) _snew_aligned(#ptr, __FILE__, __LINE__, (ptr), (nelem), alignment) #else /* __cplusplus */ diff --git a/src/gromacs/legacyheaders/string2.h b/src/gromacs/legacyheaders/string2.h index b29861b9d1..4a847426f8 100644 --- a/src/gromacs/legacyheaders/string2.h +++ b/src/gromacs/legacyheaders/string2.h @@ -115,6 +115,9 @@ void rtrim(char *str); /** Remove leading and trailing whitespace from a string. */ void trim(char *str); +/** Portable version of ctime_r. */ +char *gmx_ctime_r(const time_t *clock, char *buf, int n); + /** Prints creation time stamp and user information into a file as comments. */ void nice_header(FILE *out, const char *fn); diff --git a/src/gromacs/legacyheaders/typedefs.h b/src/gromacs/legacyheaders/typedefs.h index 9956e9019b..9df66ff50d 100644 --- a/src/gromacs/legacyheaders/typedefs.h +++ b/src/gromacs/legacyheaders/typedefs.h @@ -99,10 +99,10 @@ int over_alloc_dd(int n); */ /* Over allocation for small data types: int, real etc. */ -#define over_alloc_small(n) (OVER_ALLOC_FAC*(n) + 8000) +#define over_alloc_small(n) (int)(OVER_ALLOC_FAC*(n) + 8000) /* Over allocation for large data types: complex structs */ -#define over_alloc_large(n) (OVER_ALLOC_FAC*(n) + 1000) +#define over_alloc_large(n) (int)(OVER_ALLOC_FAC*(n) + 1000) int gmx_large_int_to_int(gmx_large_int_t step, const char *warn); /* Convert a gmx_large_int_t value to int. diff --git a/src/gromacs/mdlib/sim_util.c b/src/gromacs/mdlib/sim_util.c index 5723a848db..a00886e26f 100644 --- a/src/gromacs/mdlib/sim_util.c +++ b/src/gromacs/mdlib/sim_util.c @@ -101,17 +101,6 @@ #include "nbnxn_cuda_data_mgmt.h" #include "nbnxn_cuda/nbnxn_cuda.h" -#if 0 -typedef struct gmx_timeprint { - -} t_gmx_timeprint; -#endif - -/* Portable version of ctime_r implemented in src/gmxlib/string2.c, but we do not want it declared in public installed headers */ -char * -gmx_ctime_r(const time_t *clock, char *buf, int n); - - double gmx_gettime() { diff --git a/tests/CppCheck.cmake b/tests/CppCheck.cmake index 98a3ca4e3a..10ec04a830 100644 --- a/tests/CppCheck.cmake +++ b/tests/CppCheck.cmake @@ -83,8 +83,12 @@ if (CPPCHECK_EXECUTABLE AND UNIX) --suppress=missingInclude:src/programs/mdrun/gmx_gpu_utils/gmx_gpu_utils.cu --inline-suppr) set(_cxx_flags + -D__cplusplus --suppress=variableScope --suppress=unnecessaryForwardDeclaration + --suppress=invalidscanf:src/gromacs/gmxlib/matio.cpp + --suppress=invalidscanf:src/gromacs/gmxlib/xvgr.cpp + --suppress=invalidscanf:src/gromacs/gmxpreprocess/pdb2top.cpp --suppress=*:src/gromacs/selection/scanner.cpp) # This list will hold the list of all files with cppcheck errors -- 2.22.0