Replace math.h by cmath includes in cpp files
authorAleksei Iupinov <a.yupinov@gmail.com>
Tue, 31 Oct 2017 22:51:19 +0000 (23:51 +0100)
committerMark Abraham <mark.j.abraham@gmail.com>
Thu, 2 Nov 2017 10:55:26 +0000 (11:55 +0100)
Partially fixes #2285 (for non-GPU build)

Change-Id: I638a0b8ba5e4e04e00730b01640ac7c6a41834ed

39 files changed:
src/external/gmock-1.7.0/README.Gromacs
src/external/gmock-1.7.0/gtest/src/gtest.cc
src/external/gmock-1.7.0/include/gmock/gmock-matchers.h
src/external/lmfit/lmmin.cpp
src/gromacs/correlationfunctions/integrate.cpp
src/gromacs/domdec/domdec.cpp
src/gromacs/ewald/calculate-spline-moduli.cpp
src/gromacs/ewald/ewald.cpp
src/gromacs/ewald/pme-only.cpp
src/gromacs/ewald/pme.cpp
src/gromacs/fft/fft5d.cpp
src/gromacs/fft/fft_fftpack.cpp
src/gromacs/listed-forces/restcbt.cpp
src/gromacs/math/3dtransforms.cpp
src/gromacs/math/do_fit.cpp
src/gromacs/math/gmxcomplex.h
src/gromacs/math/utilities.h
src/gromacs/mdlib/csettle.cpp
src/gromacs/mdlib/ebin.cpp
src/gromacs/mdlib/force.cpp
src/gromacs/mdlib/mdatoms.cpp
src/gromacs/mdlib/mdebin_bar.cpp
src/gromacs/mdlib/nbnxn_ocl/nbnxn_ocl_data_mgmt.cpp
src/gromacs/mdlib/nbnxn_util.h
src/gromacs/mdlib/ns.cpp
src/gromacs/mdlib/qm_gamess.cpp
src/gromacs/mdlib/qm_gaussian.cpp
src/gromacs/mdlib/qm_mopac.cpp
src/gromacs/mdlib/qm_orca.cpp
src/gromacs/mdlib/qmmm.cpp
src/gromacs/mdlib/shakef.cpp
src/gromacs/mdlib/sim_util.cpp
src/gromacs/mdlib/tgroup.cpp
src/gromacs/mdlib/update.cpp
src/gromacs/pulling/pull.cpp
src/gromacs/selection/compiler.cpp
src/gromacs/trajectoryanalysis/modules/surfacearea.cpp
src/programs/mdrun/md.cpp
src/programs/mdrun/repl_ex.cpp

index c5fb93e38eaf8ab94b6d4608a6e1660609d6ebfe..86174ffca05d63902b21959f22a9bc819e771898 100644 (file)
@@ -30,6 +30,10 @@ interface for that. So, GTEST_CAN_STREAM_RESULTS is added in
 gtest/include/gtest/internal/gtest-port.h to allow the default
 behaviour to be applied only if the user hasn't gotten involved.
 
+To side-step a potential gcc/glibc issue with conflicting isinf/isnan declarations
+(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48891), includes of <math.h> are
+replaced by <cmath> in gtest/src/gtest.cc and include/gmock/gmock-matchers.h.
+
 We also apply the patch found at
 https://github.com/google/googletest/issues/705#issuecomment-235067917
 to fix a segfault with gcc6 arising from gmock's erroneous use of
index e2b5c5b6f7a57c4138eabd2c2961a09dce0495fa..211174deb59a6a63d7a00b748d266007c7e8ca95 100644 (file)
@@ -35,7 +35,6 @@
 #include "gtest/gtest-spi.h"
 
 #include <ctype.h>
-#include <math.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -44,6 +43,7 @@
 #include <wctype.h>
 
 #include <algorithm>
+#include <cmath>
 #include <iomanip>
 #include <limits>
 #include <ostream>  // NOLINT
index 44055c93556f7de462ba98ae2456265f179f4325..f6fdbb78421c7092288bb0f78101ca2b2f8177c3 100644 (file)
@@ -38,8 +38,8 @@
 #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_
 #define GMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_
 
-#include <math.h>
 #include <algorithm>
+#include <cmath>
 #include <iterator>
 #include <limits>
 #include <ostream>  // NOLINT
index 0cb77e5545461bf7da5b613f1a30c88842f9ef18..4da012d0f389e44f93857e2e052a786e2d9c1c80 100644 (file)
 #include <assert.h>
 #include <stdlib.h>
 #include <stdio.h>
-#include <math.h>
+#include <cmath>
 #include <float.h>
 #include "lmmin.h"
 
+using namespace std;
+
 static double lm_enorm(int n, const double* x);
 
 #define MIN(a, b) (((a) <= (b)) ? (a) : (b))
index d64e74d77608fa0c9f98e27ccdc6755ec9ee8475..5bb256f6868e794d6b58dc2d19fb5406bb9e5ab5 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) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017, 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 "integrate.h"
 
-#include <math.h>
 #include <stdio.h>
 
+#include <cmath>
+
 #include "gromacs/math/functions.h"
 #include "gromacs/math/vec.h"
 #include "gromacs/utility/fatalerror.h"
index e11a82c94dc9b9e1391eb248964b0b5274603903..d3cc5f7b25fd427d4657d2a7885da73c484af755 100644 (file)
 
 #include <assert.h>
 #include <limits.h>
-#include <math.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
+#include <cmath>
+
 #include <algorithm>
 
 #include "gromacs/domdec/domdec_network.h"
index 7ac0997af58122d8621115d14a0cbada6376027c..d25620e9cb8654ae4b3b74ef6dea47193c83daf2 100644 (file)
@@ -38,7 +38,7 @@
 
 #include "calculate-spline-moduli.h"
 
-#include <math.h>
+#include <cmath>
 
 #include <algorithm>
 
index 7471e5dd2524423c31d251abe8c24a9b9dca729d..cd0ca1e98512a19ad2fcfbcd77d961d715488e8d 100644 (file)
@@ -49,9 +49,9 @@
 
 #include "ewald.h"
 
-#include <math.h>
 #include <stdio.h>
 
+#include <cmath>
 #include <cstdlib>
 
 #include <algorithm>
index ffb1350aeef81fa1582f284124814cfb016f4d3b..b5436fac9c5993f6836437c7d2cfe593b4b1f70b 100644 (file)
 #include "config.h"
 
 #include <assert.h>
-#include <math.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
+#include <cmath>
+
 #include <vector>
 
 #include "gromacs/domdec/domdec.h"
index 812754f24b78ba1bbf2ba2a0bd88589a798ee8ff..f5d4762de62376aab8a4bbaaf87a9b9cd9d113c1 100644 (file)
 #include "config.h"
 
 #include <assert.h>
-#include <math.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
+#include <cmath>
+
 #include <algorithm>
 
 #include "gromacs/ewald/ewald-utils.h"
index e46667b9d074f1b260ed4688b31435dda34a8913..489552bb5140932e85f1fd19a264870ac3f0666e 100644 (file)
 
 #include <assert.h>
 #include <float.h>
-#include <math.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
+#include <cmath>
+
 #include <algorithm>
 
 #include "gromacs/utility/exceptions.h"
index 9f4ab9ec53440fcc7bbf091f591b1eca4ce72b5a..33655730bd837e8dfc284669f6935cd628901caf 100644 (file)
 #include "gmxpre.h"
 
 #include <errno.h>
-#include <math.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
+#include <cmath>
+
 #include "external/fftpack/fftpack.h"
 
 #include "gromacs/fft/fft.h"
@@ -70,10 +72,6 @@ struct gmx_fft
     real  *         work;     /**< 1st 4n reserved for cfft, 1st 2n for rfft */
 };
 
-#include <math.h>
-#include <stdio.h>
-
-
 int
 gmx_fft_init_1d(gmx_fft_t *        pfft,
                 int                nx,
index 80bbce6f4af700e8cd0d8ae5a95ec85b897be412..f264029e43622540483b83781b1a89dbcc529eb2 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2017, 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.
@@ -47,7 +47,7 @@
 
 #include "restcbt.h"
 
-#include <math.h>
+#include <cmath>
 
 #include "gromacs/math/functions.h"
 #include "gromacs/math/units.h"
index be4e53b487d37680416cf64be3b8f1dfaba9ec26..8a79c79692e7c192bad01ca5cf56f2d3e4302cf2 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) 2010,2014,2016, by the GROMACS development team, led by
+ * Copyright (c) 2010,2014,2016,2017, 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 "3dtransforms.h"
 
-#include <math.h>
 #include <stdio.h>
 
+#include <cmath>
+
 #include "gromacs/math/vec.h"
 #include "gromacs/utility/fatalerror.h"
 
index 64eb87d16d775596c33db3a9b9ee000e22e10263..a846325cf53d33a7df633147e1808dcb42aa2512 100644 (file)
 
 #include "do_fit.h"
 
-#include <math.h>
 #include <stdio.h>
 
+#include <cmath>
+
 #include "gromacs/linearalgebra/nrjac.h"
 #include "gromacs/math/functions.h"
 #include "gromacs/math/utilities.h"
index a531cdf1d3f0b64d316a104b6cf4db537f2d6f60..67c798558e087808845101c88bc43e910f148879 100644 (file)
@@ -37,7 +37,7 @@
 #ifndef GMX_MATH_GMXCOMPLEX_H
 #define GMX_MATH_GMXCOMPLEX_H
 
-#include <math.h>
+#include <cmath>
 
 #include "gromacs/math/vectypes.h"
 #include "gromacs/utility/real.h"
index 91f12fdfcf3e6b8eb7988810fd5b15845e108790..de262687267b7c536083ff7bfc3a87e4ddb69482 100644 (file)
@@ -38,7 +38,8 @@
 #define GMX_MATH_UTILITIES_H
 
 #include <limits.h>
-#include <math.h>
+
+#include <cmath>
 
 #include "gromacs/utility/basedefinitions.h"
 #include "gromacs/utility/real.h"
index 354c475b95e16b9ae0731e285db15b113c672065..34a011a0e32d208fe7a384ec242e668a0840146f 100644 (file)
 #include "gmxpre.h"
 
 #include <assert.h>
-#include <math.h>
 #include <stdio.h>
 
+#include <cmath>
+
 #include <algorithm>
 
 #include "gromacs/math/functions.h"
index e882f75eb558bfe8ecfe36f77278163d4e30456a..b91ba7036b7601d6b6614d51059caf5671f7df2a 100644 (file)
 
 #include "ebin.h"
 
-#include <math.h>
 #include <string.h>
 
+#include <cmath>
+
 #include "gromacs/math/units.h"
 #include "gromacs/math/utilities.h"
 #include "gromacs/math/vec.h"
index caa4e301920069f31eccb6cbb6d246ac4f55100b..f01ea4d333a52e51e9f192758e13b44295114843 100644 (file)
 #include "config.h"
 
 #include <assert.h>
-#include <math.h>
 #include <string.h>
 
+#include <cmath>
+
 #include "gromacs/domdec/domdec.h"
 #include "gromacs/domdec/domdec_struct.h"
 #include "gromacs/ewald/ewald.h"
index f0fb09f0ce60b07e95c356b50dc6c616fef8e4e3..56d1ce798b8babe5bbca08286789e623326df70f 100644 (file)
@@ -38,7 +38,7 @@
 
 #include "mdatoms.h"
 
-#include <math.h>
+#include <cmath>
 
 #include "gromacs/math/functions.h"
 #include "gromacs/mdlib/gmx_omp_nthreads.h"
index 1b455879102ae62c29376b64e29d73266640844a..56cee8a2324be0e7fbee8595395f2efda1ad17d8 100644 (file)
 #include "mdebin_bar.h"
 
 #include <float.h>
-#include <math.h>
 #include <string.h>
 
 #include <cassert>
+#include <cmath>
 
 #include "gromacs/fileio/enxio.h"
 #include "gromacs/mdlib/mdebin.h"
index 4da890936396c536cad7ec83f1e60c89e662dcc4..b81e2965faeca1aee1a5b14e7662f72fc2120807 100644 (file)
 #include "gmxpre.h"
 
 #include <assert.h>
-#include <math.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
+#include <cmath>
+
 #include "gromacs/gpu_utils/gpu_utils.h"
 #include "gromacs/gpu_utils/oclutils.h"
 #include "gromacs/hardware/gpu_hw_info.h"
index a6e241d9e5782f5fcde94ab3c14b81da11f87999..dd4271c7b105d6317d393d71b56211ca1a24deb9 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016,2017, 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.
@@ -36,7 +36,7 @@
 #ifndef GMX_MDLIB_NBNXN_UTIL_H
 #define GMX_MDLIB_NBNXN_UTIL_H
 
-#include <math.h>
+#include <cmath>
 
 #include "gromacs/mdlib/nb_verlet.h"
 #include "gromacs/mdlib/nbnxn_consts.h"
index b2a5ac92a92b16a4bf7feeead4b787d5982c0153..acefed5c6a3ad87dcf966c62310904806e6b88a6 100644 (file)
@@ -38,7 +38,6 @@
 
 #include "ns.h"
 
-#include <math.h>
 #include <stdlib.h>
 #include <string.h>
 
index 0e86f984b8f8478b5d3a5cd505207e29f33c6e71..4ceb4646cae8d5440862c7de64345bc3215949db 100644 (file)
 
 #if GMX_QMMM_GAMESS
 
-#include <math.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
+#include <cmath>
+
 #include "gromacs/fileio/confio.h"
 #include "gromacs/gmxlib/network.h"
 #include "gromacs/gmxlib/nrnb.h"
index cd25f95102714f97e9dad41690b58153b831cda7..e09d641b4a97d24c41245d5f8aab6c392693377a 100644 (file)
 
 #if GMX_QMMM_GAUSSIAN
 
-#include <math.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
+#include <cmath>
+
 #include "gromacs/fileio/confio.h"
 #include "gromacs/gmxlib/network.h"
 #include "gromacs/gmxlib/nrnb.h"
index 525fcc02380a616ce9039d5b0594a04dd4c68800..204332af4be837cd30807e168f51fd6fb4af1f6b 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) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017, 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.
 
 #if GMX_QMMM_MOPAC
 
-#include <math.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
+#include <cmath>
+
 #include "gromacs/fileio/confio.h"
 #include "gromacs/gmxlib/network.h"
 #include "gromacs/gmxlib/nrnb.h"
index 06320bdc6e071d1395fcb1f3aa1ce1700f21414c..1f23624de85f0f481c896ff5fffd56c1101bec6f 100644 (file)
 
 #include "qm_orca.h"
 
-#include <math.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
+#include <cmath>
+
 #include "gromacs/fileio/confio.h"
 #include "gromacs/gmxlib/network.h"
 #include "gromacs/gmxlib/nrnb.h"
index ba83c299a19de0d7e27c856f7974c34d852a9271..6dfe8693ba8284df5ea0394b76b5352a1095e2eb 100644 (file)
@@ -40,7 +40,6 @@
 
 #include "config.h"
 
-#include <math.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index 31a690df4cc392537940ad9955a24484783e0e04..19e3befc7b44fbe3494e9429b5b5411e5d321639 100644 (file)
@@ -36,7 +36,7 @@
  */
 #include "gmxpre.h"
 
-#include <math.h>
+#include <cmath>
 
 #include "gromacs/gmxlib/nrnb.h"
 #include "gromacs/math/functions.h"
index f2ed723a049067003ae6bbaa9804854f29819e54..7e61d69356d65e2a43cb01910718205174c6960b 100644 (file)
 
 #include "config.h"
 
-#include <math.h>
 #include <stdio.h>
 #include <string.h>
 
+#include <cmath>
 #include <cstdint>
 
 #include <array>
index 0d7712be6dbee67f3a1eb6fcc7f201bdeb0d3b75..008a68c20abe3bbf67a88911288f90024c24a9be 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) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017, 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.
@@ -39,7 +39,7 @@
 
 #include "tgroup.h"
 
-#include <math.h>
+#include <cmath>
 
 #include "gromacs/gmxlib/network.h"
 #include "gromacs/math/vec.h"
index 0f1374b73ec07ae1e299517380eea288ea843209..1428bea312e6e35b552fbeb095897c5f0245d573 100644 (file)
 
 #include "update.h"
 
-#include <math.h>
 #include <stdio.h>
 
+#include <cmath>
+
 #include <algorithm>
 
 #include "gromacs/domdec/domdec_struct.h"
index 5910d64d819a7786ef82d13ad1ebac9e84de36c9..5469a3fe26b7391eb9a0c20b7f0715c7c812e780 100644 (file)
 #include "config.h"
 
 #include <assert.h>
-#include <math.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
+#include <cmath>
+
 #include <algorithm>
 
 #include "gromacs/commandline/filenm.h"
index 0d7833bcbbe827edd1763a11585615186e7babec..f9b8e02fd3dad3be635aa05453657f3c6c2b2327 100644 (file)
 
 #include "compiler.h"
 
-#include <math.h>
 #include <stdarg.h>
 
+#include <cmath>
+
 #include <algorithm>
 
 #include "gromacs/math/vec.h"
index f479ef3e5f0c68d4301023d41f820a9029cb3e65..d835b77a0dcd2c666a1c79d774e1bd7351edaaf3 100644 (file)
 
 #include "surfacearea.h"
 
-#include <math.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
+#include <cmath>
+
 #include <algorithm>
 #include <vector>
 
index 4aaca3e28e4dd745db9cf2b1b0ef5561a46e70f1..ed545c49acb22047a686501f9bf8d8b717a9cfc7 100644 (file)
 
 #include "config.h"
 
-#include <math.h>
 #include <stdio.h>
 #include <stdlib.h>
 
+#include <cmath>
+
 #include <algorithm>
 #include <memory>
 
index 8a47986bce41af1b012291f20c0c29d5ed17ed69..c216526229bc66d88429507cd65f439eefc39ab6 100644 (file)
@@ -41,7 +41,7 @@
 
 #include "config.h"
 
-#include <math.h>
+#include <cmath>
 
 #include <random>