Browse Source

use _WIN32 instead of just MINGW32

Samuel Thibault 10 years ago
parent
commit
1359bf77f3

+ 1 - 1
src/common/fxt.c

@@ -65,7 +65,7 @@ long _starpu_gettid(void)
 	long tid;
 	thr_self(&tid);
 	return tid;
-#elif defined(__MINGW32__)
+#if defined(_WIN32) && !defined(__CYGWIN__)
 	return (long) GetCurrentThreadId();
 #else
 	return (long) pthread_self();

+ 5 - 5
src/common/utils.c

@@ -23,7 +23,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 
-#ifdef __MINGW32__
+#if defined(_WIN32) && !defined(__CYGWIN__)
 #include <io.h>
 #include <sys/locking.h>
 #define mkdir(path, mode) mkdir(path)
@@ -40,7 +40,7 @@ int _starpu_mkpath(const char *s, mode_t mode)
 
 	rv = -1;
 	if (strcmp(s, ".") == 0 || strcmp(s, "/") == 0
-#ifdef __MINGW32__
+#if defined(_WIN32)
 		/* C:/ or C:\ */
 		|| (s[0] && s[1] == ':' && (s[2] == '/' || s[2] == '\\') && !s[3])
 #endif
@@ -111,7 +111,7 @@ int _starpu_ftruncate(FILE *file)
 
 int _starpu_frdlock(FILE *file)
 {
-#ifdef __MINGW32__
+#if defined(_WIN32) && !defined(__CYGWIN__)
 	int ret;
 	do {
 		ret = _locking(fileno(file), _LK_RLCK, 10);
@@ -130,7 +130,7 @@ int _starpu_frdlock(FILE *file)
 
 int _starpu_frdunlock(FILE *file)
 {
-#ifdef __MINGW32__
+#if defined(_WIN32) && !defined(__CYGWIN__)
 #  ifndef _LK_UNLCK
 #    define _LK_UNLCK _LK_UNLOCK
 #  endif
@@ -148,7 +148,7 @@ int _starpu_frdunlock(FILE *file)
 
 int _starpu_fwrlock(FILE *file)
 {
-#ifdef __MINGW32__
+#if defined(_WIN32) && !defined(__CYGWIN__)
 	int ret;
 	do {
 		ret = _locking(fileno(file), _LK_LOCK, 10);

+ 1 - 1
src/core/combined_workers.c

@@ -25,7 +25,7 @@
 #include <sched.h>
 #endif
 
-#ifdef __MINGW32__
+#if defined(_WIN32) && !defined(__CYGWIN__)
 #include <windows.h>
 #endif
 

+ 1 - 1
src/core/sched_ctx.c

@@ -1613,7 +1613,7 @@ void starpu_sched_ctx_bind_current_thread_to_cpuid(unsigned cpuid STARPU_ATTRIBU
 		STARPU_ABORT();
 	}
 
-#elif defined(__MINGW32__) || defined(__CYGWIN__)
+#elif defined(_WIN32)
 	DWORD mask = 1 << cpuid;
 	if (!SetThreadAffinityMask(GetCurrentThread(), mask))
 	{

+ 2 - 2
src/core/topology.c

@@ -461,7 +461,7 @@ _starpu_init_topology (struct _starpu_machine_config *config)
 
 	config->topology.nhwcpus = config->topology.nhwpus = sysconf(_SC_NPROCESSORS_ONLN);
 
-#elif defined(__MINGW32__) || defined(__CYGWIN__)
+#elif defined(_WIN32)
 	/* Discover the CPUs on Cygwin and MinGW systems. */
 
 	SYSTEM_INFO sysinfo;
@@ -1148,7 +1148,7 @@ _starpu_bind_thread_on_cpu (
 		STARPU_ABORT();
 	}
 
-#elif defined(__MINGW32__) || defined(__CYGWIN__)
+#elif defined(_WIN32)
 	DWORD mask = 1 << cpuid;
 	if (!SetThreadAffinityMask(GetCurrentThread(), mask))
 	{

+ 1 - 1
src/core/workers.c

@@ -42,7 +42,7 @@
 #include <core/simgrid.h>
 #endif
 
-#ifdef __MINGW32__
+#if defined(_WIN32) && !defined(__CYGWIN__)
 #include <windows.h>
 #endif
 

+ 1 - 1
tools/starpu_calibrate_bus.c

@@ -17,7 +17,7 @@
 #include <config.h>
 #include <starpu.h>
 #include <stdio.h>
-#ifdef __MINGW32__
+#if defined(_WIN32) && !defined(__CYGWIN__)
 #include <windows.h>
 #endif
 

+ 2 - 2
tools/starpu_perfmodel_display.c

@@ -24,7 +24,7 @@
 
 #include <starpu.h>
 
-#ifdef __MINGW32__
+#if defined(_WIN32) && !defined(__CYGWIN__)
 #include <windows.h>
 #endif
 
@@ -141,7 +141,7 @@ static void parse_args(int argc, char **argv)
 
 int main(int argc, char **argv)
 {
-#ifdef __MINGW32__
+#if defined(_WIN32) && !defined(__CYGWIN__)
 	WSADATA wsadata;
 	WSAStartup(MAKEWORD(1,0), &wsadata);
 #endif

+ 2 - 2
tools/starpu_perfmodel_plot.c

@@ -31,7 +31,7 @@
 #include <core/perfmodel/perfmodel.h> // we need to browse the list associated to history-based models
 #include <core/workers.h>
 
-#ifdef __MINGW32__
+#if defined(_WIN32) && !defined(__CYGWIN__)
 #include <windows.h>
 #endif
 
@@ -649,7 +649,7 @@ int main(int argc, char **argv)
 	int ret;
 	struct starpu_perfmodel model = {};
 
-#ifdef __MINGW32__
+#if defined(_WIN32) && !defined(__CYGWIN__)
 	WSADATA wsadata;
 	WSAStartup(MAKEWORD(1,0), &wsadata);
 #endif