Fix windows detection in headers (#6557)

This commit is contained in:
Anton Kochkov 2017-01-25 13:30:16 +03:00 committed by radare
parent 8c3db51c48
commit e9c2d22da9
10 changed files with 17 additions and 17 deletions

View file

@ -81,11 +81,11 @@
#define __BSD__ 1
#define __UNIX__ 1
#endif
#if __WIN32__ || __CYGWIN__ || MINGW32
#if _WIN32 || __CYGWIN__ || MINGW32
#define __addr_t_defined
#include <windows.h>
#endif
#if __WIN32__ || MINGW32 && !__CYGWIN__
#if _WIN32 || MINGW32 && !__CYGWIN__
#include <winsock.h>
typedef int socklen_t;
#undef USE_SOCKETS
@ -423,7 +423,7 @@ enum {
#define R_SYS_OS "darwin"
#elif defined (__linux__)
#define R_SYS_OS "linux"
#elif defined (__WIN32__) || defined (__CYGWIN__) || defined (MINGW32)
#elif defined (_WIN32) || defined (__CYGWIN__) || defined (MINGW32)
#define R_SYS_OS "windows"
#elif defined (__NetBSD__ )
#define R_SYS_OS "netbsd"

View file

@ -5,7 +5,7 @@
#define DEBUGGER @DEBUGGER@
#if __WIN32__ || __CYGWIN__ || MINGW32
#if _WIN32 || __CYGWIN__ || MINGW32
#define R2_PREFIX "."
#define R2_LIBDIR "./lib"
#define R2_INCDIR "./include/libr"

View file

@ -30,7 +30,7 @@
#define __MINGW__ 1
#endif
#if __WIN32__ || __MINGW__ || __WINDOWS__
#if _WIN32 || __MINGW__ || __WINDOWS__
#define __SDB_WINDOWS__ 1
#include <windows.h>
#define DIRSEP '\\'

View file

@ -49,7 +49,7 @@ R_API RThread *r_th_new(R_TH_FUNCTION(fun), void *user, int delay) {
th->ready = false;
#if HAVE_PTHREAD
pthread_create (&th->tid, NULL, _r_th_launcher, th);
#elif __WIN32__ || __WINDOWS__ && !defined(__CYGWIN__)
#elif _WIN32 || __WINDOWS__ && !defined(__CYGWIN__)
th->tid = CreateThread (NULL, 0, _r_th_launcher, th, 0, &th->tid);
#endif
}

View file

@ -10,7 +10,7 @@ R_API RThreadLock *r_th_lock_new() {
thl->refs = 0;
#if HAVE_PTHREAD
pthread_mutex_init (&thl->lock, NULL);
#elif __WIN32__ || __WINDOWS__ && !defined(__CYGWIN__)
#elif _WIN32 || __WINDOWS__ && !defined(__CYGWIN__)
//thl->lock = CreateSemaphore(NULL, 0, 1, NULL);
InitializeCriticalSection(&thl->lock);
#endif
@ -22,7 +22,7 @@ R_API int r_th_lock_wait(RThreadLock *thl) {
#if HAVE_PTHREAD
r_th_lock_enter (thl); // locks here
r_th_lock_leave (thl); // releases previous mutex
#elif __WIN32__ || __WINDOWS__ && !defined(__CYGWIN__)
#elif _WIN32 || __WINDOWS__ && !defined(__CYGWIN__)
WaitForSingleObject (thl->lock, INFINITE);
#else
while (r_th_lock_check (thl));
@ -33,7 +33,7 @@ R_API int r_th_lock_wait(RThreadLock *thl) {
R_API int r_th_lock_enter(RThreadLock *thl) {
#if HAVE_PTHREAD
pthread_mutex_lock(&thl->lock);
#elif __WIN32__ || __WINDOWS__ && !defined(__CYGWIN__)
#elif _WIN32 || __WINDOWS__ && !defined(__CYGWIN__)
EnterCriticalSection (&thl->lock);
#endif
return ++thl->refs;
@ -42,7 +42,7 @@ R_API int r_th_lock_enter(RThreadLock *thl) {
R_API int r_th_lock_leave(RThreadLock *thl) {
#if HAVE_PTHREAD
pthread_mutex_unlock (&thl->lock);
#elif __WIN32__ || __WINDOWS__ && !defined(__CYGWIN__)
#elif _WIN32 || __WINDOWS__ && !defined(__CYGWIN__)
LeaveCriticalSection (&thl->lock);
//ReleaseSemaphore (thl->lock, 1, NULL);
#endif
@ -60,7 +60,7 @@ R_API void *r_th_lock_free(RThreadLock *thl) {
if (thl) {
#if HAVE_PTHREAD
pthread_mutex_destroy (&thl->lock);
#elif __WIN32__ || __WINDOWS__ && !defined(__CYGWIN__)
#elif _WIN32 || __WINDOWS__ && !defined(__CYGWIN__)
DeleteCriticalSection (&thl->lock);
CloseHandle (thl->lock);
#endif

View file

@ -30,7 +30,7 @@
#define __MINGW__ 1
#endif
#if __WIN32__ || __MINGW__ || __WINDOWS__
#if _WIN32 || __MINGW__ || __WINDOWS__
#define __SDB_WINDOWS__ 1
#include <windows.h>
#define DIRSEP '\\'

View file

@ -17,11 +17,11 @@
#define __BSD__ 1
#define __UNIX__ 1
#endif
#if __WIN32__ || __CYGWIN__ || MINGW32
#if _WIN32 || __CYGWIN__ || MINGW32
#define __addr_t_defined
#include <windows.h>
#endif
#if __WIN32__ || MINGW32 && !__CYGWIN__
#if _WIN32 || MINGW32 && !__CYGWIN__
#include <winsock.h>
typedef int socklen_t;
#undef USE_SOCKETS

View file

@ -74,7 +74,7 @@
#ifdef FMT64
# undef FMT64
#endif
#if defined(_MSC_VER) || defined(__BORLANDC__) || __WIN32__ || __MINGW32__ && !defined(__CYGWIN__)
#if defined(_MSC_VER) || defined(__BORLANDC__) || _WIN32 || __MINGW32__ && !defined(__CYGWIN__)
# define FMT64 "I64"
#else
# if defined(__APPLE__)

View file

@ -4,7 +4,7 @@
#include <string.h>
#include <unistd.h>
#if __WIN32__ || __CYGWIN__ || MINGW32
#if _WIN32 || __CYGWIN__ || MINGW32
#include <windows.h>
#include <fcntl.h>
#include "transport.h"

View file

@ -6,7 +6,7 @@
extern io_backend_t iob_pipe;
static io_backend_t *io_backends[] = {
//#if __WIN32__ || __CYGWIN__ || MINGW32
//#if _WIN32 || __CYGWIN__ || MINGW32
//#warning TODO: add proper IO backend for windows here
//#else
&iob_pipe,