Warn for type mismatch for gmx printf like functions 1/3
authorRoland Schulz <roland.schulz@intel.com>
Fri, 13 Jul 2018 04:22:12 +0000 (21:22 -0700)
committerMark Abraham <mark.j.abraham@gmail.com>
Mon, 16 Jul 2018 15:55:16 +0000 (17:55 +0200)
Automatic fixes with clang fix-it

Related #2570

Change-Id: Id565d2705c673d1e45318bb8bf1091c165a724de

47 files changed:
src/gromacs/awh/bias.cpp
src/gromacs/awh/biasstate.cpp
src/gromacs/awh/read-params.cpp
src/gromacs/correlationfunctions/autocorr.cpp
src/gromacs/domdec/cellsizes.cpp
src/gromacs/domdec/domdec.cpp
src/gromacs/domdec/domdec_setup.cpp
src/gromacs/domdec/domdec_topology.cpp
src/gromacs/ewald/pme-load-balancing.cpp
src/gromacs/fileio/checkpoint.cpp
src/gromacs/fileio/enxio.cpp
src/gromacs/fileio/tpxio.cpp
src/gromacs/gmxana/gmx_hydorder.cpp
src/gromacs/gmxana/gmx_make_edi.cpp
src/gromacs/gmxana/gmx_nmr.cpp
src/gromacs/gmxana/gmx_wham.cpp
src/gromacs/gmxpreprocess/fflibutil.cpp
src/gromacs/gmxpreprocess/pdb2gmx.cpp
src/gromacs/gmxpreprocess/pdb2top.cpp
src/gromacs/gmxpreprocess/pgutil.cpp
src/gromacs/gmxpreprocess/readir.cpp
src/gromacs/gmxpreprocess/topdirs.cpp
src/gromacs/gmxpreprocess/topio.cpp
src/gromacs/gmxpreprocess/toputil.cpp
src/gromacs/hardware/printhardware.cpp
src/gromacs/listed-forces/manage-threading.cpp
src/gromacs/mdlib/expanded.cpp
src/gromacs/mdlib/forcerec.cpp
src/gromacs/mdlib/gmx_omp_nthreads.cpp
src/gromacs/mdlib/lincs.cpp
src/gromacs/mdlib/mdebin.cpp
src/gromacs/mdlib/nbnxn_search.cpp
src/gromacs/mdlib/nbnxn_tuning.cpp
src/gromacs/mdlib/shellfc.cpp
src/gromacs/mdrun/md.cpp
src/gromacs/mdrun/minimize.cpp
src/gromacs/mdrun/runner.cpp
src/gromacs/options/basicoptions.cpp
src/gromacs/pbcutil/mshift.cpp
src/gromacs/pulling/pull.cpp
src/gromacs/selection/selmethod.cpp
src/gromacs/tables/splineutil.cpp
src/gromacs/taskassignment/reportgpuusage.cpp
src/gromacs/taskassignment/resourcedivision.cpp
src/gromacs/tools/dump.cpp
src/gromacs/topology/symtab.cpp
src/gromacs/utility/smalloc.cpp

index 1a18b0d18e154435fc92c0ef93cbc30a174e335f..4310aef885eb6350457e1bd414e516d55f95a7a4 100644 (file)
@@ -241,7 +241,7 @@ static void ensureStateAndRunConsistency(const BiasParams &params,
     gmx_int64_t numUpdatesExpected    = state.histogramSize().numUpdates();
     if (numUpdatesFromSamples != numUpdatesExpected)
     {
-        std::string mesg = gmx::formatString("The number of AWH updates in the checkpoint file (%ld) does not match the total number of AWH samples divided by the number of samples per update for %ld sharing AWH bias(es) (%ld/%ld=%ld)",
+        std::string mesg = gmx::formatString("The number of AWH updates in the checkpoint file (%ld) does not match the total number of AWH samples divided by the number of samples per update for %d sharing AWH bias(es) (%ld/%d=%ld)",
                                              numUpdatesExpected,
                                              params.numSharedUpdate,
                                              numSamples,
index 9cd6a2ec8a5cb6b975962bc4e2b5dfae371052f7..029620dc070731fd364a230af710ee367e5646db 100644 (file)
@@ -1524,7 +1524,7 @@ static void readUserPmfAndTargetDistribution(const std::vector<DimParams> &dimPa
     if (numColumns < numColumnsMin)
     {
         std::string mesg =
-            gmx::formatString("The number of columns in %s (%d) should be at least %d."
+            gmx::formatString("The number of columns in %s (%s) should be at least %d."
                               "\n\n%s",
                               filename.c_str(), correctFormatMessage.c_str());
         GMX_THROW(InvalidInputError(mesg));
@@ -1570,7 +1570,7 @@ static void readUserPmfAndTargetDistribution(const std::vector<DimParams> &dimPa
         /* Check if the values are allowed. */
         if (target < 0)
         {
-            std::string mesg = gmx::formatString("Target distribution weight at point %d (%g) in %s is negative.",
+            std::string mesg = gmx::formatString("Target distribution weight at point %zu (%g) in %s is negative.",
                                                  m, target, filename.c_str());
             GMX_THROW(InvalidInputError(mesg));
         }
index 414fbe8723e57760cc134094481fce1237b45398..c8008f1598d664343452d0cc669c1697ed275a96 100644 (file)
@@ -449,7 +449,7 @@ static void checkInputConsistencyAwh(const AwhParams &awhParams,
                         sprintf(errormsg, "One pull coordinate (%d) cannot be mapped to two separate AWH dimensions (awh%d-dim%d and awh%d-dim%d). "
                                 "If this is really what you want to do you will have to duplicate this pull coordinate.",
                                 awhBiasParams1.dimParams[d1].coordIndex + 1, k1 + 1, d1 + 1, k2 + 1, d2 + 1);
-                        gmx_fatal(FARGS, errormsg);
+                        gmx_fatal(FARGS, "%s", errormsg);
                     }
                 }
             }
@@ -703,7 +703,7 @@ static void checkInputConsistencyInterval(const AwhParams *awhParams, warninp_t
 
             if ((period == 0) && (origin > end))
             {
-                gmx_fatal(FARGS, "For the non-periodic pull coordinates awh%d-dim%d-start cannot be larger than awh%d-dim%d-end",
+                gmx_fatal(FARGS, "For the non-periodic pull coordinates awh%d-dim%d-start cannot be larger than awh%f-dim%d-end",
                           k + 1, d + 1, origin, k + 1, d + 1, end);
             }
 
index a9681ce2150925b99e588144af05bc96a6e83e49..61dc522a28222d2b64019cc21b65958219c0664c 100644 (file)
@@ -231,7 +231,7 @@ static void do_ac_core(int nframes, int nout,
             }
             else
             {
-                gmx_fatal(FARGS, "\nInvalid mode (%d) in do_ac_core", mode);
+                gmx_fatal(FARGS, "\nInvalid mode (%lu) in do_ac_core", mode);
             }
         }
     }
@@ -519,7 +519,7 @@ static void do_four_core(unsigned long mode, int nframes,
     }
     else
     {
-        gmx_fatal(FARGS, "\nUnknown mode in do_autocorr (%d)", mode);
+        gmx_fatal(FARGS, "\nUnknown mode in do_autocorr (%lu)", mode);
     }
 
     sfree(cfour);
index c30b302647e7be956704c8eb0cfdbf8aee4b3c3c..4db4992a24b7fb85d79b118f27bf9eef52a0aef8 100644 (file)
@@ -308,11 +308,11 @@ set_dd_cell_sizes_slb(gmx_domdec_t *dd, const gmx_ddbox_t *ddbox,
             if (setmode == setcellsizeslbLOCAL)
             {
                 gmx_fatal_collective(FARGS, dd->mpi_comm_all, DDMASTER(dd),
-                                     error_string);
+                                     "%s", error_string);
             }
             else
             {
-                gmx_fatal(FARGS, error_string);
+                gmx_fatal(FARGS, "%s", error_string);
             }
         }
     }
index 6c87d0dff11819d58fb2b6f90a15a552f53ef706..60e6c0cb10aa6d23916171cd91285cf62b2e07b2 100644 (file)
@@ -3353,7 +3353,7 @@ static int forceDlbOffOrBail(int                cmdlineDlbState,
 
     if (cmdlineDlbState == edlbsOnUser)
     {
-        gmx_fatal(FARGS, (dlbNotSupportedErr + reasonStr).c_str());
+        gmx_fatal(FARGS, "%s", (dlbNotSupportedErr + reasonStr).c_str());
     }
     else if (cmdlineDlbState == edlbsOffCanTurnOn)
     {
@@ -6482,7 +6482,7 @@ void dd_partition_system(FILE                *fplog,
     {
         if (state_local->ddp_count > dd->ddp_count)
         {
-            gmx_fatal(FARGS, "Internal inconsistency state_local->ddp_count (%d) > dd->ddp_count (%d)", state_local->ddp_count, dd->ddp_count);
+            gmx_fatal(FARGS, "Internal inconsistency state_local->ddp_count (%d) > dd->ddp_count (%ld)", state_local->ddp_count, dd->ddp_count);
         }
 
         if (state_local->ddp_count_cg_gl != state_local->ddp_count)
index 22e3687d7c6aa1d62d077569ce89256019db5227..2e3f2a8fdd5e219ceaccb4651323147cfcb7a543 100644 (file)
@@ -768,7 +768,7 @@ real dd_choose_grid(FILE *fplog,
             /* Check if the largest divisor is more than nnodes^2/3 */
             if (ldiv*ldiv*ldiv > nnodes_div*nnodes_div)
             {
-                gmx_fatal(FARGS, "The number of ranks you selected (%d) contains a large prime factor %d. In most cases this will lead to bad performance. Choose a number with smaller prime factors or set the decomposition (option -dd) manually.",
+                gmx_fatal(FARGS, "The number of ranks you selected (%ld) contains a large prime factor %ld. In most cases this will lead to bad performance. Choose a number with smaller prime factors or set the decomposition (option -dd) manually.",
                           nnodes_div, ldiv);
             }
         }
index 647d58f06f83e641de3182de6a8369b60f1e3d0d..959d0879ceee3fe863a89b8e9d5333e97522bbf9 100644 (file)
@@ -432,7 +432,7 @@ void dd_print_missing_interactions(FILE *fplog, t_commrec *cr,
     {
         errorMessage = gmx::formatString("%d of the %d bonded interactions could not be calculated because some atoms involved moved further apart than the multi-body cut-off distance (%g nm) or the two-body cut-off distance (%g nm), see option -rdd, for pairs and tabulated bonds also see option -ddcheck", -ndiff_tot, cr->dd->nbonded_global, dd_cutoff_multibody(dd), dd_cutoff_twobody(dd));
     }
-    gmx_fatal_collective(FARGS, cr->mpi_comm_mygroup, MASTER(cr), errorMessage.c_str());
+    gmx_fatal_collective(FARGS, cr->mpi_comm_mygroup, MASTER(cr), "%s", errorMessage.c_str());
 }
 
 /*! \brief Return global topology molecule information for global atom index \p i_gl */
index 4347f70bcb7a11a591a849b4da7d706937cba675..e08289db77bf3988c94f03e7879eb9c80d7ac397 100644 (file)
@@ -789,7 +789,7 @@ pme_load_balance(pme_load_balancing_t      *pme_lb,
                  * But we implement a complete failsafe solution anyhow.
                  */
                 GMX_LOG(mdlog.warning).asParagraph().appendTextFormatted(
-                        "The fastest PP/PME load balancing setting (cutoff %.3f nm) is no longer available due to DD DLB or box size limitations", pme_lb->fastest);
+                        "The fastest PP/PME load balancing setting (cutoff %.3d nm) is no longer available due to DD DLB or box size limitations", pme_lb->fastest);
                 pme_lb->fastest = pme_lb->lower_limit;
                 pme_lb->start   = pme_lb->lower_limit;
             }
index eb5a338dc343da591c8f2c7c932ccc7e7ad13edf..8cb2c578915e844d6c831850ed1465861d3373f1 100644 (file)
@@ -1961,7 +1961,7 @@ void write_checkpoint(const char *fn, gmx_bool bNumberAndKeep,
         }
         else
         {
-            gmx_warning(buf);
+            gmx_warning("%s", buf);
         }
     }
 
index cfff421eabb8424f17461717217b4089ca6854e6..4990ce5de207e25d6ffd315ecf11f623378794b8 100644 (file)
@@ -333,7 +333,7 @@ static void enx_warning(const char *msg)
 {
     if (getenv("GMX_ENX_NO_FATAL") != nullptr)
     {
-        gmx_warning(msg);
+        gmx_warning("%s", msg);
     }
     else
     {
index d59b34b429ec68c483fd36b303812d37fb793276..59a829691aac44983d785a78230b05491d93f75b 100644 (file)
@@ -2600,7 +2600,7 @@ static void do_tpxheader(t_fileio *fio, gmx_bool bRead, t_tpxheader *tpx,
         if ((precision != sizeof(float)) && !bDouble)
         {
             gmx_fatal(FARGS, "Unknown precision in file %s: real is %d bytes "
-                      "instead of %d or %d",
+                      "instead of %lu or %lu",
                       gmx_fio_getname(fio), precision, sizeof(float), sizeof(double));
         }
         gmx_fio_setprecision(fio, bDouble);
index 312a70a57e8664e3fbf715b204999d495e577465..4fe52c384e4ab402c07d95842dccdd8f952fd55e 100644 (file)
@@ -665,7 +665,7 @@ int gmx_hydorder(int argc, char *argv[])
     gmx::ArrayRef<const std::string> intfn = opt2fns("-o", NFILE, fnm);
     if (intfn.size() != 2)
     {
-        gmx_fatal(FARGS, "No or not correct number (2) of output-files: %d", intfn.size());
+        gmx_fatal(FARGS, "No or not correct number (2) of output-files: %ld", intfn.size());
     }
     calc_tetra_order_interface(ndxfnm, tpsfnm, trxfnm, binwidth, nsttblock, &frames, &xslices, &yslices, sg1, sg2, &intfpos, oenv);
     writesurftoxpms(intfpos, frames, xslices, yslices, binwidth, intfn, nlevels);
@@ -675,7 +675,7 @@ int gmx_hydorder(int argc, char *argv[])
         gmx::ArrayRef<const std::string> spectra = opt2fns("-Spect", NFILE, fnm);
         if (spectra.size() != 2)
         {
-            gmx_fatal(FARGS, "No or not correct number (2) of output-files: %d", spectra.size());
+            gmx_fatal(FARGS, "No or not correct number (2) of output-files: %ld", spectra.size());
         }
         powerspectavg(intfpos, frames, xslices, yslices, spectra);
     }
@@ -685,7 +685,7 @@ int gmx_hydorder(int argc, char *argv[])
         gmx::ArrayRef<const std::string> raw = opt2fns("-or", NFILE, fnm);
         if (raw.size() != 2)
         {
-            gmx_fatal(FARGS, "No or not correct number (2) of output-files: %d", raw.size());
+            gmx_fatal(FARGS, "No or not correct number (2) of output-files: %ld", raw.size());
         }
         writeraw(intfpos, frames, xslices, yslices, raw);
     }
index c488d16d409e4f3cd3dd767ea003a48683e9bf4c..e01913d4fb0d15da6b119889af72bed57c7eabf3 100644 (file)
@@ -291,12 +291,12 @@ static int sscan_list(int *list[], const char *str, const char *listname)
 
             /* format error occured */
             case sError:
-                gmx_fatal(FARGS, "Error in the list of eigenvectors for %s at pos %d with char %c", listname, pos-startpos, *(pos-1));
+                gmx_fatal(FARGS, "Error in the list of eigenvectors for %s at pos %ld with char %c", listname, pos-startpos, *(pos-1));
             /* logical error occured */
             case sZero:
-                gmx_fatal(FARGS, "Error in the list of eigenvectors for %s at pos %d: eigenvector 0 is not valid", listname, pos-startpos);
+                gmx_fatal(FARGS, "Error in the list of eigenvectors for %s at pos %ld: eigenvector 0 is not valid", listname, pos-startpos);
             case sSmaller:
-                gmx_fatal(FARGS, "Error in the list of eigenvectors for %s at pos %d: second index %d is not bigger than %d", listname, pos-startpos, end_number, number);
+                gmx_fatal(FARGS, "Error in the list of eigenvectors for %s at pos %ld: second index %d is not bigger than %d", listname, pos-startpos, end_number, number);
         }
         ++pos; /* read next character */
     }          /*scanner has finished */
index ad8ba9393f14db71f5c450db2cbd770c2b019cc7..2a8c650d56df16b40e0612430d687952f825dc24 100644 (file)
@@ -833,7 +833,7 @@ int gmx_nmr(int argc, char *argv[])
 
                         if (blk->sub[0].nr != nex*12)
                         {
-                            gmx_fatal(FARGS, "Number of orientation experiments in energy file (%g) does not match with the topology (%d)",
+                            gmx_fatal(FARGS, "Number of orientation experiments in energy file (%d) does not match with the topology (%d)",
                                       blk->sub[0].nr/12, nex);
                         }
                         fprintf(foten, "  %10f", fr.t);
index ac718cb6b89142fb779fa66874f81677085404e4..2a291d3c297798da96705ba371086c25038515b1 100644 (file)
@@ -417,7 +417,7 @@ static void setup_tab(const char *fn, t_UmbrellaOptions *opt)
     {
         if  (std::abs(y[0][i+1]-y[0][i]-opt->tabDz) > opt->tabDz/1e6)
         {
-            gmx_fatal(FARGS, "z-values in %s are not equally spaced.\n", ny, fn);
+            gmx_fatal(FARGS, "z-values in %d are not equally spaced.\n", ny, fn);
         }
     }
     snew(opt->tabY, nl);
@@ -1392,7 +1392,7 @@ static void create_synthetic_histo(t_UmbrellaWindow *synthWindow, t_UmbrellaWind
                     "3) If all ACTs are identical and know, you can define them with -bs-tau.\n"
                     "   Use option (3) only if you are sure what you're doing, you may severely\n"
                     "   underestimate the error if a too small ACT is given.\n");
-        gmx_fatal(FARGS, errstr);
+        gmx_fatal(FARGS, "%s", errstr);
     }
 
     synthWindow->N       [0] = N;
index c906fea25ea50fec07d9880ad5fa3b57e560d2dc..812a229856f566be1e125c50714680609183bf2d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2010,2012,2013,2014,2015,2017, by the GROMACS development team, led by
+ * Copyright (c) 2010,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.
@@ -84,7 +84,7 @@ void fflib_filename_base(const char *filename, char *filebase, int maxlen)
     }
     if (strlen(filename) >= (size_t)maxlen)
     {
-        gmx_fatal(FARGS, "filename is longer (%d) than maxlen (%d)",
+        gmx_fatal(FARGS, "filename is longer (%zu) than maxlen (%d)",
                   strlen(filename), maxlen);
     }
     strcpy(filebase, cptr);
index c172d03ab29cb006755589c66ed21b3178dad1eb..bf63bfbb609e5f759c8200437ad5c6b88772835f 100644 (file)
@@ -750,7 +750,7 @@ static void sort_pdbatoms(t_restp restp[],
                     "Note that hydrogens might have been added to the entry for the N-terminus.\n"
                     "Remove this hydrogen or choose a different protonation state to solve it.\n"
                     "Option -ignh will ignore all hydrogens in the input." : ".");
-            gmx_fatal(FARGS, buf);
+            gmx_fatal(FARGS, "%s", buf);
         }
         /* make shadow array to be sorted into indexgroup */
         pdbi[i].resnr  = pdba->atom[i].resind;
@@ -1599,7 +1599,7 @@ int gmx_pdb2gmx(int argc, char *argv[])
             bVsiteAromatics = TRUE;
             break;
         default:
-            gmx_fatal(FARGS, "DEATH HORROR in $s (%d): vsitestr[0]='%s'",
+            gmx_fatal(FARGS, "DEATH HORROR in $s (%s): vsitestr[0]='%d'",
                       __FILE__, __LINE__, vsitestr[0]);
     } /* end switch */
 
index 2eab21ae4909b32527f6d1f38cab5a850fefa8a4..d9c0c80f1913e8b10f221165373e2a69e801c785 100644 (file)
@@ -1092,7 +1092,7 @@ void get_hackblocks_rtp(t_hackblock **hb, t_restp **restp,
             }
             else
             {
-                gmx_fatal(FARGS, errString);
+                gmx_fatal(FARGS, "%s", errString);
             }
         }
         else if (bRM && ((tern >= 0 && ntdb[tern]->nhack == 0) ||
@@ -1105,7 +1105,7 @@ void get_hackblocks_rtp(t_hackblock **hb, t_restp **restp,
             }
             else
             {
-                gmx_fatal(FARGS, errString);
+                gmx_fatal(FARGS, "%s", errString);
             }
         }
     }
index a4418abf9ab85a3894843dbcd15df63666607fdb..a86ad7a35a0be5be6fa411585f6b1b62b3fe0e34 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,2014,2015,2017, by the GROMACS development team, led by
+ * Copyright (c) 2012,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.
@@ -81,7 +81,7 @@ static void atom_not_found(int fatal_errno, const char *file, int line,
         }
         else
         {
-            gmx_fatal(fatal_errno, file, line, message_buffer);
+            gmx_fatal(fatal_errno, file, line, "%s", message_buffer);
         }
     }
 }
index 55bd2db67e5e0b36e2bf9f7e0dee83227c925620..1e49192d1d5860c42c7b669805435b12e4c7f7cd 100644 (file)
@@ -175,7 +175,7 @@ static void GetSimTemps(int ntemps, t_simtemp *simtemp, double *temperature_lamb
         {
             char errorstr[128];
             sprintf(errorstr, "eSimTempScale=%d not defined", simtemp->eSimTempScale);
-            gmx_fatal(FARGS, errorstr);
+            gmx_fatal(FARGS, "%s", errorstr);
         }
     }
 }
index dcb2a2bcae512e95e836ca4fd58387067a9f6123..91e57fa8377108014bdb3f9096deb4714c43a8cf 100644 (file)
@@ -275,7 +275,7 @@ int ifunc_index(directive d, int type)
         case d_dihedral_restraints:
             return F_DIHRES;
         default:
-            gmx_fatal(FARGS, "invalid directive %s in ifunc_index (%s:%s)",
+            gmx_fatal(FARGS, "invalid directive %s in ifunc_index (%s:%d)",
                       dir2str(d), __FILE__, __LINE__);
     }
 }
index 0e529d1c16ee1d407b0a9c3626438a7fde312e59..ecfc20ecf49ef69837c1f97f1931cc56c57d895b 100644 (file)
@@ -479,7 +479,7 @@ static char **read_topol(const char *infile, const char *outfile,
     status = cpp_open_file(infile, &handle, cpp_opts(define, include, wi));
     if (status != 0)
     {
-        gmx_fatal(FARGS, cpp_error(&handle, status));
+        gmx_fatal(FARGS, "%s", cpp_error(&handle, status));
     }
 
     /* some local variables */
@@ -516,7 +516,7 @@ static char **read_topol(const char *infile, const char *outfile,
         {
             if (status != eCPP_OK)
             {
-                gmx_fatal(FARGS, cpp_error(&handle, status));
+                gmx_fatal(FARGS, "%s", cpp_error(&handle, status));
             }
             else if (out)
             {
@@ -556,7 +556,7 @@ static char **read_topol(const char *infile, const char *outfile,
                 {
                     if (status != eCPP_OK)
                     {
-                        gmx_fatal(FARGS, cpp_error(&handle, status));
+                        gmx_fatal(FARGS, "%s", cpp_error(&handle, status));
                     }
                     else if (out)
                     {
@@ -913,7 +913,7 @@ static char **read_topol(const char *infile, const char *outfile,
     status = cpp_close_file(&handle);
     if (status != eCPP_OK)
     {
-        gmx_fatal(FARGS, cpp_error(&handle, status));
+        gmx_fatal(FARGS, "%s", cpp_error(&handle, status));
     }
     cpp_done();
     if (out)
index db5c07197d7ea20626605766e3cf126df4fd43e2..1a5108bc02ca492a37a513b6e4ebe7221f7db9ce 100644 (file)
@@ -67,7 +67,7 @@ void set_p_string(t_param *p, const char *s)
         }
         else
         {
-            gmx_fatal(FARGS, "Increase MAXSLEN in the grompp code to at least %d,"
+            gmx_fatal(FARGS, "Increase MAXSLEN in the grompp code to at least %lu,"
                       " or shorten your definition of bonds like %s to at most %d",
                       strlen(s)+1, s, MAXSLEN-1);
         }
index c8662b5d2face584addf58da6d159bbe8a3a0020..6c660063a59001a60095d87d0b4776a576c0aa28 100644 (file)
@@ -312,12 +312,12 @@ static std::string detected_hardware_string(const gmx_hw_info_t *hwinfo,
             s += gmx::formatString("      Latency:\n          ");
             for (std::size_t j = 0; j < hwTop.machine().numa.nodes.size(); j++)
             {
-                s += gmx::formatString(" %5d", j);
+                s += gmx::formatString(" %5lu", j);
             }
             s += gmx::formatString("\n");
             for (std::size_t i = 0; i < hwTop.machine().numa.nodes.size(); i++)
             {
-                s += gmx::formatString("     %5d", i);
+                s += gmx::formatString("     %5lu", i);
                 for (std::size_t j = 0; j < hwTop.machine().numa.nodes.size(); j++)
                 {
                     s += gmx::formatString(" %5.2f", hwTop.machine().numa.relativeLatency[i][j]);
index 7ae8fc6b42327961d9e44fa9e99ecc183fa84cdc..8312e98d3c45ae6e53fe0d0b0543eee132687fe2 100644 (file)
@@ -450,7 +450,7 @@ void setup_bonded_threading(bonded_threading_t *bt,
             if (gmx_debug_at)
             {
 #if BITMASK_SIZE <= 64 //move into bitmask when it is C++
-                std::string flags = gmx::formatString("%x", *mask);
+                std::string flags = gmx::formatString("%lx", *mask);
 #else
                 std::string flags = gmx::formatAndJoin(*mask,
                                                        *mask+BITMASK_ALEN,
index 9744ed48ab3b222f239c19eb8102cdb489b886bd..2a1d3a50dce462624b9e26a5bb165208fa72c13f 100644 (file)
@@ -906,7 +906,7 @@ static int ChooseNewLambda(int nlim, t_expanded *expand, df_history_t *dfhist, i
                     {
                         loc += sprintf(&errorstr[loc], "%3d %17.10e%17.10e%17.10e\n", ifep, weighted_lamee[ifep], p_k[ifep], dfhist->sum_weights[ifep]);
                     }
-                    gmx_fatal(FARGS, errorstr);
+                    gmx_fatal(FARGS, "%s", errorstr);
                 }
             }
         }
index a2a076cce752b2108a828ea5479ca8de7d3bbc1f..b7bcdb28d00dad81873fd201f6242264e1446481 100644 (file)
@@ -2334,7 +2334,7 @@ void init_forcerec(FILE                             *fp,
 
     if (check_box(ir->ePBC, box))
     {
-        gmx_fatal(FARGS, check_box(ir->ePBC, box));
+        gmx_fatal(FARGS, "%s", check_box(ir->ePBC, box));
     }
 
     /* Test particle insertion ? */
@@ -2730,7 +2730,7 @@ void init_forcerec(FILE                             *fp,
     {
         if (!gmx_within_tol(ic->reppow, 12.0, 10*GMX_DOUBLE_EPS))
         {
-            gmx_fatal(FARGS, "Cut-off scheme %S only supports LJ repulsion power 12", ecutscheme_names[ir->cutoff_scheme]);
+            gmx_fatal(FARGS, "Cut-off scheme %s only supports LJ repulsion power 12", ecutscheme_names[ir->cutoff_scheme]);
         }
         /* Older tpr files can contain Coulomb user tables with the Verlet cutoff-scheme,
          * while mdrun does not (and never did) support this.
index b642651f44cea48a3eaee8cfb4e7fb7935544b2d..148604469c98e6a822bacd6604565f8261276ea7 100644 (file)
@@ -211,7 +211,7 @@ void gmx_omp_nthreads_read_env(const gmx::MDLogger &mdlog,
         /* This prints once per simulation for multi-simulations,
          * which might help diagnose issues with inhomogenous
          * cluster setups. */
-        GMX_LOG(mdlog.info).appendTextFormatted(buffer);
+        GMX_LOG(mdlog.info).appendTextFormatted("%s", buffer);
         if (debug)
         {
             /* This prints once per process for real MPI (i.e. once
index 40cbc8a3211be5ff9bb3e9e8bbbfabc2e0f1d65c..83981ce01b6e4dc4dd3608db3f636d443dcb6fc8 100644 (file)
@@ -1319,7 +1319,7 @@ static void set_lincs_matrix_task(Lincs                *li,
                             li_task->ntriangle++;
                             if (li->blnr[i+1] - li->blnr[i] > static_cast<int>(sizeof(li_task->tri_bits[0])*8 - 1))
                             {
-                                gmx_fatal(FARGS, "A constraint is connected to %d constraints, this is more than the %d allowed for constraints participating in triangles",
+                                gmx_fatal(FARGS, "A constraint is connected to %d constraints, this is more than the %lu allowed for constraints participating in triangles",
                                           li->blnr[i+1] - li->blnr[i],
                                           sizeof(li_task->tri_bits[0])*8-1);
                             }
index 6c57df84f1490f4c3e84c4bf4603f14c9498a6d1..642a961688d690007ded0e3ce3bfe9cffa6a8aa7 100644 (file)
@@ -1566,7 +1566,7 @@ void restore_energyhistory_from_state(t_mdebin              * mdebin,
     if ((enerhist->nsum     > 0 && nener != enerhist->ener_sum.size()) ||
         (enerhist->nsum_sim > 0 && nener != enerhist->ener_sum_sim.size()))
     {
-        gmx_fatal(FARGS, "Mismatch between number of energies in run input (%d) and checkpoint file (%u or %u).",
+        gmx_fatal(FARGS, "Mismatch between number of energies in run input (%d) and checkpoint file (%zu or %zu).",
                   nener, enerhist->ener_sum.size(), enerhist->ener_sum_sim.size());
     }
 
index 7e8263869e5e3abc1c83c9d4c4c7c19a53a477a0..0248a5d1a5662f75240db12e2c5fedaf36a7b3d9 100644 (file)
@@ -1727,7 +1727,7 @@ static void make_fep_list(const nbnxn_search     *nbs,
 
     if (ngid*gridj->na_cj > gmx::index(sizeof(gid_cj)*8))
     {
-        gmx_fatal(FARGS, "The Verlet scheme with %dx%d kernels and free-energy only supports up to %d energy groups",
+        gmx_fatal(FARGS, "The Verlet scheme with %dx%d kernels and free-energy only supports up to %lu energy groups",
                   gridi->na_c, gridj->na_cj, (sizeof(gid_cj)*8)/gridj->na_cj);
     }
 
index b63702e075144da108e6369cc7babd3d24ea777a..663b7d18afcdc5a3f6f75145ea931181811dff84 100644 (file)
@@ -323,7 +323,7 @@ void increaseNstlist(FILE *fp, t_commrec *cr,
 
     if (!bBox || !bDD)
     {
-        gmx_warning(!bBox ? box_err : dd_err);
+        gmx_warning("%s", !bBox ? box_err : dd_err);
         if (fp != nullptr)
         {
             fprintf(fp, "\n%s\n", !bBox ? box_err : dd_err);
@@ -471,7 +471,7 @@ static std::string formatListSetup(const std::string &listName,
     }
     listSetup += "updated every ";
     // Make the shortest int format string that fits nstListForSpacing
-    std::string nstListFormat = "%" + gmx::formatString("%d", gmx::formatString("%zu", nstListForSpacing).size()) + "d";
+    std::string nstListFormat = "%" + gmx::formatString("%lu", gmx::formatString("%d", nstListForSpacing).size()) + "d";
     listSetup += gmx::formatString(nstListFormat.c_str(), nstList);
     listSetup += gmx::formatString(" steps, buffer %.3f nm, rlist %.3f nm\n",
                                    rList - interactionCutoff, rList);
index 693435a53039d6a6f92c1ca31e7d1300317441da..3041ad3cd2b991e24311b1d378bba41b47c0e74f 100644 (file)
@@ -503,7 +503,7 @@ gmx_shellfc_t *init_shell_flexcon(FILE *fplog,
                             case F_ANHARM_POL:
                                 if (!gmx_within_tol(qS, atom[aS].qB, GMX_REAL_EPS*10))
                                 {
-                                    gmx_fatal(FARGS, "polarize can not be used with qA(%e) != qB(%e) for atom %d of molecule block %d", qS, atom[aS].qB, aS+1, mb+1);
+                                    gmx_fatal(FARGS, "polarize can not be used with qA(%e) != qB(%e) for atom %d of molecule block %lu", qS, atom[aS].qB, aS+1, mb+1);
                                 }
                                 shell[nsi].k    += gmx::square(qS)*ONE_4PI_EPS0/
                                     ffparams->iparams[type].polarize.alpha;
@@ -511,7 +511,7 @@ gmx_shellfc_t *init_shell_flexcon(FILE *fplog,
                             case F_WATER_POL:
                                 if (!gmx_within_tol(qS, atom[aS].qB, GMX_REAL_EPS*10))
                                 {
-                                    gmx_fatal(FARGS, "water_pol can not be used with qA(%e) != qB(%e) for atom %d of molecule block %d", qS, atom[aS].qB, aS+1, mb+1);
+                                    gmx_fatal(FARGS, "water_pol can not be used with qA(%e) != qB(%e) for atom %d of molecule block %lu", qS, atom[aS].qB, aS+1, mb+1);
                                 }
                                 alpha          = (ffparams->iparams[type].wpol.al_x+
                                                   ffparams->iparams[type].wpol.al_y+
index 82e8550e3e2b93f53318f405c58097bbeca3b646..1b0f144e66d19fe393656c95dc9c038d963819d9 100644 (file)
@@ -789,11 +789,11 @@ void gmx::Integrator::do_md()
             {
                 if (!rerun_fr.bBox)
                 {
-                    gmx_fatal(FARGS, "Rerun trajectory frame step %d time %f does not contain a box, while pbc is used", rerun_fr.step, rerun_fr.time);
+                    gmx_fatal(FARGS, "Rerun trajectory frame step %ld time %f does not contain a box, while pbc is used", rerun_fr.step, rerun_fr.time);
                 }
                 if (max_cutoff2(ir->ePBC, rerun_fr.box) < gmx::square(fr->rlist))
                 {
-                    gmx_fatal(FARGS, "Rerun trajectory frame step %d time %f has too small box dimensions", rerun_fr.step, rerun_fr.time);
+                    gmx_fatal(FARGS, "Rerun trajectory frame step %ld time %f has too small box dimensions", rerun_fr.step, rerun_fr.time);
                 }
             }
         }
index 35c7945e7ede2b42d49b1340f72e9e9f2e73cc38..4200b843f49d5e4dc66796c80a6bbe22ca6c0a9c 100644 (file)
@@ -2697,7 +2697,7 @@ Integrator::do_nm()
     }
     else if (atom_index.size() < 1000)
     {
-        GMX_LOG(mdlog.warning).appendTextFormatted("Small system size (N=%d), using full Hessian format.",
+        GMX_LOG(mdlog.warning).appendTextFormatted("Small system size (N=%zu), using full Hessian format.",
                                                    atom_index.size());
         bSparse = FALSE;
     }
index 1fa6cfced31a97787565d0e805379ef6adc50c00..b8533410badc058d273f30e7f4a0343cd3a1d3f4 100644 (file)
@@ -299,7 +299,7 @@ static void override_nsteps_cmdline(const gmx::MDLogger &mdlog,
     }
     else if (nsteps_cmdline < -2)
     {
-        gmx_fatal(FARGS, "Invalid nsteps value passed on the command line: %d",
+        gmx_fatal(FARGS, "Invalid nsteps value passed on the command line: %ld",
                   nsteps_cmdline);
     }
     /* Do nothing if nsteps_cmdline == -2 */
index 17f6af248e8cc19196d8e4a5a0d2f66ac5acc90e..98b4f7ac8e0c1c9ea98dbad2ad031042ca337e2e 100644 (file)
@@ -85,7 +85,7 @@ void expandVector(size_t length, std::vector<ValueType> *values)
         if (values->size() != 1)
         {
             GMX_THROW(gmx::InvalidInputError(gmx::formatString(
-                                                     "Expected 1 or %d values, got %d", length, values->size())));
+                                                     "Expected 1 or %zu values, got %zu", length, values->size())));
         }
         const ValueType &value = (*values)[0];
         values->resize(length, value);
index 4ff56f879c1660fbc3a5fe1883a47273ca2a9587..e7949ce94161ae5b401bc3e60f966a732826fd35 100644 (file)
@@ -903,7 +903,7 @@ void mk_mshift(FILE *log, t_graph *g, int ePBC,
                 default:
                     mesg += " Either you have excessively large distances between atoms in bonded interactions or your system is exploding.";
             }
-            gmx_fatal(FARGS, mesg.c_str());
+            gmx_fatal(FARGS, "%s", mesg.c_str());
         }
 
         /* The most likely reason for arriving here is a periodic molecule. */
index 6d8f51217e8e4804aa255e6159dd14220e2a1ed3..0f0532451a36e2fb27e6386c386837d4070ce517 100644 (file)
@@ -1063,7 +1063,7 @@ static void do_constraint(struct pull_t *pull, t_pbc *pbc,
 
         if (dnorm2(r_ij[c]) == 0)
         {
-            gmx_fatal(FARGS, "Distance for pull coordinate %d is zero with constraint pulling, which is not allowed.", c + 1);
+            gmx_fatal(FARGS, "Distance for pull coordinate %lu is zero with constraint pulling, which is not allowed.", c + 1);
         }
     }
 
@@ -1109,7 +1109,7 @@ static void do_constraint(struct pull_t *pull, t_pbc *pbc,
                 case epullgDIST:
                     if (pcrd->value_ref <= 0)
                     {
-                        gmx_fatal(FARGS, "The pull constraint reference distance for group %d is <= 0 (%f)", c, pcrd->value_ref);
+                        gmx_fatal(FARGS, "The pull constraint reference distance for group %zu is <= 0 (%f)", c, pcrd->value_ref);
                     }
 
                     {
index c1f0d4d0bd0e9389039e70502c5bba9b73314fe9..218e8d215045853288283d943d76d7d48d68cf7a 100644 (file)
@@ -601,7 +601,7 @@ gmx_ana_selmethod_register(gmx::SelectionParserSymbolTable *symtab,
         }
         catch (const gmx::APIError &ex)
         {
-            report_error(stderr, name, ex.what());
+            report_error(stderr, name, "%s", ex.what());
             bOk = false;
         }
     }
index 7565773a2685e3fd67724956465bbe630fe5bb61..fc1f4941b715f7185a3d166a16695953b32782b9 100644 (file)
@@ -103,7 +103,7 @@ throwUnlessDerivativeIsConsistentWithFunction(const std::function<double(double)
 
     if (!isConsistent)
     {
-        GMX_THROW(InconsistentInputError(formatString("Derivative inconsistent with analytical function in range [%d,%d]", minFail, maxFail)));
+        GMX_THROW(InconsistentInputError(formatString("Derivative inconsistent with analytical function in range [%f,%f]", minFail, maxFail)));
     }
 }
 
@@ -143,7 +143,7 @@ throwUnlessDerivativeIsConsistentWithFunction(ArrayRef<const double>        func
     }
     if (!isConsistent)
     {
-        GMX_THROW(InconsistentInputError(formatString("Derivative inconsistent with numerical vector for elements %d-%d", minFail+1, maxFail+1)));
+        GMX_THROW(InconsistentInputError(formatString("Derivative inconsistent with numerical vector for elements %lu-%lu", minFail+1, maxFail+1)));
     }
 }
 
index 35d3e414c4f45d7b69a1e4d74b8aa59cb6f69883..e3daa7ea41e96573f7283c11c54f68febf7f4946 100644 (file)
@@ -125,7 +125,7 @@ reportGpuUsage(const MDLogger                &mdlog,
             output += gmx::formatString("On host %s ", host);
         }
         output += gmx::formatString("%zu GPU%s %sselected for this run.\n"
-                                    "Mapping of GPU IDs to the %d GPU task%s in the %d rank%s on this node:\n  %s\n",
+                                    "Mapping of GPU IDs to the %zu GPU task%s in the %zu rank%s on this node:\n  %s\n",
                                     numGpusInUse, bPluralGpus ? "s" : "",
                                     userSetGpuIds ? "user-" : "auto-",
                                     numGpuTasksOnThisNode,
index a16deffb4520c0fa0803a92e17d3709de2a12413..ab1436759a876641d6deae33e522e54c08c7da43 100644 (file)
@@ -942,7 +942,7 @@ void checkHardwareOversubscription(int                             numThreadsOnT
          * TODO: When we have a proper parallel logging framework,
          *       the framework should add the rank and node numbers.
          */
-        GMX_LOG(mdlog.warning).asParagraph().appendTextFormatted(mesg.c_str());
+        GMX_LOG(mdlog.warning).asParagraph().appendTextFormatted("%s", mesg.c_str());
     }
 }
 
index f5bec85997ab87b3be3081e11a878f5181e870f5..fcfc808365d3c33f1045a0d4fe86ec5d3e995650 100644 (file)
@@ -187,7 +187,7 @@ static void list_top(const char *fn)
     status = cpp_open_file(fn, &handle, cppopts);
     if (status != 0)
     {
-        gmx_fatal(FARGS, cpp_error(&handle, status));
+        gmx_fatal(FARGS, "%s", cpp_error(&handle, status));
     }
     do
     {
@@ -197,7 +197,7 @@ static void list_top(const char *fn)
         {
             if (status != eCPP_OK)
             {
-                gmx_fatal(FARGS, cpp_error(&handle, status));
+                gmx_fatal(FARGS, "%s", cpp_error(&handle, status));
             }
             else
             {
@@ -209,7 +209,7 @@ static void list_top(const char *fn)
     status = cpp_close_file(&handle);
     if (status != eCPP_OK)
     {
-        gmx_fatal(FARGS, cpp_error(&handle, status));
+        gmx_fatal(FARGS, "%s", cpp_error(&handle, status));
     }
 }
 
index 5a9f65ca81c80301d685f7a4b3ee546957cefa7a..0798390d2660e2be033ffde6b9cba139e03cbb87 100644 (file)
@@ -66,7 +66,7 @@ static char *trim_string(const char *s, char *out, int maxlen)
 
     if (strlen(s) > (size_t)(maxlen-1))
     {
-        gmx_fatal(FARGS, "String '%s' (%d) is longer than buffer (%d).\n",
+        gmx_fatal(FARGS, "String '%s' (%zu) is longer than buffer (%d).\n",
                   s, strlen(s), maxlen-1);
     }
 
index e352fe5ab9ac0b54aacf4a1ca93c8f8a536cee2d..ca77fdd992bb83f33badd4acbfe280428daaacee 100644 (file)
@@ -201,7 +201,7 @@ void *save_malloc_aligned(const char *name, const char *file, int line,
     if (alignment > alignmentSize)
     {
         gmx_fatal(errno, __FILE__, __LINE__,
-                  "Cannot allocate aligned memory with alignment > %u bytes\n(called from file %s, line %d)", alignmentSize, file, line);
+                  "Cannot allocate aligned memory with alignment > %zu bytes\n(called from file %s, line %d)", alignmentSize, file, line);
     }
 
 
@@ -225,7 +225,7 @@ void *save_malloc_aligned(const char *name, const char *file, int line,
         if (p == nullptr)
         {
             gmx_fatal(errno, __FILE__, __LINE__,
-                      "Not enough memory. Failed to allocate %u aligned elements of size %u for %s\n(called from file %s, line %d)", nelem, elsize, name, file, line);
+                      "Not enough memory. Failed to allocate %zu aligned elements of size %zu for %s\n(called from file %s, line %d)", nelem, elsize, name, file, line);
         }
     }
     return p;