Remove cpluscplus ifdefs
authorRoland Schulz <roland.schulz@intel.com>
Sun, 9 Sep 2018 01:57:37 +0000 (18:57 -0700)
committerMark Abraham <mark.j.abraham@gmail.com>
Wed, 12 Sep 2018 12:25:51 +0000 (14:25 +0200)
Also remove c/c++ bool check given that it isn't needed
anymore.

Change-Id: I8b1c34a5fe3130c1a2754eed81815fa36020bd89

cmake/gmxTestCompilerProblems.cmake
src/external/fftpack/fftpack.h
src/gromacs/gmxlib/nonbonded/nb_kernel.h
src/gromacs/math/vec.h
src/gromacs/math/vectypes.h
src/gromacs/mdtypes/forcerec.h
src/gromacs/topology/block.h
src/gromacs/utility/basedefinitions.h
src/gromacs/utility/real.h

index 5bfbd82ddde124df12d2cbe7a5ba44d5378580f4..8fa5836ae74669e0d4ebe43ab49e1281af6e407d 100644 (file)
@@ -53,13 +53,4 @@ macro(gmx_test_compiler_problems)
         message(WARNING "Currently tested PGI compiler versions (up to 15.7) generate binaries that do not pass all regression test, and the generated binaries are significantly slower than with GCC, ICC or Clang. For now we do not recommend PGI beyond development testing - make sure to run the regressiontests.")
     endif()
 
-    # Test that C bool and C++ bool size is the same
-    include(CheckTypeSize)
-    set(CMAKE_EXTRA_INCLUDE_FILES "stdbool.h")
-    CHECK_TYPE_SIZE("bool" C_BOOL_SIZE LANGUAGE "C")
-    set(CMAKE_EXTRA_INCLUDE_FILES "")
-    CHECK_TYPE_SIZE("bool" CXX_BOOL_SIZE LANGUAGE "CXX")
-    if(NOT C_BOOL_SIZE EQUAL CXX_BOOL_SIZE)
-       message(FATAL_ERROR "Size of bool of C and C++ compiler don't match. Make sure you use compatible C and C++ compilers. If both compilers are from the same vendor, please report the issue to redmine.gromacs.org.")
-    endif()
 endmacro(gmx_test_compiler_problems)
index 3df5b7a3f8e2df0fbdb3b0c380a23faf59e83754..7a5b10d926bc79cf5ea6fef61a1a284473fa0707 100644 (file)
 #ifndef _fftpack_h
 #define _fftpack_h
 
-#include "gromacs/utility/real.h"
+
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-#define Treal real
+#if GMX_DOUBLE
+#define Treal double
+#else
+#define Treal float
+#endif
 
     void fftpack_cffti1(int n, Treal wa[], int ifac[]);
     void fftpack_cfftf1(int n, Treal c[], Treal ch[], const Treal wa[], const int ifac[], int isign);
index d14b4da894ecb0fe95e7b5b3695b8e0ad76c8663..92a8a61f00c1f37a686402d2c6d4e87983815cd3 100644 (file)
 #include "gromacs/mdtypes/nblist.h"
 #include "gromacs/utility/real.h"
 
-#if 0
-} /* fixes auto-indentation problems */
-#endif
-
 /*! \def gmx_inline
  * \brief
  * Keyword to use in C code instead of C99 `inline`.
  * to indicate a function is inlined.
  * C++ code should use plain `inline`, as that is already in C++98.
  */
-#if !defined __cplusplus && defined _MSC_VER
-#define gmx_inline __inline
-#else
-/* C++ or C99 */
 #define gmx_inline inline
-#endif
 
 struct t_blocka;
 
index cddd401cbcf8bf5077137410c4833f537e915f0e..19d8142c6f3a7b92cb6db0fe2c7657525c47bb02 100644 (file)
@@ -634,7 +634,6 @@ static inline real trace(const matrix m)
     return (m[XX][XX]+m[YY][YY]+m[ZZ][ZZ]);
 }
 
-#ifdef __cplusplus
 namespace gmx
 {
 /*!
@@ -653,6 +652,5 @@ template<typename T> T norm(T* v) {return ::norm(v); }
 template <typename T> T norm2(T* v) { return ::norm2(v); }
 }      // namespace gmx
 /*! \} */
-#endif // __cplusplus
 
 #endif
index edb27df4ac04c3ae2d300f5559cb382d2e031946..dc596e1d462be605a9d8054225ca8a38d82023b9 100644 (file)
 #ifndef GMX_MATH_VECTYPES_H
 #define GMX_MATH_VECTYPES_H
 
-#ifdef __cplusplus
-
 #include <cmath>
 
 #include <type_traits>
 
-#else
-
-#include <math.h> // since this file used from C source files
-
-#endif
-
 #include "gromacs/utility/real.h"
 
 #define XX      0 /* Defines for indexing in */
@@ -66,8 +58,6 @@ typedef real    tensor[DIM][DIM];
 
 typedef int     ivec[DIM];
 
-#ifdef __cplusplus
-
 namespace gmx
 {
 
@@ -332,6 +322,4 @@ typedef BasicVector<int> IVec;
 
 }      // namespace gmx
 
-#endif // ifdef __cplusplus
-
 #endif // include guard
index 8b2659a895af43c1582a50d60885016bdbfe9265..fc525b9296e7bf4d6bf43f62001cf8dab846810e 100644 (file)
 #ifndef GMX_MDTYPES_TYPES_FORCEREC_H
 #define GMX_MDTYPES_TYPES_FORCEREC_H
 
-#include "gromacs/math/vectypes.h"
-#ifdef __cplusplus
 #include "gromacs/math/paddedvector.h"
-#endif
+#include "gromacs/math/vectypes.h"
 #include "gromacs/mdtypes/interaction_const.h"
 #include "gromacs/mdtypes/md_enums.h"
 #include "gromacs/utility/basedefinitions.h"
@@ -246,13 +244,9 @@ struct t_forcerec { // NOLINT (clang-analyzer-optin.performance.Padding)
      * PPPM/PME/Ewald/posres/ForceProviders
      */
     /* True when we have contributions that are directly added to the virial */
-    gmx_bool          haveDirectVirialContributions;
-#ifdef __cplusplus
+    gmx_bool                 haveDirectVirialContributions;
     /* TODO: Replace the pointer by an object once we got rid of C */
     std::vector<gmx::RVec>  *forceBufferForDirectVirialContributions;
-#else
-    void                    *forceBufferForDirectVirialContributions_dummy;
-#endif
 
     /* Data for PPPM/PME/Ewald */
     struct gmx_pme_t *pmedata;
index 4b910f637820105b721341ae4a3f1810f13d6cf3..3eb9d520f6514022d3d4d87ada330c1343f90aa9 100644 (file)
@@ -189,13 +189,11 @@ class RangePartitioning
 /* Deprecated, C-style version of RangePartitioning */
 typedef struct t_block
 {
-#ifdef __cplusplus
     int blockSize(int blockIndex) const
     {
         GMX_ASSERT(blockIndex < nr, "blockIndex should be in range");
         return index[blockIndex + 1] - index[blockIndex];
     }
-#endif                     // __cplusplus
 
     int      nr;           /* The number of blocks          */
     int     *index;        /* Array of indices (dim: nr+1)  */
index 51faac8e9fa3fffd5d820c2b51bf1448b85c31d5..3da407f059242992bcef20aaaa8eaf67f056d96e 100644 (file)
 
 #include <stdint.h>
 
-#if defined __cplusplus
 #include <cinttypes>
 #include <cstddef>
-#else
-#include <stdbool.h>
-#endif
 
 //! Identical to bool
 typedef bool gmx_bool;
@@ -67,7 +63,6 @@ typedef bool gmx_bool;
 /** Number of gmx_bool values. */
 #define BOOL_NR 2
 
-#if defined __cplusplus
 namespace gmx
 {
 /*! \brief Integer type for indexing into arrays or vectors
@@ -76,7 +71,6 @@ namespace gmx
  */
 using index = std::ptrdiff_t;
 }
-#endif
 
 /* ICC, GCC, MSVC, Pathscale, PGI, XLC support __restrict.
  * Any other compiler can be added here. */
@@ -158,7 +152,6 @@ using index = std::ptrdiff_t;
 #define DIAGNOSTIC_RESET
 #endif
 
-#ifdef __cplusplus
 namespace gmx
 {
 namespace internal
@@ -192,6 +185,5 @@ static inline void ignoreValueHelper(const T & /*unused*/)
  */
 #define GMX_IGNORE_RETURN_VALUE(call) \
         ::gmx::internal::ignoreValueHelper(call)
-#endif
 
 #endif
index 34ba0b070505a8e68dbb7aba15204a39db05e719..1f4b1d93fffd63f097b077061263cdf17a94d4e3 100644 (file)
@@ -140,7 +140,6 @@ typedef float           real;
 
 #endif /* GMX_DOUBLE */
 
-#ifdef __cplusplus
 /*! \brief User defined literal for real numbers.
  *
  * Examples: 2._real, 2.5_real, .5_real. The number is always of type real.
@@ -153,6 +152,5 @@ typedef float           real;
  * See https://en.cppreference.com/w/cpp/language/user_literal for details on this lanuage feature.
  */
 constexpr real operator"" _real(long double x) { return real(x); }
-#endif
 
 #endif