From df463c2cf9e1ee786b2f6e224e5168933c378ecb Mon Sep 17 00:00:00 2001 From: Mark Abraham Date: Thu, 17 Jun 2021 07:34:08 +0000 Subject: [PATCH] Rework -Weverything --- api/nblib/CMakeLists.txt | 25 ---- api/nblib/listed_forces/tests/typetests.cpp | 5 + api/nblib/tests/nbkernelsystem.cpp | 7 -- api/nblib/tests/topology.cpp | 7 -- cmake/gmxCFlags.cmake | 114 ++++++++++++++++++ src/CMakeLists.txt | 35 +----- src/gromacs/CMakeLists.txt | 6 +- src/gromacs/domdec/domdec.cpp | 8 -- src/gromacs/domdec/dump.cpp | 5 +- src/gromacs/fft/fft_mkl.cpp | 48 ++++---- src/gromacs/fileio/matio.cpp | 2 - src/gromacs/fileio/pdbio.cpp | 2 - src/gromacs/fileio/tpxio.cpp | 3 - src/gromacs/fileio/trrio.cpp | 4 +- src/gromacs/gmxana/gmx_analyze.cpp | 1 - src/gromacs/gmxana/gmx_bundle.cpp | 1 - src/gromacs/gmxana/gmx_chi.cpp | 4 +- src/gromacs/gmxana/gmx_enemat.cpp | 2 - src/gromacs/gmxana/gmx_filter.cpp | 1 - src/gromacs/gmxana/gmx_hbond.cpp | 6 - src/gromacs/gmxana/gmx_make_edi.cpp | 3 +- src/gromacs/gmxana/gmx_sans.cpp | 4 +- src/gromacs/gmxana/gmx_tcaf.cpp | 2 - src/gromacs/gmxana/gmx_velacc.cpp | 2 - src/gromacs/gmxlib/network.cpp | 2 +- .../gmxpreprocess/gen_maxwell_velocities.cpp | 13 -- src/gromacs/gmxpreprocess/hackblock.cpp | 4 - src/gromacs/gmxpreprocess/readir.cpp | 2 - src/gromacs/gmxpreprocess/ter_db.cpp | 2 - src/gromacs/gmxpreprocess/x2top.cpp | 2 - src/gromacs/gpu_utils/device_context_ocl.cpp | 14 +-- src/gromacs/mdlib/calcvir.cpp | 10 -- src/gromacs/mdlib/coupling.cpp | 1 - src/gromacs/mdlib/sim_util.cpp | 6 +- src/gromacs/mdrun/runner.cpp | 11 +- src/gromacs/nbnxm/nbnxm_gpu_buffer_ops.cpp | 2 +- .../nbnxm/opencl/nbnxm_ocl_data_mgmt.cpp | 9 -- .../nbnxm/opencl/nbnxm_ocl_jit_support.cpp | 8 -- .../simd/tests/bootstrap_loadstore.cpp | 4 +- src/gromacs/tables/cubicsplinetable.cpp | 10 +- src/gromacs/tables/quadraticsplinetable.cpp | 6 +- src/testutils/TestMacros.cmake | 21 ++-- src/testutils/unittest_main.cpp | 6 +- 43 files changed, 192 insertions(+), 238 deletions(-) diff --git a/api/nblib/CMakeLists.txt b/api/nblib/CMakeLists.txt index 5a7d5f3898..1f4c5c28bc 100644 --- a/api/nblib/CMakeLists.txt +++ b/api/nblib/CMakeLists.txt @@ -38,31 +38,6 @@ # \author Sebastian Keller # -# The following are copied directly from src/CMakeLists.txt -set(IGNORED_CLANG_ALL_WARNINGS - "-Wno-c++98-compat -Wno-c++98-compat-pedantic" #No intention of C++98 compability - "-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. - "-Wno-switch-enum" # default statement for enum is OK - - # These are all needed, mostly for testing code - "-Wno-conversion" - "-Wno-documentation" - "-Wno-double-promotion" - "-Wno-exit-time-destructors" - "-Wno-float-equal" - "-Wno-global-constructors" - "-Wno-padded" - "-Wno-reserved-id-macro" - "-Wno-shadow" - "-Wno-unused-macros" - "-Wno-weak-vtables" - ) - -string(REPLACE " " ";" IGNORED_CLANG_ALL_WARNINGS "${IGNORED_CLANG_ALL_WARNINGS}") - set(TESTUTILS_DIR ${PROJECT_SOURCE_DIR}/src/testutils) if (BUILD_TESTING) if(NOT GMX_DEVELOPER_BUILD) diff --git a/api/nblib/listed_forces/tests/typetests.cpp b/api/nblib/listed_forces/tests/typetests.cpp index 15d7e35fdb..b67f3b6f54 100644 --- a/api/nblib/listed_forces/tests/typetests.cpp +++ b/api/nblib/listed_forces/tests/typetests.cpp @@ -52,6 +52,9 @@ namespace nblib //! Number of atoms used in these tests. constexpr int c_numAtoms = 4; +namespace +{ + //! Coordinates for testing std::vector> c_coordinatesForTests = { { { 0.0, 0.0, 0.0 }, { 0.0, 0.0, 0.2 }, { 0.005, 0.0, 0.1 }, { -0.001, 0.1, 0.0 } }, @@ -71,6 +74,8 @@ std::vector> c_InputDihs = { { { ProperDihedral(Degr // Todo: update test setup to allow more than one interaction type and add the following to the inputs // std::vector> c_InputDihs = { { RyckaertBellemanDihedral({ -7.35, 13.6, 8.4, -16.7, 1.3, 12.4 }) } }; +} // namespace + template class ListedForcesBase { diff --git a/api/nblib/tests/nbkernelsystem.cpp b/api/nblib/tests/nbkernelsystem.cpp index cedaf185b9..022317375d 100644 --- a/api/nblib/tests/nbkernelsystem.cpp +++ b/api/nblib/tests/nbkernelsystem.cpp @@ -60,13 +60,6 @@ namespace test namespace { -// This is defined in src/gromacs/mdtypes/forcerec.h but there is also a -// legacy C6 macro defined there that conflicts with the nblib C6 type. -// Todo: Once that C6 has been refactored into a regular function, this -// file can just include forcerec.h -//! Macro to set Van der Waals interactions to atoms -#define SET_CGINFO_HAS_VDW(cgi) (cgi) = ((cgi) | (1 << 23)) - TEST(NBlibTest, SpcMethanolForcesAreCorrect) { auto options = NBKernelOptions(); diff --git a/api/nblib/tests/topology.cpp b/api/nblib/tests/topology.cpp index b29a33da68..84622a4bfb 100644 --- a/api/nblib/tests/topology.cpp +++ b/api/nblib/tests/topology.cpp @@ -78,13 +78,6 @@ void compareLists(const gmx::ListOfLists& list, const std::vector:-Weverything ${IGNORED_CLANG_ALL_WARNINGS}>) -endif() +# Make sure we fix "everything" found by compilers that support that +gmx_warn_on_everything(libgromacs) if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") target_compile_options(libgromacs PRIVATE $<$:/analyze /analyze:stacksize 70000 #Control flow warnings are disabled because the commond line output is insufficient. There is no tool diff --git a/src/gromacs/domdec/domdec.cpp b/src/gromacs/domdec/domdec.cpp index 4aa94fa887..3324ca2fea 100644 --- a/src/gromacs/domdec/domdec.cpp +++ b/src/gromacs/domdec/domdec.cpp @@ -138,14 +138,6 @@ static const char* enumValueToString(DlbState enumValue) return dlbStateNames[enumValue]; } -/* The size per atom group of the cggl_flag buffer in gmx_domdec_comm_t */ -#define DD_CGIBS 2 - -/* The flags for the cggl_flag buffer in gmx_domdec_comm_t */ -#define DD_FLAG_NRCG 65535 -#define DD_FLAG_FW(d) (1 << (16 + (d)*2)) -#define DD_FLAG_BW(d) (1 << (16 + (d)*2 + 1)) - /* The DD zone order */ static const ivec dd_zo[DD_MAXZONE] = { { 0, 0, 0 }, { 1, 0, 0 }, { 1, 1, 0 }, { 0, 1, 0 }, { 0, 1, 1 }, { 0, 0, 1 }, { 1, 0, 1 }, { 1, 1, 1 } }; diff --git a/src/gromacs/domdec/dump.cpp b/src/gromacs/domdec/dump.cpp index 7a7324cd4a..d7f815b7a9 100644 --- a/src/gromacs/domdec/dump.cpp +++ b/src/gromacs/domdec/dump.cpp @@ -61,7 +61,7 @@ void write_dd_grid_pdb(const char* fn, int64_t step, gmx_domdec_t* dd, matrix bo rvec grid_s[2], *grid_r = nullptr, cx, r; char fname[STRLEN], buf[22]; FILE* out; - int a, i, d, z, y, x; + int a, i, d, z, x; matrix tric; real vol; @@ -111,7 +111,7 @@ void write_dd_grid_pdb(const char* fn, int64_t step, gmx_domdec_t* dd, matrix bo } for (z = 0; z < 2; z++) { - for (y = 0; y < 2; y++) + for (int y = 0; y < 2; y++) { for (x = 0; x < 2; x++) { @@ -141,6 +141,7 @@ void write_dd_grid_pdb(const char* fn, int64_t step, gmx_domdec_t* dd, matrix bo { for (x = 0; x < 4; x++) { + int y = 0; switch (d) { case 0: y = 1 + i * 8 + 2 * x; break; diff --git a/src/gromacs/fft/fft_mkl.cpp b/src/gromacs/fft/fft_mkl.cpp index a64a7574c5..a8f4d367a5 100644 --- a/src/gromacs/fft/fft_mkl.cpp +++ b/src/gromacs/fft/fft_mkl.cpp @@ -2,7 +2,7 @@ * This file is part of the GROMACS molecular simulation package. * * Copyright (c) 1991-2003 David van der Spoel, Erik Lindahl, University of Groningen. - * Copyright (c) 2013,2014,2015,2016,2019,2020, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2016,2019,2020,2021, 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. @@ -109,7 +109,7 @@ struct gmx_fft }; -int gmx_fft_init_1d(gmx_fft_t* pfft, int nx, gmx_fft_flag gmx_unused flags) +int gmx_fft_init_1d(gmx_fft_t* pfft, int nxInt, gmx_fft_flag gmx_unused flags) { gmx_fft_t fft; int d; @@ -122,7 +122,7 @@ int gmx_fft_init_1d(gmx_fft_t* pfft, int nx, gmx_fft_flag gmx_unused flags) } *pfft = nullptr; - if ((fft = (gmx_fft_t)malloc(sizeof(struct gmx_fft))) == nullptr) + if ((fft = reinterpret_cast(malloc(sizeof(struct gmx_fft)))) == nullptr) { return ENOMEM; } @@ -135,7 +135,8 @@ int gmx_fft_init_1d(gmx_fft_t* pfft, int nx, gmx_fft_flag gmx_unused flags) fft->ooplace[3] = nullptr; - status = DftiCreateDescriptor(&fft->inplace[0], GMX_DFTI_PREC, DFTI_COMPLEX, 1, (MKL_LONG)nx); + MKL_LONG nx = nxInt; + status = DftiCreateDescriptor(&fft->inplace[0], GMX_DFTI_PREC, DFTI_COMPLEX, 1, nx); if (status == 0) { @@ -150,7 +151,7 @@ int gmx_fft_init_1d(gmx_fft_t* pfft, int nx, gmx_fft_flag gmx_unused flags) if (status == 0) { - status = DftiCreateDescriptor(&fft->ooplace[0], GMX_DFTI_PREC, DFTI_COMPLEX, 1, (MKL_LONG)nx); + status = DftiCreateDescriptor(&fft->ooplace[0], GMX_DFTI_PREC, DFTI_COMPLEX, 1, nx); } if (status == 0) @@ -179,7 +180,7 @@ int gmx_fft_init_1d(gmx_fft_t* pfft, int nx, gmx_fft_flag gmx_unused flags) } -int gmx_fft_init_1d_real(gmx_fft_t* pfft, int nx, gmx_fft_flag gmx_unused flags) +int gmx_fft_init_1d_real(gmx_fft_t* pfft, int nxInt, gmx_fft_flag gmx_unused flags) { gmx_fft_t fft; int d; @@ -192,7 +193,7 @@ int gmx_fft_init_1d_real(gmx_fft_t* pfft, int nx, gmx_fft_flag gmx_unused flags) } *pfft = nullptr; - if ((fft = (gmx_fft_t)malloc(sizeof(struct gmx_fft))) == nullptr) + if ((fft = reinterpret_cast(malloc(sizeof(struct gmx_fft)))) == nullptr) { return ENOMEM; } @@ -204,7 +205,8 @@ int gmx_fft_init_1d_real(gmx_fft_t* pfft, int nx, gmx_fft_flag gmx_unused flags) } fft->ooplace[3] = nullptr; - status = DftiCreateDescriptor(&fft->inplace[0], GMX_DFTI_PREC, DFTI_REAL, 1, (MKL_LONG)nx); + MKL_LONG nx = nxInt; + status = DftiCreateDescriptor(&fft->inplace[0], GMX_DFTI_PREC, DFTI_REAL, 1, nx); if (status == 0) { @@ -219,7 +221,7 @@ int gmx_fft_init_1d_real(gmx_fft_t* pfft, int nx, gmx_fft_flag gmx_unused flags) if (status == 0) { - status = DftiCreateDescriptor(&fft->ooplace[0], GMX_DFTI_PREC, DFTI_REAL, 1, (MKL_LONG)nx); + status = DftiCreateDescriptor(&fft->ooplace[0], GMX_DFTI_PREC, DFTI_REAL, 1, nx); } if (status == 0) @@ -254,7 +256,7 @@ int gmx_fft_init_1d_real(gmx_fft_t* pfft, int nx, gmx_fft_flag gmx_unused flags) } -int gmx_fft_init_2d_real(gmx_fft_t* pfft, int nx, int ny, gmx_fft_flag gmx_unused flags) +int gmx_fft_init_2d_real(gmx_fft_t* pfft, int nxInt, int nyInt, gmx_fft_flag gmx_unused flags) { gmx_fft_t fft; int d; @@ -269,12 +271,12 @@ int gmx_fft_init_2d_real(gmx_fft_t* pfft, int nx, int ny, gmx_fft_flag gmx_unuse } *pfft = nullptr; - if ((fft = (gmx_fft_t)malloc(sizeof(struct gmx_fft))) == nullptr) + if ((fft = reinterpret_cast(malloc(sizeof(struct gmx_fft)))) == nullptr) { return ENOMEM; } - nyc = (ny / 2 + 1); + nyc = (nyInt / 2 + 1); /* Mark all handles invalid */ for (d = 0; d < 3; d++) @@ -289,7 +291,8 @@ int gmx_fft_init_2d_real(gmx_fft_t* pfft, int nx, int ny, gmx_fft_flag gmx_unuse */ /* In-place X FFT */ - status = DftiCreateDescriptor(&fft->inplace[0], GMX_DFTI_PREC, DFTI_COMPLEX, 1, (MKL_LONG)nx); + MKL_LONG nx = nxInt; + status = DftiCreateDescriptor(&fft->inplace[0], GMX_DFTI_PREC, DFTI_COMPLEX, 1, nx); if (status == 0) { @@ -312,7 +315,7 @@ int gmx_fft_init_2d_real(gmx_fft_t* pfft, int nx, int ny, gmx_fft_flag gmx_unuse /* Out-of-place X FFT */ if (status == 0) { - status = DftiCreateDescriptor(&(fft->ooplace[0]), GMX_DFTI_PREC, DFTI_COMPLEX, 1, (MKL_LONG)nx); + status = DftiCreateDescriptor(&(fft->ooplace[0]), GMX_DFTI_PREC, DFTI_COMPLEX, 1, nx); } if (status == 0) @@ -335,9 +338,10 @@ int gmx_fft_init_2d_real(gmx_fft_t* pfft, int nx, int ny, gmx_fft_flag gmx_unuse /* In-place Y FFT */ + MKL_LONG ny = nyInt; if (status == 0) { - status = DftiCreateDescriptor(&fft->inplace[1], GMX_DFTI_PREC, DFTI_REAL, 1, (MKL_LONG)ny); + status = DftiCreateDescriptor(&fft->inplace[1], GMX_DFTI_PREC, DFTI_REAL, 1, ny); } if (status == 0) @@ -346,7 +350,7 @@ int gmx_fft_init_2d_real(gmx_fft_t* pfft, int nx, int ny, gmx_fft_flag gmx_unuse stride[1] = 1; status = (DftiSetValue(fft->inplace[1], DFTI_PLACEMENT, DFTI_INPLACE) - || DftiSetValue(fft->inplace[1], DFTI_NUMBER_OF_TRANSFORMS, (MKL_LONG)nx) + || DftiSetValue(fft->inplace[1], DFTI_NUMBER_OF_TRANSFORMS, nx) || DftiSetValue(fft->inplace[1], DFTI_INPUT_DISTANCE, 2 * nyc) || DftiSetValue(fft->inplace[1], DFTI_INPUT_STRIDES, stride) || DftiSetValue(fft->inplace[1], DFTI_OUTPUT_DISTANCE, 2 * nyc) @@ -358,7 +362,7 @@ int gmx_fft_init_2d_real(gmx_fft_t* pfft, int nx, int ny, gmx_fft_flag gmx_unuse /* Out-of-place real-to-complex (affects output distance) Y FFT */ if (status == 0) { - status = DftiCreateDescriptor(&fft->ooplace[1], GMX_DFTI_PREC, DFTI_REAL, 1, (MKL_LONG)ny); + status = DftiCreateDescriptor(&fft->ooplace[1], GMX_DFTI_PREC, DFTI_REAL, 1, ny); } if (status == 0) @@ -367,8 +371,8 @@ int gmx_fft_init_2d_real(gmx_fft_t* pfft, int nx, int ny, gmx_fft_flag gmx_unuse stride[1] = 1; status = (DftiSetValue(fft->ooplace[1], DFTI_PLACEMENT, DFTI_NOT_INPLACE) - || DftiSetValue(fft->ooplace[1], DFTI_NUMBER_OF_TRANSFORMS, (MKL_LONG)nx) - || DftiSetValue(fft->ooplace[1], DFTI_INPUT_DISTANCE, (MKL_LONG)ny) + || DftiSetValue(fft->ooplace[1], DFTI_NUMBER_OF_TRANSFORMS, nx) + || DftiSetValue(fft->ooplace[1], DFTI_INPUT_DISTANCE, ny) || DftiSetValue(fft->ooplace[1], DFTI_INPUT_STRIDES, stride) || DftiSetValue(fft->ooplace[1], DFTI_OUTPUT_DISTANCE, 2 * nyc) || DftiSetValue(fft->ooplace[1], DFTI_OUTPUT_STRIDES, stride) @@ -379,7 +383,7 @@ int gmx_fft_init_2d_real(gmx_fft_t* pfft, int nx, int ny, gmx_fft_flag gmx_unuse /* Out-of-place complex-to-real (affects output distance) Y FFT */ if (status == 0) { - status = DftiCreateDescriptor(&fft->ooplace[2], GMX_DFTI_PREC, DFTI_REAL, 1, (MKL_LONG)ny); + status = DftiCreateDescriptor(&fft->ooplace[2], GMX_DFTI_PREC, DFTI_REAL, 1, ny); } if (status == 0) @@ -388,10 +392,10 @@ int gmx_fft_init_2d_real(gmx_fft_t* pfft, int nx, int ny, gmx_fft_flag gmx_unuse stride[1] = 1; status = (DftiSetValue(fft->ooplace[2], DFTI_PLACEMENT, DFTI_NOT_INPLACE) - || DftiSetValue(fft->ooplace[2], DFTI_NUMBER_OF_TRANSFORMS, (MKL_LONG)nx) + || DftiSetValue(fft->ooplace[2], DFTI_NUMBER_OF_TRANSFORMS, nx) || DftiSetValue(fft->ooplace[2], DFTI_INPUT_DISTANCE, 2 * nyc) || DftiSetValue(fft->ooplace[2], DFTI_INPUT_STRIDES, stride) - || DftiSetValue(fft->ooplace[2], DFTI_OUTPUT_DISTANCE, (MKL_LONG)ny) + || DftiSetValue(fft->ooplace[2], DFTI_OUTPUT_DISTANCE, ny) || DftiSetValue(fft->ooplace[2], DFTI_OUTPUT_STRIDES, stride) || DftiCommitDescriptor(fft->ooplace[2])); } diff --git a/src/gromacs/fileio/matio.cpp b/src/gromacs/fileio/matio.cpp index a75a63ad48..b509b551f5 100644 --- a/src/gromacs/fileio/matio.cpp +++ b/src/gromacs/fileio/matio.cpp @@ -67,8 +67,6 @@ static const char mapper[] = "?"; #define NMAP static_cast(sizeof(mapper) / sizeof(mapper[0])) -#define MAX_XPM_LINELENGTH 4096 - real** mk_matrix(int nx, int ny, gmx_bool b1D) { int i; diff --git a/src/gromacs/fileio/pdbio.cpp b/src/gromacs/fileio/pdbio.cpp index 1b3c4ec0ca..380e84dd35 100644 --- a/src/gromacs/fileio/pdbio.cpp +++ b/src/gromacs/fileio/pdbio.cpp @@ -87,8 +87,6 @@ const char* enumValueToString(PdbRecordType enumValue) return pdbRecordTypeName[enumValue]; } -#define REMARK_SIM_BOX "REMARK THIS IS A SIMULATION BOX" - void gmx_write_pdb_box(FILE* out, PbcType pbcType, const matrix box) { real alpha, beta, gamma; diff --git a/src/gromacs/fileio/tpxio.cpp b/src/gromacs/fileio/tpxio.cpp index 6109039cd5..d70585a9e4 100644 --- a/src/gromacs/fileio/tpxio.cpp +++ b/src/gromacs/fileio/tpxio.cpp @@ -247,9 +247,6 @@ static const t_ftupd ftupd[] = { }; #define NFTUPD asize(ftupd) -/* Needed for backward compatibility */ -#define MAXNODES 256 - /************************************************************** * * Now the higer level routines that do io of the structures and arrays diff --git a/src/gromacs/fileio/trrio.cpp b/src/gromacs/fileio/trrio.cpp index e1cdadd30b..8992c52443 100644 --- a/src/gromacs/fileio/trrio.cpp +++ b/src/gromacs/fileio/trrio.cpp @@ -4,7 +4,7 @@ * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. * Copyright (c) 2013,2014,2015,2016,2018 by the GROMACS development team. - * Copyright (c) 2019,2020, by the GROMACS development team, led by + * Copyright (c) 2019,2020,2021, 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. @@ -48,8 +48,6 @@ #include "gromacs/utility/futil.h" #include "gromacs/utility/smalloc.h" -#define BUFSIZE 128 - static int nFloatSize(gmx_trr_header_t* sh) { int nflsize = 0; diff --git a/src/gromacs/gmxana/gmx_analyze.cpp b/src/gromacs/gmxana/gmx_analyze.cpp index f3514649c0..f87b84637f 100644 --- a/src/gromacs/gmxana/gmx_analyze.cpp +++ b/src/gromacs/gmxana/gmx_analyze.cpp @@ -1157,7 +1157,6 @@ int gmx_analyze(int argc, char* argv[]) { "-subav", FALSE, etBOOL, { &bSubAv }, "Subtract the average before autocorrelating" }, { "-oneacf", FALSE, etBOOL, { &bAverCorr }, "Calculate one ACF over all sets" }, }; -#define NPA asize(pa) FILE* out; int n, nlast, s, nset, i, j = 0; diff --git a/src/gromacs/gmxana/gmx_bundle.cpp b/src/gromacs/gmxana/gmx_bundle.cpp index c3daa88a03..ecf8df80fc 100644 --- a/src/gromacs/gmxana/gmx_bundle.cpp +++ b/src/gromacs/gmxana/gmx_bundle.cpp @@ -247,7 +247,6 @@ int gmx_bundle(int argc, char* argv[]) gmx_output_env_t* oenv; gmx_rmpbc_t gpbc = nullptr; -#define NLEG asize(leg) t_filenm fnm[] = { { efTRX, "-f", nullptr, ffREAD }, { efTPS, nullptr, nullptr, ffREAD }, { efNDX, nullptr, nullptr, ffOPTRD }, { efXVG, "-ol", "bun_len", ffWRITE }, diff --git a/src/gromacs/gmxana/gmx_chi.cpp b/src/gromacs/gmxana/gmx_chi.cpp index a23ff444a6..0abd978d19 100644 --- a/src/gromacs/gmxana/gmx_chi.cpp +++ b/src/gromacs/gmxana/gmx_chi.cpp @@ -127,8 +127,7 @@ static gmx_bool bAllowed(real phi, real psi) "0000000000000000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000000000000000" }; -#define NPP asize(map) - int x, y; + int x, y; #define INDEX(ppp) (((static_cast(360 + (ppp)*gmx::c_rad2Deg)) % 360) / 6) x = INDEX(phi); @@ -1045,7 +1044,6 @@ static void print_transitions(const char* fn, int maxchi, int nlist, t_dlist dli /* must correspond with enum in pp2shift.h:38 */ char* leg[edMax]; -#define NLEG asize(leg) leg[0] = gmx_strdup("Phi"); leg[1] = gmx_strdup("Psi"); diff --git a/src/gromacs/gmxana/gmx_enemat.cpp b/src/gromacs/gmxana/gmx_enemat.cpp index ae4341958d..ff7893d410 100644 --- a/src/gromacs/gmxana/gmx_enemat.cpp +++ b/src/gromacs/gmxana/gmx_enemat.cpp @@ -311,8 +311,6 @@ int gmx_enemat(int argc, char* argv[]) if (timecheck == 0) { -#define DONTSKIP(cnt) (skip) ? (((cnt) % skip) == 0) : TRUE - if (bCont) { fprintf(stderr, "\rRead frame: %d, Time: %.3f", teller, fr->t); diff --git a/src/gromacs/gmxana/gmx_filter.cpp b/src/gromacs/gmxana/gmx_filter.cpp index e8b95b1a3b..a294a4c053 100644 --- a/src/gromacs/gmxana/gmx_filter.cpp +++ b/src/gromacs/gmxana/gmx_filter.cpp @@ -112,7 +112,6 @@ int gmx_filter(int argc, char* argv[]) gmx_output_env_t* oenv; gmx_rmpbc_t gpbc = nullptr; -#define NLEG asize(leg) t_filenm fnm[] = { { efTRX, "-f", nullptr, ffREAD }, { efTPS, nullptr, nullptr, ffOPTRD }, { efNDX, nullptr, nullptr, ffOPTRD }, diff --git a/src/gromacs/gmxana/gmx_hbond.cpp b/src/gromacs/gmxana/gmx_hbond.cpp index 7cb4a978d7..1c69af1af7 100644 --- a/src/gromacs/gmxana/gmx_hbond.cpp +++ b/src/gromacs/gmxana/gmx_hbond.cpp @@ -114,17 +114,11 @@ static const char* grpnames[grNR] = { "0", "1", "I" }; // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) static gmx_bool bDebug = FALSE; -#define HB_NO 0 -#define HB_YES 1 << 0 -#define HB_INS 1 << 1 -#define HB_YESINS (HB_YES | HB_INS) #define HB_NR (1 << 2) #define MAXHYDRO 4 #define ISHB(h) ((h)&2) #define ISDIST(h) ((h)&1) -#define ISDIST2(h) ((h)&4) -#define ISACC(h) ((h)&c_acceptorMask) #define ISDON(h) ((h)&c_donorMask) #define ISINGRP(h) ((h)&c_inGroupMask) diff --git a/src/gromacs/gmxana/gmx_make_edi.cpp b/src/gromacs/gmxana/gmx_make_edi.cpp index 7f154cd85e..f4f15ae578 100644 --- a/src/gromacs/gmxana/gmx_make_edi.cpp +++ b/src/gromacs/gmxana/gmx_make_edi.cpp @@ -2,7 +2,7 @@ * This file is part of the GROMACS molecular simulation package. * * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team. - * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by + * Copyright (c) 2017,2018,2019,2020,2021, 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. @@ -399,7 +399,6 @@ enum evMON, evNr }; -#define oldMAGIC 666 #define MAGIC 670 diff --git a/src/gromacs/gmxana/gmx_sans.cpp b/src/gromacs/gmxana/gmx_sans.cpp index b6ac442c47..1d90030821 100644 --- a/src/gromacs/gmxana/gmx_sans.cpp +++ b/src/gromacs/gmxana/gmx_sans.cpp @@ -2,7 +2,7 @@ * This file is part of the GROMACS molecular simulation package. * * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team. - * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by + * Copyright (c) 2017,2018,2019,2020,2021, 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. @@ -96,8 +96,6 @@ int gmx_sans(int argc, char* argv[]) gmx_neutron_atomic_structurefactors_t* gnsf; gmx_sans_t* gsans; -#define NPA asize(pa) - t_pargs pa[] = { { "-bin", FALSE, etREAL, { &binwidth }, "[HIDDEN]Binwidth (nm)" }, { "-mode", FALSE, etENUM, { emode }, "Mode for sans spectra calculation" }, diff --git a/src/gromacs/gmxana/gmx_tcaf.cpp b/src/gromacs/gmxana/gmx_tcaf.cpp index 95b0cc1c00..4c8f215f91 100644 --- a/src/gromacs/gmxana/gmx_tcaf.cpp +++ b/src/gromacs/gmxana/gmx_tcaf.cpp @@ -356,8 +356,6 @@ int gmx_tcaf(int argc, char* argv[]) real** tc; gmx_output_env_t* oenv; -#define NHISTO 360 - t_filenm fnm[] = { { efTRN, "-f", nullptr, ffREAD }, { efTPS, nullptr, nullptr, ffOPTRD }, { efNDX, nullptr, nullptr, ffOPTRD }, { efXVG, "-ot", "transcur", ffOPTWR }, { efXVG, "-oa", "tcaf_all", ffWRITE }, { efXVG, "-o", "tcaf", ffWRITE }, diff --git a/src/gromacs/gmxana/gmx_velacc.cpp b/src/gromacs/gmxana/gmx_velacc.cpp index b12cfbb021..d6da3b0d3d 100644 --- a/src/gromacs/gmxana/gmx_velacc.cpp +++ b/src/gromacs/gmxana/gmx_velacc.cpp @@ -219,8 +219,6 @@ int gmx_velacc(int argc, char* argv[]) real* normm = nullptr; gmx_output_env_t* oenv; -#define NHISTO 360 - t_filenm fnm[] = { { efTRN, "-f", nullptr, ffREAD }, { efTPS, nullptr, nullptr, ffOPTRD }, { efNDX, nullptr, nullptr, ffOPTRD }, diff --git a/src/gromacs/gmxlib/network.cpp b/src/gromacs/gmxlib/network.cpp index f4adc6931c..eec49f099a 100644 --- a/src/gromacs/gmxlib/network.cpp +++ b/src/gromacs/gmxlib/network.cpp @@ -193,7 +193,7 @@ void gmx_setup_nodecomm(FILE gmx_unused* fplog, t_commrec* cr) fprintf(fplog, "Using two step summing over %d groups of on average %.1f ranks\n\n", ng, - (real)n / (real)ng); + real(n) / real(ng)); } if (nc->rank_intra > 0) { diff --git a/src/gromacs/gmxpreprocess/gen_maxwell_velocities.cpp b/src/gromacs/gmxpreprocess/gen_maxwell_velocities.cpp index b02735d60d..6272fb79fe 100644 --- a/src/gromacs/gmxpreprocess/gen_maxwell_velocities.cpp +++ b/src/gromacs/gmxpreprocess/gen_maxwell_velocities.cpp @@ -147,14 +147,6 @@ static real calc_cm(int natoms, const real mass[], rvec x[], rvec v[], rvec xcm, acm[m] -= a0[m] / tm; } -#define PVEC(str, v) \ - fprintf(log, "%s[X]: %10.5e %s[Y]: %10.5e %s[Z]: %10.5e\n", str, (v)[0], str, (v)[1], str, (v)[2]) -#ifdef DEBUG - PVEC("xcm", xcm); - PVEC("acm", acm); - PVEC("vcm", vcm); -#endif - clear_mat(L); for (i = 0; (i < natoms); i++) { @@ -170,11 +162,6 @@ static real calc_cm(int natoms, const real mass[], rvec x[], rvec v[], rvec xcm, L[YY][ZZ] += dx[YY] * dx[ZZ] * m0; L[ZZ][ZZ] += dx[ZZ] * dx[ZZ] * m0; } -#ifdef DEBUG - PVEC("L-x", L[XX]); - PVEC("L-y", L[YY]); - PVEC("L-z", L[ZZ]); -#endif return tm; } diff --git a/src/gromacs/gmxpreprocess/hackblock.cpp b/src/gromacs/gmxpreprocess/hackblock.cpp index 956e0d72e1..002854663c 100644 --- a/src/gromacs/gmxpreprocess/hackblock.cpp +++ b/src/gromacs/gmxpreprocess/hackblock.cpp @@ -101,8 +101,6 @@ void clearModificationBlock(MoleculePatchDatabase* globalPatches) } } -#define safe_strdup(str) (((str) != NULL) ? gmx_strdup(str) : NULL) - static bool contains_char(const BondedInteraction& s, char c) { @@ -283,5 +281,3 @@ void copyModificationBlocks(const MoleculePatchDatabase& s, MoleculePatchDatabas } mergeAtomAndBondModifications(s, d); } - -#undef safe_strdup diff --git a/src/gromacs/gmxpreprocess/readir.cpp b/src/gromacs/gmxpreprocess/readir.cpp index 50e7dd9f69..4ca4390d14 100644 --- a/src/gromacs/gmxpreprocess/readir.cpp +++ b/src/gromacs/gmxpreprocess/readir.cpp @@ -94,7 +94,6 @@ #include "gromacs/utility/stringutil.h" #include "gromacs/utility/textwriter.h" -#define MAXPTR 254 #define NOGID 255 using gmx::BasicVector; @@ -3254,7 +3253,6 @@ static bool do_egp_flag(t_inputrec* ir, SimulationGroups* groups, const char* op * But since this is much larger than STRLEN, such a line can not be parsed. * The real maximum is the number of names that fit in a string: STRLEN/2. */ -#define EGP_MAX (STRLEN / 2) int j, k, nr; bool bSet; diff --git a/src/gromacs/gmxpreprocess/ter_db.cpp b/src/gromacs/gmxpreprocess/ter_db.cpp index 2329cd324a..6301e82fd6 100644 --- a/src/gromacs/gmxpreprocess/ter_db.cpp +++ b/src/gromacs/gmxpreprocess/ter_db.cpp @@ -90,8 +90,6 @@ static std::optional findTypeFromKeyword(char* keyw) return converter.valueFrom(keyw); } -#define FATAL() gmx_fatal(FARGS, "Reading Termini Database: not enough items on line\n%s", line) - static void read_atom(char* line, bool bAdd, std::string* nname, t_atom* a, PreprocessingAtomTypes* atype, int* cgnr) { int nr, i; diff --git a/src/gromacs/gmxpreprocess/x2top.cpp b/src/gromacs/gmxpreprocess/x2top.cpp index de2544bd6a..70932326b0 100644 --- a/src/gromacs/gmxpreprocess/x2top.cpp +++ b/src/gromacs/gmxpreprocess/x2top.cpp @@ -73,8 +73,6 @@ #include "hackblock.h" -#define MARGIN_FAC 1.1 - static bool is_bond(int nnm, t_nm2type nmt[], char* ai, char* aj, real blen) { int i, j; diff --git a/src/gromacs/gpu_utils/device_context_ocl.cpp b/src/gromacs/gpu_utils/device_context_ocl.cpp index 0ecf83daf5..b342d24991 100644 --- a/src/gromacs/gpu_utils/device_context_ocl.cpp +++ b/src/gromacs/gpu_utils/device_context_ocl.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2020, by the GROMACS development team, led by + * Copyright (c) 2020,2021, 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. @@ -50,17 +50,17 @@ #include "gromacs/utility/gmxassert.h" #include "gromacs/utility/stringutil.h" +#ifndef DOXYGEN + /*! \brief Copies of values from cl_driver_diagnostics_intel.h, * which isn't guaranteed to be available. */ /**@{*/ -#define CL_CONTEXT_SHOW_DIAGNOSTICS_INTEL 0x4106 -#define CL_CONTEXT_DIAGNOSTICS_LEVEL_GOOD_INTEL 0x1 -#define CL_CONTEXT_DIAGNOSTICS_LEVEL_BAD_INTEL 0x2 -#define CL_CONTEXT_DIAGNOSTICS_LEVEL_NEUTRAL_INTEL 0x4 +# define CL_CONTEXT_SHOW_DIAGNOSTICS_INTEL 0x4106 +# define CL_CONTEXT_DIAGNOSTICS_LEVEL_GOOD_INTEL 0x1 +# define CL_CONTEXT_DIAGNOSTICS_LEVEL_BAD_INTEL 0x2 +# define CL_CONTEXT_DIAGNOSTICS_LEVEL_NEUTRAL_INTEL 0x4 /**@}*/ -#ifndef DOXYGEN - DeviceContext::DeviceContext(const DeviceInformation& deviceInfo) : deviceInfo_(deviceInfo) { cl_platform_id platformId = deviceInfo.oclPlatformId; diff --git a/src/gromacs/mdlib/calcvir.cpp b/src/gromacs/mdlib/calcvir.cpp index 6a9f1903fb..ac8bd58dd1 100644 --- a/src/gromacs/mdlib/calcvir.cpp +++ b/src/gromacs/mdlib/calcvir.cpp @@ -51,16 +51,6 @@ #include "gromacs/pbcutil/pbc.h" #include "gromacs/utility/gmxassert.h" -#define XXXX 0 -#define XXYY 1 -#define XXZZ 2 -#define YYXX 3 -#define YYYY 4 -#define YYZZ 5 -#define ZZXX 6 -#define ZZYY 7 -#define ZZZZ 8 - static void upd_vir(rvec vir, real dvx, real dvy, real dvz) { vir[XX] -= 0.5 * dvx; diff --git a/src/gromacs/mdlib/coupling.cpp b/src/gromacs/mdlib/coupling.cpp index 4c24f6350c..f280129898 100644 --- a/src/gromacs/mdlib/coupling.cpp +++ b/src/gromacs/mdlib/coupling.cpp @@ -81,7 +81,6 @@ /* for n=3, w0 = w2 = 1/(2-2^-(1/3)), w1 = 1-2*w0 */ /* for n=5, w0 = w1 = w3 = w4 = 1/(4-4^-(1/3)), w1 = 1-4*w0 */ -#define MAX_SUZUKI_YOSHIDA_NUM 5 #define SUZUKI_YOSHIDA_NUM 5 static const double sy_const_1[] = { 1. }; diff --git a/src/gromacs/mdlib/sim_util.cpp b/src/gromacs/mdlib/sim_util.cpp index 5b3f72dd87..45026b2ad5 100644 --- a/src/gromacs/mdlib/sim_util.cpp +++ b/src/gromacs/mdlib/sim_util.cpp @@ -1293,9 +1293,9 @@ void do_force(FILE* fplog, nbnxn_atomdata_copy_shiftvec(stepWork.haveDynamicBox, fr->shift_vec, nbv->nbat.get()); const bool pmeSendCoordinatesFromGpu = - GMX_MPI && simulationWork.useGpuPmePpCommunication && !(stepWork.doNeighborSearch); + simulationWork.useGpuPmePpCommunication && !(stepWork.doNeighborSearch); const bool reinitGpuPmePpComms = - GMX_MPI && simulationWork.useGpuPmePpCommunication && (stepWork.doNeighborSearch); + simulationWork.useGpuPmePpCommunication && (stepWork.doNeighborSearch); auto* localXReadyOnDevice = (stepWork.haveGpuPmeOnThisRank || simulationWork.useGpuBufferOps) ? stateGpu->getCoordinatesReadyOnDeviceEvent( @@ -1353,7 +1353,7 @@ void do_force(FILE* fplog, } } - if (GMX_MPI && !thisRankHasDuty(cr, DUTY_PME) && stepWork.computeSlowForces) + if (!thisRankHasDuty(cr, DUTY_PME) && stepWork.computeSlowForces) { /* Send particle coordinates to the pme nodes */ if (!pmeSendCoordinatesFromGpu && !stepWork.doNeighborSearch && simulationWork.useGpuUpdate) diff --git a/src/gromacs/mdrun/runner.cpp b/src/gromacs/mdrun/runner.cpp index 45c569630c..9da0886029 100644 --- a/src/gromacs/mdrun/runner.cpp +++ b/src/gromacs/mdrun/runner.cpp @@ -202,18 +202,11 @@ static DevelopmentFeatureFlags manageDevelopmentFeatures(const gmx::MDLogger& md { DevelopmentFeatureFlags devFlags; - // Some builds of GCC 5 give false positive warnings that these - // getenv results are ignored when clearly they are used. -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-result" - devFlags.enableGpuBufferOps = GMX_GPU_CUDA && useGpuForNonbonded && (getenv("GMX_USE_GPU_BUFFER_OPS") != nullptr); - devFlags.enableGpuHaloExchange = GMX_GPU_CUDA && getenv("GMX_GPU_DD_COMMS") != nullptr; + devFlags.enableGpuHaloExchange = GMX_MPI && GMX_GPU_CUDA && getenv("GMX_GPU_DD_COMMS") != nullptr; devFlags.forceGpuUpdateDefault = (getenv("GMX_FORCE_UPDATE_DEFAULT_GPU") != nullptr) || GMX_FAHCORE; - devFlags.enableGpuPmePPComm = GMX_GPU_CUDA && getenv("GMX_GPU_PME_PP_COMMS") != nullptr; - -#pragma GCC diagnostic pop + devFlags.enableGpuPmePPComm = GMX_MPI && GMX_GPU_CUDA && getenv("GMX_GPU_PME_PP_COMMS") != nullptr; // Direct GPU comm path is being used with CUDA_AWARE_MPI // make sure underlying MPI implementation is CUDA-aware diff --git a/src/gromacs/nbnxm/nbnxm_gpu_buffer_ops.cpp b/src/gromacs/nbnxm/nbnxm_gpu_buffer_ops.cpp index c317b32d84..f2ea0f2a7c 100644 --- a/src/gromacs/nbnxm/nbnxm_gpu_buffer_ops.cpp +++ b/src/gromacs/nbnxm/nbnxm_gpu_buffer_ops.cpp @@ -76,7 +76,7 @@ void nbnxn_gpu_x_to_nbat_x(const Nbnxm::Grid& grid, int numColumnsMax, bool mustInsertNonLocalDependency) { - GMX_ASSERT((bool)GMX_GPU_CUDA || (bool)GMX_GPU_SYCL, + GMX_ASSERT(bool(GMX_GPU_CUDA) || bool(GMX_GPU_SYCL), "NBNXM X buffer operations only supported in CUDA and SYCL"); GMX_ASSERT(nb, "Need a valid nbnxn_gpu object"); gmx::InteractionLocality interactionLoc = gmx::atomToInteractionLocality(locality); diff --git a/src/gromacs/nbnxm/opencl/nbnxm_ocl_data_mgmt.cpp b/src/gromacs/nbnxm/opencl/nbnxm_ocl_data_mgmt.cpp index ea901eb715..f7603fd54f 100644 --- a/src/gromacs/nbnxm/opencl/nbnxm_ocl_data_mgmt.cpp +++ b/src/gromacs/nbnxm/opencl/nbnxm_ocl_data_mgmt.cpp @@ -78,15 +78,6 @@ namespace Nbnxm { -/*! \brief Copies of values from cl_driver_diagnostics_intel.h, - * which isn't guaranteed to be available. */ -/**@{*/ -#define CL_CONTEXT_SHOW_DIAGNOSTICS_INTEL 0x4106 -#define CL_CONTEXT_DIAGNOSTICS_LEVEL_GOOD_INTEL 0x1 -#define CL_CONTEXT_DIAGNOSTICS_LEVEL_BAD_INTEL 0x2 -#define CL_CONTEXT_DIAGNOSTICS_LEVEL_NEUTRAL_INTEL 0x4 -/**@}*/ - /*! \brief This parameter should be determined heuristically from the * kernel execution times * diff --git a/src/gromacs/nbnxm/opencl/nbnxm_ocl_jit_support.cpp b/src/gromacs/nbnxm/opencl/nbnxm_ocl_jit_support.cpp index dfc2c5a6e2..2526b0054b 100644 --- a/src/gromacs/nbnxm/opencl/nbnxm_ocl_jit_support.cpp +++ b/src/gromacs/nbnxm/opencl/nbnxm_ocl_jit_support.cpp @@ -62,14 +62,6 @@ #include "nbnxm_ocl_types.h" -/*! \brief Stringifies the input argument - */ -#define STRINGIFY_PARAM(c) #c - -/*! \brief Stringifies the result of expansion of a macro argument - */ -#define STRINGIFY_MACRO(c) STRINGIFY_PARAM(c) - /*! \brief Array of the defines needed to generate a specific eel flavour * * The twin-cutoff entries are not normally used, because those setups are diff --git a/src/gromacs/simd/tests/bootstrap_loadstore.cpp b/src/gromacs/simd/tests/bootstrap_loadstore.cpp index 8d64617b45..5239076a77 100644 --- a/src/gromacs/simd/tests/bootstrap_loadstore.cpp +++ b/src/gromacs/simd/tests/bootstrap_loadstore.cpp @@ -117,10 +117,10 @@ void loadStoreTester(TSimd gmx_simdcall loadFn(const T* mem), for (i = 0; i < simdWidth * 4; i++) { - EXPECT_EQ(src[i], (T)(1 + i)) << "Side effect on source memory, i = " << i; + EXPECT_EQ(src[i], T(1 + i)) << "Side effect on source memory, i = " << i; if (dst + i < pCopyDst || dst + i >= pCopyDst + simdWidth) { - EXPECT_EQ(dst[i], (T)(-1 - i)) << "Side effect on destination memory, i = " << i; + EXPECT_EQ(dst[i], T(-1 - i)) << "Side effect on destination memory, i = " << i; } } } diff --git a/src/gromacs/tables/cubicsplinetable.cpp b/src/gromacs/tables/cubicsplinetable.cpp index 740296624b..2f9fd05030 100644 --- a/src/gromacs/tables/cubicsplinetable.cpp +++ b/src/gromacs/tables/cubicsplinetable.cpp @@ -150,11 +150,11 @@ void fillSingleCubicSplineTableData(const std::function& functio for (int i = endIndex - 1; i >= 0; i--) { - double x = i * spacing; - double tmpFunctionValue; - double tmpDerivativeValue; - double nextHigherFunction; - double nextHigherDerivative; + double x = i * spacing; + double tmpFunctionValue = 0; + double tmpDerivativeValue = 0; + double nextHigherFunction = 0; + double nextHigherDerivative = 0; double Y, F, G, H; if (range.first > 0 && i == 0) diff --git a/src/gromacs/tables/quadraticsplinetable.cpp b/src/gromacs/tables/quadraticsplinetable.cpp index fe90075a99..7cfc5ec008 100644 --- a/src/gromacs/tables/quadraticsplinetable.cpp +++ b/src/gromacs/tables/quadraticsplinetable.cpp @@ -93,9 +93,9 @@ void fillSingleQuadraticSplineTableData(const std::function& fun for (int i = endIndex - 1; i >= 0; i--) { - double x = i * spacing; - double tmpFunctionValue; - double tmpDerivativeValue; + double x = i * spacing; + double tmpFunctionValue = 0; + double tmpDerivativeValue = 0; if (range.first > 0 && i == 0) { diff --git a/src/testutils/TestMacros.cmake b/src/testutils/TestMacros.cmake index bdd991af4b..c6da3bfb5f 100644 --- a/src/testutils/TestMacros.cmake +++ b/src/testutils/TestMacros.cmake @@ -48,10 +48,12 @@ function (gmx_add_unit_test_library NAME) set_target_properties(${NAME} PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_EXE};-warnings-as-errors=*;-header-filter=.*") endif() - if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "7") - target_compile_options(${NAME} PRIVATE $<$:-Weverything ${IGNORED_CLANG_ALL_WARNINGS} -Wno-gnu-zero-variadic-macro-arguments -Wno-zero-as-null-pointer-constant -Wno-missing-variable-declarations>) + gmx_warn_on_everything(${NAME}) + if (HAS_WARNING_EVERYTHING) + # Some false positives exist produced by GoogleTest implementation + gmx_target_warning_suppression(${NAME} "-Wno-zero-as-null-pointer-constant" HAS_WARNING_NO_ZERO_AS_NULL_POINTER_CONSTANT) + gmx_target_warning_suppression(${NAME} "-Wno-gnu-zero-variadic-macro-arguments" HAS_WARNING_NO_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS) endif() - endif() endfunction () @@ -176,14 +178,11 @@ function (gmx_add_gtest_executable EXENAME) set_target_properties(${EXENAME} PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_EXE};-warnings-as-errors=*;-header-filter=.*") endif() - if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "7") - target_compile_options(${EXENAME} PRIVATE $<$:-Weverything ${IGNORED_CLANG_ALL_WARNINGS} -Wno-gnu-zero-variadic-macro-arguments -Wno-zero-as-null-pointer-constant -Wno-missing-variable-declarations>) - endif() - # clang-3.6 warns about a number of issues that are not reported by more modern compilers - # and we know they are not real issues. So we only check that it can compile without error - # but ignore all warnings. - if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION MATCHES "^3\.6") - target_compile_options(${EXENAME} PRIVATE $<$:-w>) + gmx_warn_on_everything(${EXENAME}) + if (HAS_WARNING_EVERYTHING) + # Some false positives exist produced by GoogleTest implementation + gmx_target_warning_suppression(${EXENAME} "-Wno-zero-as-null-pointer-constant" HAS_WARNING_NO_ZERO_AS_NULL_POINTER_CONSTANT) + gmx_target_warning_suppression(${EXENAME} "-Wno-gnu-zero-variadic-macro-arguments" HAS_WARNING_NO_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS) endif() endif() endfunction() diff --git a/src/testutils/unittest_main.cpp b/src/testutils/unittest_main.cpp index f63b8bd589..19dd82e3e8 100644 --- a/src/testutils/unittest_main.cpp +++ b/src/testutils/unittest_main.cpp @@ -2,7 +2,7 @@ * This file is part of the GROMACS molecular simulation package. * * Copyright (c) 2010-2017, The GROMACS development team. - * Copyright (c) 2019,2020, by the GROMACS development team, led by + * Copyright (c) 2019,2020,2021, 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. @@ -48,12 +48,12 @@ #ifndef TEST_DATA_PATH //! Path to test input data directory (needs to be set by the build system). -# define TEST_DATA_PATH 0 +# define TEST_DATA_PATH nullptr #endif #ifndef TEST_TEMP_PATH //! Path to test output temporary directory (needs to be set by the build system). -# define TEST_TEMP_PATH 0 +# define TEST_TEMP_PATH nullptr #endif #ifndef TEST_USES_MPI -- 2.22.0