X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/26682497b29a3eeb2d08eae44a4bef73a17a08fc..ab58f88f92ff03857b6cea328043a63619dc2ba7:/src/win32/compiler/visualc.h diff --git a/src/win32/compiler/visualc.h b/src/win32/compiler/visualc.h index 3833296bd4..37d93ecd57 100644 --- a/src/win32/compiler/visualc.h +++ b/src/win32/compiler/visualc.h @@ -3,7 +3,8 @@ /* borland.h - simgrid config for Borland C++ Builder */ -/* Copyright (c) 2003, 2004 Cherier Malek. All rights reserved. */ +/* Copyright (c) 2007, 2008, 2010. The SimGrid Team. + * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -14,6 +15,15 @@ #include +#ifdef _WIN32_WINNT + #if _WIN32_WINNT < 0x0400 + #undef _WIN32_WINNT + #define _WIN32_WINNT 0x0400 + #endif +#else + #define _WIN32_WINNT 0x0400 +#endif + /* * include files. */ @@ -94,27 +104,6 @@ #undef HAVE_UNISTD_H #endif -/* - * The compiler has the header file. - * Process the case of afx.h -*/ -#if !defined(HAVE_WINDOWS_H) - #define HAVE_WINDOWS_H 1 -#endif - -/* The compiler has the header file. */ -#if !defined(HAVE_WINSOCK2_H) - #define HAVE_WINSOCK2_H -#endif - -/* - * The compiler has the header file. - * Trouble if winsock2.h exists ? - */ -#if !defined(HAVE_WINSOCK_H) - #define HAVE_WINSOCK_H 1 -#endif - /* The compiler has the header file */ #if !defined(HAVE_SIGNAL_H) #define HAVE_SIGNAL_H 1 @@ -164,10 +153,22 @@ #undef HAVE_SIGNAL #endif +/* "disable the snprintf replacement ( this function is broken on system v only" */ + + + +#ifdef PREFER_PORTABLE_SNPRINTF +# undef PREFER_PORTABLE_SNPRINTF 1 +#endif + + /* The compiler has `snprintf' function. */ -#if _MSC_VER >= 7 /* FIXME: check version number */ +#if _MSC_VER >= 1400 # ifndef HAVE_SNPRINTF - #define HAVE_SNPRINTF 1 +# define HAVE_SNPRINTF 1 +# ifndef PREFER_PORTABLE_SNPRINTF +# define snprintf _snprintf +# endif # endif #else # ifdef HAVE_SNPRINTF @@ -175,6 +176,8 @@ # endif #endif + + /* No `swapcontext' function. */ #if defined(HAVE_SWAPCONTEXT) #undef HAVE_SWAPCONTEXT @@ -207,13 +210,6 @@ #define NEED_VASPRINTF #endif -/* "disable the snprintf replacement ( this function is broken on system v only" */ - - -#if !defined(PREFER_PORTABLE_SNPRINTF) - #define PREFER_PORTABLE_SNPRINTF -#endif - /* The maximal size of any scalar on this arch */ #if !defined(SIZEOF_MAX) #define SIZEOF_MAX 8 @@ -301,7 +297,7 @@ the double. For now, GRAS requires the structures to be compacted. */ #undef GRAS_THISARCH #endif -#define GRAS_THISARCH 0 +#define GRAS_THISARCH 3 /* Path to the addr2line tool */ @@ -309,41 +305,65 @@ the double. For now, GRAS requires the structures to be compacted. */ #undef ADDR2LINE #endif -#if !defined(HAVE_VA_COPY) - #define HAVE_VA_COPY 1 -#endif -/* This macro is not defined in borland stdarg.h include file, adds it. */ -#define va_copy(dest,src) ((dest)=(src)) +#ifndef __VISUALC__ + + #if !defined(HAVE_VA_COPY) + #define HAVE_VA_COPY 1 + #endif + + /* This macro is not defined in borland stdarg.h include file, adds it. */ + #ifndef va_copy(dest,src) + #define va_copy(dest,src) ((dest)=(src)) + #endif -/* Predefined possible va_copy() implementation (id: ASP) */ -#define __VA_COPY_USE_ASP(d, s) do { *(d) = *(s); } while (0) + #ifndef __VA_COPY_USE_ASP(d, s) + /* Predefined possible va_copy() implementation (id: ASP) */ + #define __VA_COPY_USE_ASP(d, s) do { *(d) = *(s); } while (0) + #endif -/* Predefined possible va_copy() implementation (id: ASS) */ -#define __VA_COPY_USE_ASS(d, s) do { (d) = (s); } while (0) + #ifndef __VA_COPY_USE_ASS(d, s) + /* Predefined possible va_copy() implementation (id: ASS) */ + #define __VA_COPY_USE_ASS(d, s) do { (d) = (s); } while (0) + #endif -/* Predefined possible va_copy() implementation (id: C99) */ -#define __VA_COPY_USE_C99(d, s) va_copy((d), (s)) + #ifndef __VA_COPY_USE_C99(d, s) + /* Predefined possible va_copy() implementation (id: C99) */ + #define __VA_COPY_USE_C99(d, s) va_copy((d), (s)) + #endif -/* Predefined possible va_copy() implementation (id: CPP) */ -#define __VA_COPY_USE_CPP(d, s) memcpy((void *)(d), (void *)(s)), sizeof(*(s)) + #ifndef __VA_COPY_USE_CPP(d, s) + /* Predefined possible va_copy() implementation (id: CPP) */ + #define __VA_COPY_USE_CPP(d, s) memcpy((void *)(d), (void *)(s), sizeof(*(s))) + #endif -/* Predefined possible va_copy() implementation (id: CPS) */ -#define __VA_COPY_USE_CPS(d, s) memcpy((void *)&(d), (void *)&(s)), sizeof((s)) + #ifndef __VA_COPY_USE_CPS(d, s) + /* Predefined possible va_copy() implementation (id: CPS) */ + #define __VA_COPY_USE_CPS(d, s) memcpy((void *)&(d), (void *)&(s), sizeof(s)) + #endif -/* Predefined possible va_copy() implementation (id: GCB) */ -#define __VA_COPY_USE_GCB(d, s) __builtin_va_copy((d), (s)) + #ifndef __VA_COPY_USE_GCB(d, s) + /* Predefined possible va_copy() implementation (id: GCB) */ + #define __VA_COPY_USE_GCB(d, s) __builtin_va_copy((d), (s)) + #endif -/* Predefined possible va_copy() implementation (id: GCH) */ -#define __VA_COPY_USE_GCH(d, s) __va_copy((d), (s)) + #ifndef __VA_COPY_USE_GCH(d, s) + /* Predefined possible va_copy() implementation (id: GCH) */ + #define __VA_COPY_USE_GCH(d, s) __va_copy((d), (s)) + #endif + /* Predefined possible va_copy() implementation (id: GCM) */ + #define __VA_COPY_USE_GCM(d, s) VA_COPY((d), (s)) -/* Predefined possible va_copy() implementation (id: GCM) */ -#define __VA_COPY_USE_GCM(d, s) VA_COPY((d), (s)) + /* Optional va_copy() implementation activation */ + #ifndef HAVE_VA_COPY + #define va_copy(d, s) __VA_COPY_USE(d, s) + #endif -/* Optional va_copy() implementation activation */ -#ifndef HAVE_VA_COPY -#define va_copy(d, s) __VA_COPY_USE(d, s) + /* Define to id of used va_copy() implementation */ + #ifndef __VA_COPY_USE + #define __VA_COPY_USE __VA_COPY_USE_C99 + #endif #endif /* xbt contexts are based on our threads implementation */ @@ -351,13 +371,12 @@ the double. For now, GRAS requires the structures to be compacted. */ #define CONTEXT_THREADS 1 #endif + /* xbt contexts are not based on ucontext */ #ifdef CONTEXT_UCONTEXT #undef CONTEXT_UCONTEXT #endif -/* Define to id of used va_copy() implementation */ -#define __VA_COPY_USE __VA_COPY_USE_C99 #ifndef _XBT_CALL #if defined(_XBT_DESIGNATED_DLL) @@ -392,8 +411,6 @@ the double. For now, GRAS requires the structures to be compacted. */ * Replace winsock2.h,ws2tcpip.h and winsock.h header files */ #include -/* types */ -typedef unsigned int uint32_t; /* Choose setjmp as exception implementation */ #ifndef __EX_MCTX_SJLJ__ @@ -401,6 +418,21 @@ typedef unsigned int uint32_t; #endif + +#include + +#define S_IWUSR _S_IWRITE +#define S_IRUSR _S_IREAD + + +/* Visual C++ does not declare the ssize_t type */ typedef int ssize_t; +/* Visual C++ does not declare the mode_t type */ +typedef unsigned int mode_t; + +/* Visual C++ does not declare the uint32_t type */ +typedef unsigned int uint32_t; + + #endif /* #ifndef __XBT_VISUALC_COMPILER_CONFIG_H__ */