Rework -Weverything
authorMark Abraham <mark.j.abraham@gmail.com>
Thu, 17 Jun 2021 07:34:08 +0000 (07:34 +0000)
committerPaul Bauer <paul.bauer.q@gmail.com>
Thu, 17 Jun 2021 07:34:08 +0000 (07:34 +0000)
43 files changed:
api/nblib/CMakeLists.txt
api/nblib/listed_forces/tests/typetests.cpp
api/nblib/tests/nbkernelsystem.cpp
api/nblib/tests/topology.cpp
cmake/gmxCFlags.cmake
src/CMakeLists.txt
src/gromacs/CMakeLists.txt
src/gromacs/domdec/domdec.cpp
src/gromacs/domdec/dump.cpp
src/gromacs/fft/fft_mkl.cpp
src/gromacs/fileio/matio.cpp
src/gromacs/fileio/pdbio.cpp
src/gromacs/fileio/tpxio.cpp
src/gromacs/fileio/trrio.cpp
src/gromacs/gmxana/gmx_analyze.cpp
src/gromacs/gmxana/gmx_bundle.cpp
src/gromacs/gmxana/gmx_chi.cpp
src/gromacs/gmxana/gmx_enemat.cpp
src/gromacs/gmxana/gmx_filter.cpp
src/gromacs/gmxana/gmx_hbond.cpp
src/gromacs/gmxana/gmx_make_edi.cpp
src/gromacs/gmxana/gmx_sans.cpp
src/gromacs/gmxana/gmx_tcaf.cpp
src/gromacs/gmxana/gmx_velacc.cpp
src/gromacs/gmxlib/network.cpp
src/gromacs/gmxpreprocess/gen_maxwell_velocities.cpp
src/gromacs/gmxpreprocess/hackblock.cpp
src/gromacs/gmxpreprocess/readir.cpp
src/gromacs/gmxpreprocess/ter_db.cpp
src/gromacs/gmxpreprocess/x2top.cpp
src/gromacs/gpu_utils/device_context_ocl.cpp
src/gromacs/mdlib/calcvir.cpp
src/gromacs/mdlib/coupling.cpp
src/gromacs/mdlib/sim_util.cpp
src/gromacs/mdrun/runner.cpp
src/gromacs/nbnxm/nbnxm_gpu_buffer_ops.cpp
src/gromacs/nbnxm/opencl/nbnxm_ocl_data_mgmt.cpp
src/gromacs/nbnxm/opencl/nbnxm_ocl_jit_support.cpp
src/gromacs/simd/tests/bootstrap_loadstore.cpp
src/gromacs/tables/cubicsplinetable.cpp
src/gromacs/tables/quadraticsplinetable.cpp
src/testutils/TestMacros.cmake
src/testutils/unittest_main.cpp

index 5a7d5f3898bd0ca3a8ccb6c84ae1a8a5a87705c4..1f4c5c28bc489e458540eab636883fe442b9e9ac 100644 (file)
 # \author Sebastian Keller <keller@cscs.ch>
 #
 
-# 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)
index 15d7e35fdbe5386e55cdfcbb1f37806fb9917117..b67f3b6f540f92ec324be68d0d26b76e2ec92b82 100644 (file)
@@ -52,6 +52,9 @@ namespace nblib
 //! Number of atoms used in these tests.
 constexpr int c_numAtoms = 4;
 
+namespace
+{
+
 //! Coordinates for testing
 std::vector<std::vector<gmx::RVec>> 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<std::vector<ProperDihedral>> c_InputDihs = { { { ProperDihedral(Degr
 // Todo: update test setup to allow more than one interaction type and add the following to the inputs
 // std::vector<std::vector<RyckaertBellemanDihedral>> c_InputDihs = { { RyckaertBellemanDihedral({ -7.35, 13.6, 8.4, -16.7, 1.3, 12.4 }) } };
 
+} // namespace
+
 template<class Interaction>
 class ListedForcesBase
 {
index cedaf185b9ca582f2923603f79d8aa66198cafd5..022317375df13ea0027661d0987332eb1e1515d4 100644 (file)
@@ -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();
index b29a33da68558d8aa6c12d0429ee0e01c4d1c5b3..84622a4bfb234bb8a71927a4d0960177696694a0 100644 (file)
@@ -78,13 +78,6 @@ void compareLists(const gmx::ListOfLists<T>& list, const std::vector<std::vector
     }
 }
 
-// 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 marks particles to have Van der Waals interactions
-#define SET_CGINFO_HAS_VDW(cgi) (cgi) = ((cgi) | (1 << 23))
-
 TEST(NBlibTest, TopologyHasNumParticles)
 {
     WaterTopologyBuilder waters;
index 64e963d85b173af9bb9b67611958adc3ca4c4584..c4e3fd0b913611c84da51df92423868bb376f19b 100644 (file)
@@ -34,6 +34,9 @@
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
+include(CheckCCompilerFlag)
+include(CheckCXXCompilerFlag)
+
 # Test C flags FLAGS, and set VARIABLE to true if the work. Also add the
 # flags to CFLAGSVAR.
 MACRO(GMX_TEST_CFLAG VARIABLE FLAGS CFLAGSVAR)
@@ -414,3 +417,114 @@ macro (gmx_c_flags)
     endif()
 
 endmacro()
+
+# Make sure we generate warnings (and hopefully fix) "everything"
+# reported by compilers that support that (ie recent clang and its
+# derivatives).
+function(gmx_warn_on_everything target)
+
+    # If the compiler suports warning on "everything" then we'll turn
+    # it on. Note that all warnings become errors for developer
+    # builds, but not for user builds.
+    gmx_target_warning_suppression(${target} "-Weverything" HAS_WARNING_EVERYTHING)
+
+    if (NOT HAS_WARNING_EVERYTHING)
+        # There's no need to suppress aspects of "-Weverything" if
+        # that warning is not supported.
+        return()
+    endif()
+
+    # We don't actually fix everything, so list the exceptions that we
+    # choose to make. We may be able to eliminate some of these over
+    # time.
+    #
+    # We check whether the flag is accepted first, so that we suppress
+    # such warnings also with compilers that don't directly identify
+    # as e.g. clang despite being based on it (e.g. most vendor
+    # compilers), and also don't fail to compile GROMACS when future
+    # versions of any such compiler changes how the warnings
+    # look/work.
+
+    # We have no intention of C++98 compability
+    gmx_target_warning_suppression(${target} "-Wno-c++98-compat" HAS_WARNING_NO_CPLUSPLUS98_COMPAT)
+    gmx_target_warning_suppression(${target} "-Wno-c++98-compat-pedantic" HAS_WARNING_NO_CPLUSPLUS98_COMPAT_PEDANTIC)
+
+    # Don't warn for use of OpenMP pragmas in no-omp build
+    gmx_target_warning_suppression(${target} "-Wno-source-uses-openmp" HAS_WARNING_NO_SOURCE_USED_OPENMP)
+
+    # Allowed in attributes (compilers are required to ignore unknown attributes)
+    gmx_target_warning_suppression(${target} "-Wno-c++17-extensions" HAS_WARNING_NO_CPLUSPLUS17_EXTENSIONS)
+
+    # Custom Doxygen commands are used
+    gmx_target_warning_suppression(${target} "-Wno-documentation-unknown-command" HAS_WARNING_NO_DOCUMENTATION_UNKNOWN_COMMAND)
+
+    # We need to use default labels in switch statements, because GCC gives
+    # maybe-uninitialized without default label and checks for illegal enum values.
+    gmx_target_warning_suppression(${target} "-Wno-covered-switch-default" HAS_WARNING_NO_COVERED_SWITCH_DEFAULT)
+
+    # Default statement for enum is OK.
+    # It's OK to not have branches for Count members of enum classes
+    gmx_target_warning_suppression(${target} "-Wno-switch-enum" HAS_WARNING_NO_SWITCH_ENUM)
+
+    # We need to use macros like
+    # GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR and
+    # CLANG_DIAGNOSTIC_IGNORE. Those will look strange if they don't
+    # have a semicolon after them, and might confuse tools like IDEs
+    # also.
+    gmx_target_warning_suppression(${target} "-Wno-extra-semi-stmt" HAS_WARNING_NO_EXTRA_SEMI_STMT)
+
+    # We intend to use fully inline classes with virtual methods
+    gmx_target_warning_suppression(${target} "-Wno-weak-vtables" HAS_WARNING_NO_WEAK_VTABLES)
+
+    # We intend to use constructor arguments that shadow member variables
+    gmx_target_warning_suppression(${target} "-Wno-shadow" HAS_WARNING_NO_SHADOW)
+
+    # Padding of structs is routine, we don't need to hear about it
+    gmx_target_warning_suppression(${target} "-Wno-padded" HAS_WARNING_NO_PADDED)
+
+    # Our uses of double underscores in macro names are OK
+    gmx_target_warning_suppression(${target} "-Wno-reserved-id-macro" HAS_WARNING_NO_RESERVED_ID_MACRO)
+
+    # Implicit conversion of float to double is fine
+    gmx_target_warning_suppression(${target} "-Wno-double-promotion" HAS_WARNING_NO_DOUBLE_PROMOTION)
+
+    # No resources in static variables need exit-time destructors
+    gmx_target_warning_suppression(${target} "-Wno-exit-time-destructors" HAS_WARNING_NO_EXIT_TIME_DESTRUCTORS)
+
+    # Global constructors are not needed
+    gmx_target_warning_suppression(${target} "-Wno-global-constructors" HAS_WARNING_NO_GLOBAL_CONSTRUCTORS)
+
+    # False positives are emitted
+    gmx_target_warning_suppression(${target} "-Wno-documentation" HAS_WARNING_NO_DOCUMENTATION)
+
+    # We intend to use format strings that we construct, even though that is a security risk
+    gmx_target_warning_suppression(${target} "-Wno-format-nonliteral" HAS_WARNING_NO_FORMAT_NONLITERAL)
+
+    # We do a lot of conditional compilation that sometimes uses a symbol and sometimes does not
+    gmx_target_warning_suppression(${target} "-Wno-used-but-marked-unused" HAS_WARNING_NO_USED_BUT_MARKED_UNUSED)
+
+    # It's only risky to compare floats for equality when they are the
+    # result of computation.  Unfortunately it's hard to tell the
+    # difference and there's no good way to suppress this on a
+    # case-by-base basis.
+    gmx_target_warning_suppression(${target} "-Wno-float-equal" HAS_WARNING_NO_FLOAT_EQUAL)
+
+    #
+    # Exceptions we should consider fixing
+    #
+
+    # Much code in gmxana uses complex logic that may or may not be valid
+    gmx_target_warning_suppression(${target} "-Wno-conditional-uninitialized" HAS_WARNING_CONDITIONAL_UNINITIALIZED)
+
+    # We have many places implicit conversions still occur, most of which need fixing
+    gmx_target_warning_suppression(${target} "-Wno-conversion" HAS_WARNING_NO_CONVERSION)
+
+    # We use the Linux signal handlers in the intended way, but it triggers this warning.
+    # It would be better to localize this exception.
+    gmx_target_warning_suppression(${target} "-Wno-disabled-macro-expansion" HAS_WARNING_NO_DISABLED_MACRO_EXPANSION)
+
+    # The NBNXM simd kernels define lots of macros that are not used
+    # It would be better to localize this exception.
+    gmx_target_warning_suppression(${target} "-Wno-unused-macros" HAS_WARNING_NO_UNUSED_MACROS)
+
+endfunction()
index aac191361c61439090c18ebf3fea22b638972b5b..5d6184dfd14aed9bdf2bdf34562fb0738e60e1e6 100644 (file)
@@ -3,7 +3,7 @@
 #
 # Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team.
 # Copyright (c) 2014,2015,2016,2017,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.
@@ -59,39 +59,6 @@ file(GENERATE
     )
 
 ####
-list(APPEND 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
-
-    # We need to use macros like
-    # GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR. Those will look strange
-    # if they don't have a semicolon after them, and might confuse
-    # tools like IDEs also.
-    "-Wno-extra-semi-stmt"
-
-    #Following ones are undecided/TODO
-    "-Wno-disabled-macro-expansion"
-    "-Wno-cast-align"
-    "-Wno-reserved-id-macro"
-    "-Wno-global-constructors"
-    "-Wno-exit-time-destructors"
-    "-Wno-unused-macros"
-    "-Wno-weak-vtables"
-    "-Wno-conditional-uninitialized"
-    "-Wno-format-nonliteral"
-    "-Wno-shadow"
-    "-Wno-cast-qual"
-    "-Wno-documentation"
-    "-Wno-used-but-marked-unused"
-    "-Wno-padded"
-    "-Wno-float-equal"
-    "-Wno-old-style-cast"
-    "-Wno-conversion"
-    "-Wno-double-promotion")
 
 option(GMX_CLANG_TIDY "Use clang-tidy" OFF)
 if (GMX_CLANG_TIDY)
index 889289d019a6e6ebfe186a069ed6dcf204cc05dd..ada2664563925d077b0dd42444aa5e67cffd2a29 100644 (file)
@@ -392,10 +392,8 @@ set_target_properties(libgromacs PROPERTIES
 gmx_manage_lmfit()
 target_link_libraries(libgromacs PRIVATE lmfit)
 
-# Make sure we fix "everything" found by more recent versions of clang.
-if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "7")
-   target_compile_options(libgromacs PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-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 $<$<COMPILE_LANGUAGE:CXX>:/analyze /analyze:stacksize 70000
      #Control flow warnings are disabled because the commond line output is insufficient. There is no tool
index 4aa94fa887de4697271403f7dfda19cb87e260ae..3324ca2feae691fa90c8fd2a96446acf9645ea3a 100644 (file)
@@ -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 } };
index 7a7324cd4ab68f4ea86d63f4cbae00c24a7b0475..d7f815b7a995f5c522a636309cdcfd4918a983ab 100644 (file)
@@ -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;
index a64a7574c563af359288cabea32cf1276de8bbd2..a8f4d367a57eb6230ccb25f679426a861438f8b4 100644 (file)
@@ -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<gmx_fft_t>(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<gmx_fft_t>(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<gmx_fft_t>(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]));
     }
index a75a63ad48348cf7dfa6334aafaf06c890b21d5f..b509b551f588b2f73fa0f575ca5568383211d340 100644 (file)
@@ -67,8 +67,6 @@ static const char mapper[] =
         "?";
 #define NMAP static_cast<long int>(sizeof(mapper) / sizeof(mapper[0]))
 
-#define MAX_XPM_LINELENGTH 4096
-
 real** mk_matrix(int nx, int ny, gmx_bool b1D)
 {
     int    i;
index 1b3c4ec0ca9caca148c44e34fc0cd1d3425d54ea..380e84dd353ee288ef26248ad73f7312f2301729 100644 (file)
@@ -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;
index 6109039cd599fde116a70ec26723b7b2858be90f..d70585a9e4124fb413a471efefa004384ccc7ed2 100644 (file)
@@ -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
index e1cdadd30bea253ac559a083fc936cb716bc7a98..8992c5244394219bc0f9ae9f4cde48a50b948d1c 100644 (file)
@@ -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;
index f3514649c05859e222725e716f632e340e397a3c..f87b84637f5740c0c656535a951911518fed5214 100644 (file)
@@ -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;
index c3daa88a03647dc1dc0ccc66f83a1bfc192fe1bb..ecf8df80fc12530bc906656b3baae5879511457f 100644 (file)
@@ -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 },
index a23ff444a65202e395f23b1d633326d0ef8b72c6..0abd978d194e4b0f3c4d20f97105441204848110 100644 (file)
@@ -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<int>(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");
index ae4341958dd14fe4a33ca86067884734faa0aa98..ff7893d4103e93eac21afa9e812526d704975d7b 100644 (file)
@@ -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);
index e8b95b1a3b53ee92121cd43d6eabe2bd3e9cd9e1..a294a4c05321c6c62057d86a93f2eef7030c2eb0 100644 (file)
@@ -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 },
index 7cb4a978d7d13c7928c38021dad3dd7c0ec8310c..1c69af1af7380efb0a094807e2dc07b019a155a0 100644 (file)
@@ -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)
 
index 7f154cd85e60783189f1cf9f121fb5088113bc47..f4f15ae578a67486dbc466f5e952257e2904e5ba 100644 (file)
@@ -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
 
 
index b6ac442c472fd6ff8e1f5368f7c7c0b0824815a8..1d90030821f7fb2ad69279c9ab92fe663c2825ce 100644 (file)
@@ -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" },
index 95b0cc1c0003c40e60d2972936729d5c467ece7c..4c8f215f91125d74e74c7c452249f5e806b4fbcc 100644 (file)
@@ -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 },
index b12cfbb021ac3ebf10244cb7682bd85fddb8de6d..d6da3b0d3dc51423ba9273250d84620e379b5276 100644 (file)
@@ -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 },
index f4adc6931cee105fa6bbe691e144f22acf94214d..eec49f099aa39b63045483c94dbd0e615bb7988c 100644 (file)
@@ -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)
         {
index b02735d60d481d607113e4516baff37f1755db72..6272fb79fe46034490dc666ddb1c153376758122 100644 (file)
@@ -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;
 }
index 956e0d72e13d43cf370dacc68164c74296c43da5..002854663cb9625f9d23a91d72a802592d34d066 100644 (file)
@@ -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
index 50e7dd9f6993b4a95c6f7e05d3daec58564a336f..4ca4390d1484e9e065dda659a7d7d510c094bc13 100644 (file)
@@ -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;
 
index 2329cd324a20e59d1c388233071d0408add156ef..6301e82fd641ac5194fc9c2cdda784fdaad72059 100644 (file)
@@ -90,8 +90,6 @@ static std::optional<EnumType> 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;
index de2544bd6a6d40aa540b14554ffe25a3a67f8acc..70932326b033939bcc74353b90595d6770031e59 100644 (file)
@@ -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;
index 0ecf83daf5e53671d4076e7003368cbcb33cc470..b342d249911e71225c8fbd8bfe4fcb73f11fd92a 100644 (file)
@@ -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.
 #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;
index 6a9f1903fbad3215524837144d82752f60b1f547..ac8bd58dd11cc6836c29e277f8571250a8c0c6d5 100644 (file)
 #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;
index 4c24f6350cc8ce0428ac4fc7139fa0f8c5d4ca50..f280129898c0f783df8954a9201a58fb7cb55c63 100644 (file)
@@ -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. };
index 5b3f72dd871f7a64a4efb47cf984141695ce9544..45026b2ad599999c94f22b2540c4071d97e49d57 100644 (file)
@@ -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)
index 45c569630c2b778683cfc54e3808fbd41f8bd8a0..9da08860294abbb1d4fe29cc79d980fd9c877a48 100644 (file)
@@ -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
index c317b32d845b6061604c13f054a4ace783826a27..f2ea0f2a7c80cf72111da62f9a4961435ff46267 100644 (file)
@@ -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);
index ea901eb7157196c521144bbf3179a0a7bd7ef0b7..f7603fd54ffab4444a5a506fcd9452e04efb446a 100644 (file)
 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
  *
index dfc2c5a6e2401838b1cfeeb80c33aa2a3f2b6985..2526b0054bf977a98327234101282a3ce575690e 100644 (file)
 
 #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
index 8d64617b45fc6a9a9d0220308e4fa351cf699cc9..5239076a779e425bfba1ca1e48c193a774790865 100644 (file)
@@ -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;
         }
     }
 }
index 740296624ba825ec394e2aa5f91bf2de64ad9491..2f9fd05030fa183f9aa482f8eb8d8b739744dac6 100644 (file)
@@ -150,11 +150,11 @@ void fillSingleCubicSplineTableData(const std::function<double(double)>& 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)
index fe90075a99bb738151c3cc5c98ff1327ba0c5c70..7cfc5ec008a94bf7dde48db53c14daa1357571ea 100644 (file)
@@ -93,9 +93,9 @@ void fillSingleQuadraticSplineTableData(const std::function<double(double)>& 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)
         {
index bdd991af4b30e18e5b889000ac093cab689df3ce..c6da3bfb5f799c2d017739e22b31a3abff7bcb3f 100644 (file)
@@ -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 $<$<COMPILE_LANGUAGE:CXX>:-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 $<$<COMPILE_LANGUAGE:CXX>:-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 $<$<COMPILE_LANGUAGE:CXX>:-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()
index f63b8bd58914c734fe2db4d5c2923429be8cdb30..19dd82e3e8a2a94d8414f578e15e038bfcd36a1b 100644 (file)
@@ -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.
 
 #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