Fix confusing gmx_header_config.h include
authorRoland Schulz <roland@utk.edu>
Tue, 15 Jan 2013 22:29:49 +0000 (17:29 -0500)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Thu, 17 Jan 2013 00:32:32 +0000 (01:32 +0100)
Easy to forget gmx_header_config.h because
historically only config.h is needed and
in master only config.h is needed, too.
Hid a bug in gmx_cpuid.c which didn't
do anything on Windows because the proper
define wasn't set.

Also fixes the compiler warnings in gmx_cpuid.c

Change-Id: I0ad9ca77bfe05551bdde82ab4e92b180c1e5963b

18 files changed:
src/config.h.cmakein
src/gmxlib/checkpoint.c
src/gmxlib/futil.c
src/gmxlib/gmx_cpuid.c
src/gmxlib/gmx_random.c
src/gmxlib/gmxcpp.c
src/gmxlib/main.c
src/gmxlib/rando.c
src/gmxlib/string2.c
src/gmxlib/vmdio.c
src/gmxlib/wman.c
src/kernel/fflibutil.c
src/kernel/pdb2top.c
src/tools/gmx_bar.c
src/tools/gmx_covar.c
src/tools/gmx_make_edi.c
src/tools/gmx_potential.c
src/tools/gmx_trjconv.c

index a29aff0d0b34b195c36b8526912c6492836797d0..891ca3324ea4238918c50c804bd80d256b0af39d 100644 (file)
@@ -44,6 +44,8 @@
 #pragma warning (disable : 4090)
 #endif
 
+#include "gmx_header_config.h"
+
 /* Name of package (translate from cmake to autoconf macro name) */
 #define PACKAGE  "@PROJECT_NAME@"
 
index d80c198d594c3d5d68f6f676b4b70de2363766bf..1e60e69004c66f5263a9d493c2cb18b24f5bfc0c 100644 (file)
@@ -42,7 +42,6 @@
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
-#include "gmx_header_config.h"
 
 #include <string.h>
 #include <time.h>
index 31f3c841e16488eb8d92e13084d005a597e813b9..7f2ba98101ff4ce152260eb9a995a4bd0fe15504 100644 (file)
@@ -38,7 +38,6 @@
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
-#include "gmx_header_config.h"
 
 #include <stdio.h>
 #include <stdlib.h>
index 9b1227b423664d96f9befb55213b086ef7cee101..605dc3f611972dada39132700219a8412a194af4 100644 (file)
@@ -48,6 +48,8 @@
 #ifdef _MSC_VER
 /* MSVC definition for __cpuid() */
 #include <intrin.h>
+/* sysinfo functions */
+#include <windows.h>
 #endif
 #ifdef HAVE_UNISTD_H
 /* sysconf() definition */
@@ -502,7 +504,6 @@ cpuid_check_amd_x86(gmx_cpuid_t                cpuid)
 {
     int                       max_stdfn,max_extfn;
     unsigned int              eax,ebx,ecx,edx;
-    int                       i;
     int                       hwthread_bits,core_bits;
     int *                     apic_id;
     
@@ -529,6 +530,7 @@ cpuid_check_amd_x86(gmx_cpuid_t                cpuid)
     {
 #if (defined HAVE_SCHED_H && defined HAVE_SCHED_SETAFFINITY && defined HAVE_SYSCONF && defined __linux__)
         /* Linux */
+        unsigned int   i;
         cpu_set_t      cpuset,save_cpuset;
         cpuid->nproc = sysconf(_SC_NPROCESSORS_ONLN);
         apic_id      = malloc(sizeof(int)*cpuid->nproc);
@@ -548,6 +550,7 @@ cpuid_check_amd_x86(gmx_cpuid_t                cpuid)
 #define CPUID_HAVE_APIC
 #elif defined GMX_NATIVE_WINDOWS
         /* Windows */
+        DWORD_PTR     i;
         SYSTEM_INFO   sysinfo;
         unsigned int  save_affinity,affinity;
         GetSystemInfo( &sysinfo );
@@ -557,7 +560,7 @@ cpuid_check_amd_x86(gmx_cpuid_t                cpuid)
         save_affinity = SetThreadAffinityMask(GetCurrentThread(),1);
         for(i=0;i<cpuid->nproc;i++)
         {
-            SetThreadAffinityMask(GetCurrentThread(),(1<<i));
+            SetThreadAffinityMask(GetCurrentThread(),(((DWORD_PTR)1)<<i));
             Sleep(0);
             execute_x86cpuid(0x1,0,&eax,&ebx,&ecx,&edx);
             apic_id[i]=ebx >> 24;
@@ -574,7 +577,7 @@ cpuid_check_amd_x86(gmx_cpuid_t                cpuid)
         if(core_bits==0)
         {
             /* Legacy method for old single/dual core AMD CPUs */
-            i = ecx & 0xF;
+            int i = ecx & 0xF;
             for(core_bits=0;(i>>core_bits)>0;core_bits++) ;
         }
         cpuid_x86_decode_apic_id(cpuid,apic_id,core_bits,hwthread_bits);
@@ -590,7 +593,6 @@ cpuid_check_intel_x86(gmx_cpuid_t                cpuid)
 {
     unsigned int              max_stdfn,max_extfn;
     unsigned int              eax,ebx,ecx,edx;
-    unsigned int              i;
     unsigned int              max_logical_cores,max_physical_cores;
     int                       hwthread_bits,core_bits;
     int *                     apic_id;
@@ -638,6 +640,7 @@ cpuid_check_intel_x86(gmx_cpuid_t                cpuid)
         /* Query x2 APIC information from cores */
 #if (defined HAVE_SCHED_H && defined HAVE_SCHED_SETAFFINITY && defined HAVE_SYSCONF && defined __linux__)
         /* Linux */
+        unsigned int   i;
         cpu_set_t      cpuset,save_cpuset;
         cpuid->nproc = sysconf(_SC_NPROCESSORS_ONLN);
         apic_id      = malloc(sizeof(int)*cpuid->nproc);
@@ -657,6 +660,7 @@ cpuid_check_intel_x86(gmx_cpuid_t                cpuid)
 #define CPUID_HAVE_APIC
 #elif defined GMX_NATIVE_WINDOWS
         /* Windows */
+        DWORD_PTR     i;
         SYSTEM_INFO   sysinfo;
         unsigned int  save_affinity,affinity;
         GetSystemInfo( &sysinfo );
@@ -666,7 +670,7 @@ cpuid_check_intel_x86(gmx_cpuid_t                cpuid)
         save_affinity = SetThreadAffinityMask(GetCurrentThread(),1);
         for(i=0;i<cpuid->nproc;i++)
         {
-            SetThreadAffinityMask(GetCurrentThread(),(1<<i));
+            SetThreadAffinityMask(GetCurrentThread(),(((DWORD_PTR)1)<<i));
             Sleep(0);
             execute_x86cpuid(0xB,0,&eax,&ebx,&ecx,&edx);
             apic_id[i]=edx;
index bbd1f75957d2ed4a9d969aa563d5a2eadaa7581f..c99686525c3dec695eec9e8a9a0507dba4273c60 100644 (file)
@@ -38,7 +38,6 @@
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
-#include "gmx_header_config.h"
 
 #include <gmx_random.h>
 
index 8a7e4c6fdb42240f896b2eedd99f5b78de3d8f68..41c84933cb55556a3671957f036e3cc33e880960 100644 (file)
@@ -38,7 +38,6 @@
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
-#include "gmx_header_config.h"
 
 #include <sys/types.h>
 #include <stdio.h>
index 2d583ce8546b5fb6b035358c88ef558d54c69d61..e18c224892658eb269316dcf1839126c4e672418 100644 (file)
@@ -38,7 +38,6 @@
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
-#include "gmx_header_config.h"
 
 #include <stdio.h>
 #include <stdlib.h>
index 8558104a0b71110bc250a9426c11f5d52f60229d..c11cd9c87b3e000031db5512a41a69451adc4d9b 100644 (file)
@@ -38,7 +38,6 @@
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
-#include "gmx_header_config.h"
 
 #include <time.h>
 #ifdef GMX_NATIVE_WINDOWS
index e815a378cf087b745165a10dcc2342e989f6d4d1..c7c98b3d1662fa82c1d56e7c302dd8cd295c0476 100644 (file)
@@ -40,7 +40,6 @@
 #include <config.h>
 #endif
 #include "visibility.h"
-#include "gmx_header_config.h"
 
 #ifdef GMX_CRAY_XT3
 #undef HAVE_PWD_H
index 009cf69b020e0a25c666e9e950157870504cc831..5832a2a135a97befd193dd925dc28d655dc0dacf 100644 (file)
@@ -37,7 +37,6 @@
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
-#include "gmx_header_config.h"
 
 
 
index 21b00fb590f37da17dd661d24b72e78f26ef74bf..551c7987e55df652a9385e96abbcfa8f8e1be42e 100644 (file)
@@ -38,7 +38,6 @@
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
-#include "gmx_header_config.h"
 
 #include "string2.h"
 #include "smalloc.h"
index 7d2abd34d49c23e6da7feda951a718a7d3107016..d6f2bbf9d5749b24ed55602acdbd5388929b89eb 100644 (file)
@@ -38,7 +38,6 @@
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
-#include "gmx_header_config.h"
 
 #include <stdio.h>
 #include <stdlib.h>
index 9a2cf5cfd8333b3037943ac87e6bb6c32cdfdf49..931e5132d5e27a47f0ba1d32aeac7a94860c6a70 100644 (file)
@@ -38,7 +38,6 @@
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
-#include "gmx_header_config.h"
 
 #include <stdio.h>
 #include <math.h>
index 76446cdc27fdf7e413f1a4900383ac98c4061c1f..45cc4dcf563e93821edf3a49394a8f038fac3e44 100644 (file)
@@ -38,7 +38,6 @@
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
-#include "gmx_header_config.h"
 #include <math.h>
 #include <string.h>
 #include <ctype.h>
index c16768cfea731dc377e82a7f074cabdd14236fce..fd0934433054f69be8341652111257248959b80a 100644 (file)
@@ -38,7 +38,6 @@
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
-#include "gmx_header_config.h"
 #include <math.h>
 #include <string.h>
 #include <time.h>
index 05a340c593df9c7597bd40f49dc95f2519f8cfad..5222aa23ba05f08cf4d78049f5ec15d661bdb313 100644 (file)
@@ -34,7 +34,6 @@
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
-#include "gmx_header_config.h"
 
 #include <math.h>
 #include <stdlib.h>
index a1cb2e9fa7d07dda6b9bea164ee9f36b88f8da19..cd9bf5956a4b6ffc2ba68cca59c618477c4523e9 100644 (file)
@@ -38,7 +38,6 @@
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
-#include "gmx_header_config.h"
 
 #include <math.h>
 #include <ctype.h>
index 0e935a7c80fd57195a735d878e4f05abce367a0f..7cce07ce4ac38732d3d5a5b35a70885bf6015446 100644 (file)
@@ -38,7 +38,6 @@
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
-#include "gmx_header_config.h"
 
 #include <string.h>
 #include <math.h>