Remove remaining usage of SIZEOF*
authorRoland Schulz <roland@utk.edu>
Mon, 9 Dec 2013 18:49:36 +0000 (13:49 -0500)
committerMark Abraham <mark.j.abraham@gmail.com>
Thu, 9 Jan 2014 06:30:45 +0000 (07:30 +0100)
tmpi still uses SIZEOF_LONG_LONG_INT. It is OK that it is
undefined because this simply causes MPI_LONG_LONG_INT not to
be defined, and it isn't used.

Change-Id: Ifc2cb6267064f05d1573c4a7e23cdc77c003f737

CMakeLists.txt
cmake/FindBLAS.cmake
cmake/gmxTestLargeFiles.cmake
src/config.h.cmakein
src/gromacs/gmxana/gmx_analyze.c
src/gromacs/gmxana/gmx_rdf.c
src/gromacs/gmxlib/checkpoint.c
src/gromacs/gmxpreprocess/readir.c
src/gromacs/math/utilities.c
src/gromacs/mdlib/forcerec.c
tests/CppCheck.cmake

index 35ead9fd7bd301340713103f8de18d19c0b54b74..f70661b19e96d126966b94181a38ad0096f94572 100644 (file)
@@ -336,15 +336,6 @@ include(CheckLibraryExists)
 check_library_exists(m sqrt "" HAVE_LIBM)
 check_library_exists(rt clock_gettime "" HAVE_CLOCK_GETTIME)
 
-
-include(CheckTypeSize)
-
-check_type_size("int"           SIZEOF_INT)
-check_type_size("long int"      SIZEOF_LONG_INT)
-check_type_size("long long int" SIZEOF_LONG_LONG_INT)
-check_type_size("off_t"         SIZEOF_OFF_T)
-check_type_size("void *"        SIZEOF_VOIDP)
-
 include(TestBigEndian)
 test_big_endian(GMX_INTEGER_BIG_ENDIAN)
 
index 9eadfd125de9a6135bcad1cff103f15ae5415723..bb79ca28919a8841172ef75381dcc8b4044e0bd6 100644 (file)
@@ -42,6 +42,7 @@
 
 include(CheckFunctionExists)
 include(CheckFortranFunctionExists)
+include(CheckTypeSize)
 
 set(_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
 
@@ -295,6 +296,7 @@ if (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All")
    list(GET _ACML_GPU_ROOT 0 _ACML_GPU_ROOT)
    if( _ACML_ROOT )
     get_filename_component( _ACML_ROOT ${_ACML_ROOT} PATH )
+    check_type_size("int" SIZEOF_INTEGER)
     if( SIZEOF_INTEGER EQUAL 8 )
      set( _ACML_PATH_SUFFIX "_int64" )
     else()
index e6cc07132ca4a47b2c84c4506af5cf2746d5b3ef..4570b4297e8de85e217e5cf229979eea31d8fa1b 100644 (file)
@@ -45,6 +45,8 @@
 #  However, it is YOUR job to make sure these defines are set in a cmakedefine so they
 #  end up in a config.h file that is included in your source if necessary!
 
+include(CheckTypeSize)
+
 MACRO(GMX_TEST_LARGE_FILES VARIABLE)
     IF(NOT DEFINED ${VARIABLE})
 
@@ -142,11 +144,14 @@ MACRO(GMX_TEST_LARGE_FILES VARIABLE)
         elseif(HAVE__FSEEKI64)
             SET(${VARIABLE} 1 CACHE INTERNAL "Result of test for large file support" FORCE)
             SET(HAVE__FSEEKI64 1 CACHE INTERNAL "Windows 64-bit fseek" FORCE)
-        elseif(SIZEOF_LONG_INT EQUAL 8) #standard fseek is OK for 64bit
-            SET(${VARIABLE} 1 CACHE INTERNAL "Result of test for large file support" FORCE)
         else()
-            SET(${VARIABLE} 0 CACHE INTERNAL "Result of test for large file support" FORCE)
-            MESSAGE(FATAL_ERROR "Checking for 64bit file support failed.")
+            check_type_size("long int"      SIZEOF_LONG_INT)
+            if(SIZEOF_LONG_INT EQUAL 8) #standard fseek is OK for 64bit
+                SET(${VARIABLE} 1 CACHE INTERNAL "Result of test for large file support" FORCE)
+            else()
+                SET(${VARIABLE} 0 CACHE INTERNAL "Result of test for large file support" FORCE)
+                MESSAGE(FATAL_ERROR "Checking for 64bit file support failed.")
+            endif()
         endif()
 
     ENDIF(NOT DEFINED ${VARIABLE})
index 0a79affb3ca52f4f0f713a8cc2324274f4c546c9..72b36ff903db75898e189f0f789ef95993e8e195 100644 (file)
 /* Define if SIGUSR1 is present */
 #cmakedefine HAVE_SIGUSR1
 
-/* The size of int, as computed by sizeof. */
-#cmakedefine SIZEOF_INT @SIZEOF_INT@
-
-/* The size of long int, as computed by sizeof. */
-#cmakedefine SIZEOF_LONG_INT @SIZEOF_LONG_INT@
-
-/* The size of long long int, as computed by sizeof. */
-#cmakedefine SIZEOF_LONG_LONG_INT @SIZEOF_LONG_LONG_INT@
-
-/* The size of off_t, as computed by sizeof. */
-#cmakedefine SIZEOF_OFF_T @SIZEOF_OFF_T@
-
-/* The size of void*, as computed by sizeof. */
-#cmakedefine SIZEOF_VOIDP @SIZEOF_VOIDP@
-
 /* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
 #cmakedefine _LARGEFILE_SOURCE
 
index b7f7fe3ccd4f7d14b23e077582324c6f2850151a..503a7d3baeca6a60f9028ad3e629ebb0ccb72276 100644 (file)
@@ -243,11 +243,7 @@ void histogram(const char *distfile, real binwidth, int n, int nset, real **val,
     int            i, s;
     double         min, max;
     int            nbin;
-#if (defined SIZEOF_LONG_LONG_INT) && (SIZEOF_LONG_LONG_INT >= 8)
-    long long int *histo;
-#else
-    double        *histo;
-#endif
+    gmx_int64_t   *histo;
 
     min = val[0][0];
     max = val[0][0];
index b00b69bcf9c398e01ac1750929e44474e351ef22..0d2c80fa02f38775cfdbbb56210a0aa771275f9a 100644 (file)
@@ -191,11 +191,7 @@ static void do_rdf(const char *fnNDX, const char *fnTPS, const char *fnTRX,
     char         **grpname;
     int           *isize, isize_cm = 0, nrdf = 0, max_i, isize0, isize_g;
     atom_id      **index, *index_cm = NULL;
-#if (defined SIZEOF_LONG_LONG_INT) && (SIZEOF_LONG_LONG_INT >= 8)
-    long long int *sum;
-#else
-    double        *sum;
-#endif
+    gmx_int64_t   *sum;
     real           t, rmax2, cut2, r, r2, r2ii, invhbinw, normfac;
     real           segvol, spherevol, prev_spherevol, **rdf;
     rvec          *x, dx, *x0 = NULL, *x_i1, xi;
index 03ea0995a98416a188a855bf5cba8ab23bbaa890..fe195577603cecd3cb4152ca7cfcab1f0962b7e5 100644 (file)
@@ -1342,11 +1342,7 @@ static int do_cpt_files(XDR *xd, gmx_bool bRead,
             {
                 return -1;
             }
-#if (SIZEOF_GMX_OFF_T > 4)
             outputfiles[i].offset = ( ((gmx_off_t) offset_high) << 32 ) | ( (gmx_off_t) offset_low & mask );
-#else
-            outputfiles[i].offset = offset_low;
-#endif
         }
         else
         {
@@ -1361,13 +1357,8 @@ static int do_cpt_files(XDR *xd, gmx_bool bRead,
             }
             else
             {
-#if (SIZEOF_GMX_OFF_T > 4)
                 offset_low  = (int) (offset & mask);
                 offset_high = (int) ((offset >> 32) & mask);
-#else
-                offset_low  = offset;
-                offset_high = 0;
-#endif
             }
             if (do_cpt_int(xd, "file_offset_high", &offset_high, list) != 0)
             {
index c908679bdaaeffc70b6e55700b37bf561dab6978..55f25b914053a5b28fa7d61150cfb270f3caec3b 100644 (file)
@@ -3570,11 +3570,6 @@ check_combination_rule_differences(const gmx_mtop_t *mtop, int state,
     int           ntypes, tpi, tpj, thisLBdiff, thisgeomdiff;
     int          *typecount;
     real          tol;
-#if (defined SIZEOF_LONG_LONG_INT) && (SIZEOF_LONG_LONG_INT >= 8)
-    long long int npair, npair_ij;
-#else
-    double        npair, npair_ij;
-#endif
     double        geometricdiff, LBdiff;
     double        c6i, c6j, c12i, c12j;
     double        c6, c6_geometric, c6_LB;
@@ -3599,7 +3594,6 @@ check_combination_rule_differences(const gmx_mtop_t *mtop, int state,
     *bC6ParametersWorkWithGeometricRules  = TRUE;
     bCanDoLBRules                         = TRUE;
     bCanDoGeometricRules                  = TRUE;
-    npair                                 = 0;
     ntypes                                = mtop->ffparams.atnr;
     snew(typecount, ntypes);
     gmx_mtop_count_atomtypes(mtop, state, typecount);
index e96a6de07b4a3273c688013136d00900688bbd3f..d5459ca6d4bb7bc417fae75c8ca66c90e59ebe56 100644 (file)
@@ -95,20 +95,6 @@ real sign(real x, real y)
  * ====================================================
  */
 
-#if ( (defined SIZEOF_INT && SIZEOF_INT == 4) || (SIZEOF_INT_MAX == 2147483647) )
-typedef int erf_int32_t;
-typedef unsigned int erf_u_int32_t;
-#elif (LONG_MAX == 2147483647L)
-typedef long erf_int32_t;
-typedef unsigned long erf_u_int32_t;
-#elif (SHRT_MAX == 2147483647)
-typedef short erf_int32_t;
-typedef unsigned short erf_u_int32_t;
-#else
-#  error ERROR: No 32 bit wide integer type found!
-#endif
-
-
 static const double
     tiny        = 1e-300,
     half        =  5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */
@@ -186,8 +172,7 @@ static const double
 
 double gmx_erfd(double x)
 {
-
-    erf_int32_t hx, ix, i;
+    gmx_int32_t hx, ix, i;
     double      R, S, P, Q, s, y, z, r;
 
     union
@@ -211,7 +196,7 @@ double gmx_erfd(double x)
     if (ix >= 0x7ff00000)
     {
         /* erf(nan)=nan */
-        i = ((erf_u_int32_t)hx>>31)<<1;
+        i = ((gmx_uint32_t)hx>>31)<<1;
         return (double)(1-i)+one/x; /* erf(+-inf)=+-1 */
     }
 
@@ -301,7 +286,7 @@ double gmx_erfd(double x)
 
 double gmx_erfcd(double x)
 {
-    erf_int32_t hx, ix;
+    gmx_int32_t hx, ix;
     double      R, S, P, Q, s, y, z, r;
 
     union
@@ -326,7 +311,7 @@ double gmx_erfcd(double x)
     {
         /* erfc(nan)=nan */
         /* erfc(+-inf)=0,2 */
-        return (double)(((erf_u_int32_t)hx>>31)<<1)+one/x;
+        return (double)(((gmx_uint32_t)hx>>31)<<1)+one/x;
     }
 
     if (ix < 0x3feb0000)
@@ -507,7 +492,7 @@ static const float
 typedef union
 {
     float         value;
-    erf_u_int32_t word;
+    gmx_uint32_t  word;
 } ieee_float_shape_type;
 
 #define GET_FLOAT_WORD(i, d)                 \
@@ -528,7 +513,7 @@ typedef union
 
 float gmx_erff(float x)
 {
-    erf_int32_t hx, ix, i;
+    gmx_int32_t hx, ix, i;
     float       R, S, P, Q, s, y, z, r;
 
     union
@@ -545,7 +530,7 @@ float gmx_erff(float x)
     if (ix >= 0x7f800000)
     {
         /* erf(nan)=nan */
-        i = ((erf_u_int32_t)hx>>31)<<1;
+        i = ((gmx_uint32_t)hx>>31)<<1;
         return (float)(1-i)+onef/x; /* erf(+-inf)=+-1 */
     }
 
@@ -626,7 +611,7 @@ float gmx_erff(float x)
 
 float gmx_erfcf(float x)
 {
-    erf_int32_t hx, ix;
+    gmx_int32_t hx, ix;
     float       R, S, P, Q, s, y, z, r;
 
     union
@@ -644,7 +629,7 @@ float gmx_erfcf(float x)
     {
         /* erfc(nan)=nan */
         /* erfc(+-inf)=0,2 */
-        return (float)(((erf_u_int32_t)hx>>31)<<1)+onef/x;
+        return (float)(((gmx_uint32_t)hx>>31)<<1)+onef/x;
     }
 
     if (ix < 0x3f580000)
index 3881eddd44263cbbe7ddbe718bdcb9bcf64ea445..9da8ae5632e88798105378a7a1ad35e039a72c40 100644 (file)
@@ -947,11 +947,7 @@ void set_avcsixtwelve(FILE *fplog, t_forcerec *fr, const gmx_mtop_t *mtop)
     const t_atoms  *atoms, *atoms_tpi;
     const t_blocka *excl;
     int             mb, nmol, nmolc, i, j, tpi, tpj, j1, j2, k, n, nexcl, q;
-#if (defined SIZEOF_LONG_LONG_INT) && (SIZEOF_LONG_LONG_INT >= 8)
-    long long int   npair, npair_ij, tmpi, tmpj;
-#else
-    double          npair, npair_ij, tmpi, tmpj;
-#endif
+    gmx_int64_t     npair, npair_ij, tmpi, tmpj;
     double          csix, ctwelve;
     int             ntp, *typecount;
     gmx_bool        bBHAM;
index 16eb8218b8df0ea661ed83119286a06ebf3c8c4e..1f964d035c351c9157043620e92e3e2ac5dd57a0 100644 (file)
@@ -64,8 +64,7 @@ if (CPPCHECK_EXECUTABLE AND UNIX)
         set(_outputopt --xml)
     endif()
     set(_common_flags
-        --enable=style
-        -DSIZEOF_LONG_LONG_INT=8 -DSIZEOF_INT=4 -DLINUX
+        --enable=style -DLINUX
         -I src/gromacs/legacyheaders -I src
         -I ${CMAKE_BINARY_DIR}/src -I ${CMAKE_BINARY_DIR}/src/gromacs/utility
         --quiet