From: Martin Quinson Date: Sun, 13 Sep 2015 15:45:00 +0000 (+0200) Subject: Merge branch 'master' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid X-Git-Tag: v3_12~220 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/b2f752feb35d35e191205da26b5522038c04c2b6?hp=7aaac1ccdd8b0373140b3855cebfa80558ddc8d4 Merge branch 'master' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 7ab35ffa19..105c070e62 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ endif() ## Check the C/C++ standard that we need ## See also tools/cmake/Flags.cmake that sets our paranoid warning flags if (MSVC) - message("-- MicroSoft Visual C detected. Good luck.") + message("-- You are compiling SimGrid with MicroSoft Visual C. Good luck.") else() # gcc or clang INCLUDE(CheckCCompilerFlag) CHECK_C_COMPILER_FLAG(-fstack-cleaner HAVE_C_STACK_CLEANER) diff --git a/appveyor.yml b/appveyor.yml index 09b49fb56a..68e80eed64 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -20,11 +20,9 @@ environment: BOOST_ROOT: c:\Libraries\boost BOOST_LIBRARYDIR: c:\Libraries\boost\stage\lib -# -DCMAKE_CXX_FLAGS_RELEASE="/MT /W1 /O2 /Ob2 /D NDEBUG" -DCMAKE_CXX_FLAGS_DEBUG="/D_DEBUG /MTd /Zi /Ob0 /Od /RTC1 /W1" -# -DCMAKE_CXX_FLAGS_RELEASE="/MT /W1 /O2 /Ob2 /D NDEBUG" -DCMAKE_CXX_FLAGS_DEBUG="/D_DEBUG /MTd /Zi /Ob0 /Od /RTC1 /W1" build_script: -- if [%PLATFORM%]==[Win32] cmake -G "Visual Studio 14 2015" . -- if [%PLATFORM%]==[x64] cmake -G "Visual Studio 14 2015 Win64" . +- if [%PLATFORM%]==[Win32] cmake -G "Visual Studio 14 2015" -Denable_smpi=OFF . +- if [%PLATFORM%]==[x64] cmake -G "Visual Studio 14 2015 Win64" -Denable_smpi=OFF . - msbuild ALL_BUILD.vcxproj /verbosity:normal test_script: diff --git a/include/simgrid_config.h.in b/include/simgrid_config.h.in index 5265002d00..ba2e9720af 100644 --- a/include/simgrid_config.h.in +++ b/include/simgrid_config.h.in @@ -58,6 +58,10 @@ #endif #endif +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_UNISTD_H @HAVE_UNISTD_H@ +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_TIME_H @HAVE_SYS_TIME_H@ /* Define to 1 if mmalloc is compiled in. */ #cmakedefine HAVE_MMALLOC @HAVE_MMALLOC@ diff --git a/include/smpi/smpi.h b/include/smpi/smpi.h index 2a4bd895ff..a9117e2af7 100644 --- a/include/smpi/smpi.h +++ b/include/smpi/smpi.h @@ -7,9 +7,15 @@ #ifndef SMPI_H #define SMPI_H +#include +#ifdef HAVE_UNISTD_H #include -#include +#endif +#ifdef HAVE_SYS_TIME_H #include +#endif + +#include #include #include diff --git a/include/xbt/base.h b/include/xbt/base.h index 1241b6366e..54ab2700e6 100644 --- a/include/xbt/base.h +++ b/include/xbt/base.h @@ -89,7 +89,7 @@ # define XBT_INLINE # endif # else -# if defined (__VISUALC__) +# if defined (_MSC_VER) # define XBT_INLINE __inline # else # define XBT_INLINE inline @@ -97,6 +97,20 @@ # endif /* __cplusplus */ #endif +#if defined(__GNUC__) +# define XBT_ALWAYS_INLINE inline __attribute__ ((always_inline)) +#else +# define XBT_ALWAYS_INLINE XBT_INLINE +#endif + +#if defined(__GNUC__) +# define XBT_THREAD_LOCAL __thread +#elif defined(_MSC_VER) +# define XBT_THREAD_LOCAL __declspec(thread) +#else +# define XBT_THREAD_LOCAL No thread local on this architecture +#endif + /* improvable on gcc (by evaluating arguments only once), but wouldn't be portable */ #ifdef MIN # undef MIN @@ -223,6 +237,23 @@ #endif +#ifdef _MSC_VER /* MSVC has no ssize_t, and I fail to use the SSIZE_T declared in BaseTsd.h */ + #if defined(_WIN64) + typedef __int64 ssize_t; + #else + typedef long ssize_t; + #endif + +/* Microsoft wants to improve the code quality blah blah blah */ +/* See: https://msdn.microsoft.com/en-us/library/8ef0s5kh.aspx */ + /* warning C4996: '_strdup': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _strdup. */ + # define _CRT_NONSTDC_NO_WARNINGS + /* warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. */ + # define _CRT_SECURE_NO_WARNINGS +#endif + + + #ifdef _XBT_WIN32 #define XBT_INTERNAL #else diff --git a/include/xbt/log.h b/include/xbt/log.h index 68132cf47e..240096d594 100644 --- a/include/xbt/log.h +++ b/include/xbt/log.h @@ -395,8 +395,8 @@ extern xbt_log_layout_t xbt_log_default_layout; */ #define _XBT_LOG_ISENABLEDV(catv, priority) \ (priority >= XBT_LOG_STATIC_THRESHOLD \ - && (catv.initialized || _xbt_log_cat_init(&catv, priority)) \ - && priority >= catv.threshold) + && ((catv).initialized || _xbt_log_cat_init(&(catv), priority)) \ + && priority >= (catv).threshold) /* * Internal Macros @@ -422,11 +422,28 @@ extern xbt_log_layout_t xbt_log_default_layout; fprintf(stderr,"%s:%d:\n" f, __FILE__, __LINE__, __VA_ARGS__) # define XBT_LOG(...) XBT_CLOG(0, __VA_ARGS__) #else -# define XBT_CLOG_(catv, prio, ...) \ + +// This code is duplicated to remove one level of indirection, working around a MSVC bug +// See: http://stackoverflow.com/questions/9183993/msvc-variadic-macro-expansion + +# define XBT_CLOG(category, prio, ...) \ + do { \ + if (_XBT_LOG_ISENABLEDV((category), prio)) { \ + s_xbt_log_event_t _log_ev; \ + _log_ev.cat = &(category); \ + _log_ev.priority = (prio); \ + _log_ev.fileName = __FILE__; \ + _log_ev.functionName = _XBT_FUNCTION; \ + _log_ev.lineNum = __LINE__; \ + _xbt_log_event_log(&_log_ev, __VA_ARGS__); \ + } \ + } while (0) + +# define XBT_LOG(prio,...) \ do { \ - if (_XBT_LOG_ISENABLEDV(catv, prio)) { \ + if (_XBT_LOG_ISENABLEDV((*_simgrid_log_category__default), prio)) { \ s_xbt_log_event_t _log_ev; \ - _log_ev.cat = &(catv); \ + _log_ev.cat = _simgrid_log_category__default; \ _log_ev.priority = (prio); \ _log_ev.fileName = __FILE__; \ _log_ev.functionName = _XBT_FUNCTION; \ @@ -434,8 +451,6 @@ extern xbt_log_layout_t xbt_log_default_layout; _xbt_log_event_log(&_log_ev, __VA_ARGS__); \ } \ } while (0) -# define XBT_CLOG(cat, prio, ...) XBT_CLOG_(_XBT_LOGV(cat), prio, __VA_ARGS__) -# define XBT_LOG(...) XBT_CLOG_((*_XBT_LOGV(default)), __VA_ARGS__) #endif /** @ingroup XBT_log @@ -444,74 +459,214 @@ extern xbt_log_layout_t xbt_log_default_layout; * \param ... the format string and its arguments * @brief Log an event at the DEBUG priority on the specified category with these args. */ -#define XBT_CDEBUG(c, ...) XBT_CLOG(c, xbt_log_priority_debug, __VA_ARGS__) +#define XBT_CDEBUG(categ, ...) \ + do { \ + if (XBT_LOG_ISENABLED (categ, xbt_log_priority_debug)) { \ + s_xbt_log_event_t _log_ev; \ + _log_ev.cat = &(_XBT_LOGV(categ)); \ + _log_ev.priority = xbt_log_priority_debug; \ + _log_ev.fileName = __FILE__; \ + _log_ev.functionName = _XBT_FUNCTION; \ + _log_ev.lineNum = __LINE__; \ + _xbt_log_event_log(&_log_ev, __VA_ARGS__); \ + } \ + } while (0) /** @ingroup XBT_log * @hideinitializer * @brief Log an event at the VERB priority on the specified category with these args. */ -#define XBT_CVERB(c, ...) XBT_CLOG(c, xbt_log_priority_verbose, __VA_ARGS__) +#define XBT_CVERB(categ, ...) \ + do { \ + if (XBT_LOG_ISENABLED (categ, xbt_log_priority_verbose)) { \ + s_xbt_log_event_t _log_ev; \ + _log_ev.cat = &(_XBT_LOGV(categ)); \ + _log_ev.priority = xbt_log_priority_verbose; \ + _log_ev.fileName = __FILE__; \ + _log_ev.functionName = _XBT_FUNCTION; \ + _log_ev.lineNum = __LINE__; \ + _xbt_log_event_log(&_log_ev, __VA_ARGS__); \ + } \ + } while (0) /** @ingroup XBT_log * @hideinitializer * @brief Log an event at the INFO priority on the specified category with these args. */ -#define XBT_CINFO(c, ...) XBT_CLOG(c, xbt_log_priority_info, __VA_ARGS__) +#define XBT_CINFO(categ, ...) \ + do { \ + if (XBT_LOG_ISENABLED (categ, xbt_log_priority_info)) { \ + s_xbt_log_event_t _log_ev; \ + _log_ev.cat = &(_XBT_LOGV(categ)); \ + _log_ev.priority = xbt_log_priority_info; \ + _log_ev.fileName = __FILE__; \ + _log_ev.functionName = _XBT_FUNCTION; \ + _log_ev.lineNum = __LINE__; \ + _xbt_log_event_log(&_log_ev, __VA_ARGS__); \ + } \ + } while (0) + /** @ingroup XBT_log * @hideinitializer * @brief Log an event at the WARN priority on the specified category with these args. */ -#define XBT_CWARN(c, ...) XBT_CLOG(c, xbt_log_priority_warning, __VA_ARGS__) +#define XBT_CWARN(categ, ...) \ + do { \ + if (XBT_LOG_ISENABLED (categ, xbt_log_priority_warning)) { \ + s_xbt_log_event_t _log_ev; \ + _log_ev.cat = &(_XBT_LOGV(categ)); \ + _log_ev.priority = xbt_log_priority_warning; \ + _log_ev.fileName = __FILE__; \ + _log_ev.functionName = _XBT_FUNCTION; \ + _log_ev.lineNum = __LINE__; \ + _xbt_log_event_log(&_log_ev, __VA_ARGS__); \ + } \ + } while (0) + /** @ingroup XBT_log * @hideinitializer * @brief Log an event at the ERROR priority on the specified category with these args. */ -#define XBT_CERROR(c, ...) XBT_CLOG(c, xbt_log_priority_error, __VA_ARGS__) +#define XBT_CERROR(categ, ...) \ + do { \ + if (XBT_LOG_ISENABLED (categ, xbt_log_priority_error)) { \ + s_xbt_log_event_t _log_ev; \ + _log_ev.cat = &(_XBT_LOGV(categ)); \ + _log_ev.priority = xbt_log_priority_error; \ + _log_ev.fileName = __FILE__; \ + _log_ev.functionName = _XBT_FUNCTION; \ + _log_ev.lineNum = __LINE__; \ + _xbt_log_event_log(&_log_ev, __VA_ARGS__); \ + } \ + } while (0) /** @ingroup XBT_log * @hideinitializer * @brief Log an event at the CRITICAL priority on the specified category with these args (CCRITICALn exists for any n<10). */ -#define XBT_CCRITICAL(c, ...) XBT_CLOG(c, xbt_log_priority_critical, __VA_ARGS__) +#define XBT_CCRITICAL(categ, ...) \ + do { \ + if (XBT_LOG_ISENABLED (categ, xbt_log_priority_critical)) { \ + s_xbt_log_event_t _log_ev; \ + _log_ev.cat = &(_XBT_LOGV(categ)); \ + _log_ev.priority = xbt_log_priority_critical; \ + _log_ev.fileName = __FILE__; \ + _log_ev.functionName = _XBT_FUNCTION; \ + _log_ev.lineNum = __LINE__; \ + _xbt_log_event_log(&_log_ev, __VA_ARGS__); \ + } \ + } while (0) /** @ingroup XBT_log * @hideinitializer * \param ... the format string and its arguments * @brief Log an event at the DEBUG priority on the default category with these args. */ -#define XBT_DEBUG(...) XBT_LOG(xbt_log_priority_debug, __VA_ARGS__) +#define XBT_DEBUG(...) \ + do { \ + if (_XBT_LOG_ISENABLEDV(*_simgrid_log_category__default, \ + xbt_log_priority_debug)) { \ + s_xbt_log_event_t _log_ev; \ + _log_ev.cat = _simgrid_log_category__default; \ + _log_ev.priority = xbt_log_priority_debug; \ + _log_ev.fileName = __FILE__; \ + _log_ev.functionName = _XBT_FUNCTION; \ + _log_ev.lineNum = __LINE__; \ + _xbt_log_event_log(&_log_ev, __VA_ARGS__); \ + } \ + } while (0) /** @ingroup XBT_log * @hideinitializer * @brief Log an event at the VERB priority on the default category with these args. */ -#define XBT_VERB(...) XBT_LOG(xbt_log_priority_verbose, __VA_ARGS__) +#define XBT_VERB(...) \ + do { \ + if (_XBT_LOG_ISENABLEDV(*_simgrid_log_category__default, \ + xbt_log_priority_verbose)) { \ + s_xbt_log_event_t _log_ev; \ + _log_ev.cat = _simgrid_log_category__default; \ + _log_ev.priority = xbt_log_priority_verbose; \ + _log_ev.fileName = __FILE__; \ + _log_ev.functionName = _XBT_FUNCTION; \ + _log_ev.lineNum = __LINE__; \ + _xbt_log_event_log(&_log_ev, __VA_ARGS__); \ + } \ + } while (0) /** @ingroup XBT_log * @hideinitializer * @brief Log an event at the INFO priority on the default category with these args. */ -#define XBT_INFO(...) XBT_LOG(xbt_log_priority_info, __VA_ARGS__) +#define XBT_INFO(...) \ + do { \ + if (_XBT_LOG_ISENABLEDV(*_simgrid_log_category__default, \ + xbt_log_priority_info)) { \ + s_xbt_log_event_t _log_ev; \ + _log_ev.cat = _simgrid_log_category__default; \ + _log_ev.priority = xbt_log_priority_info; \ + _log_ev.fileName = __FILE__; \ + _log_ev.functionName = _XBT_FUNCTION; \ + _log_ev.lineNum = __LINE__; \ + _xbt_log_event_log(&_log_ev, __VA_ARGS__); \ + } \ + } while (0) /** @ingroup XBT_log * @hideinitializer * @brief Log an event at the WARN priority on the default category with these args. */ -#define XBT_WARN(...) XBT_LOG(xbt_log_priority_warning, __VA_ARGS__) +#define XBT_WARN(...) \ + do { \ + if (_XBT_LOG_ISENABLEDV(*_simgrid_log_category__default, \ + xbt_log_priority_warning)) { \ + s_xbt_log_event_t _log_ev; \ + _log_ev.cat = _simgrid_log_category__default; \ + _log_ev.priority = xbt_log_priority_warning; \ + _log_ev.fileName = __FILE__; \ + _log_ev.functionName = _XBT_FUNCTION; \ + _log_ev.lineNum = __LINE__; \ + _xbt_log_event_log(&_log_ev, __VA_ARGS__); \ + } \ + } while (0) /** @ingroup XBT_log * @hideinitializer * @brief Log an event at the ERROR priority on the default category with these args. */ -#define XBT_ERROR(...) XBT_LOG(xbt_log_priority_error, __VA_ARGS__) +#define XBT_ERROR(...) \ + do { \ + if (_XBT_LOG_ISENABLEDV(*_simgrid_log_category__default, \ + xbt_log_priority_error)) { \ + s_xbt_log_event_t _log_ev; \ + _log_ev.cat = _simgrid_log_category__default; \ + _log_ev.priority = xbt_log_priority_error; \ + _log_ev.fileName = __FILE__; \ + _log_ev.functionName = _XBT_FUNCTION; \ + _log_ev.lineNum = __LINE__; \ + _xbt_log_event_log(&_log_ev, __VA_ARGS__); \ + } \ + } while (0) /** @ingroup XBT_log * @hideinitializer * @brief Log an event at the CRITICAL priority on the default category with these args. */ -#define XBT_CRITICAL(...) XBT_LOG(xbt_log_priority_critical, __VA_ARGS__) +#define XBT_CRITICAL(...) \ + do { \ + if (_XBT_LOG_ISENABLEDV(*_simgrid_log_category__default, \ + xbt_log_priority_critical)) { \ + s_xbt_log_event_t _log_ev; \ + _log_ev.cat = _simgrid_log_category__default; \ + _log_ev.priority = xbt_log_priority_critical; \ + _log_ev.fileName = __FILE__; \ + _log_ev.functionName = _XBT_FUNCTION; \ + _log_ev.lineNum = __LINE__; \ + _xbt_log_event_log(&_log_ev, __VA_ARGS__); \ + } \ + } while (0) #define _XBT_IN_OUT(...) \ _XBT_IF_ONE_ARG(_XBT_IN_OUT_ARG1, _XBT_IN_OUT_ARGN, __VA_ARGS__)(__VA_ARGS__) diff --git a/include/xbt/sysdep.h b/include/xbt/sysdep.h index 9ed7c53e13..d990aaa0e9 100644 --- a/include/xbt/sysdep.h +++ b/include/xbt/sysdep.h @@ -71,11 +71,8 @@ XBT_PUBLIC(char *) bprintf(const char *fmt, ...) _XBT_GNUC_PRINTF(1, 2); * @{ */ -#if defined(__GNUC__) || defined(DOXYGEN) /** @brief Like strdup, but xbt_die() on error */ -static inline __attribute__ ((always_inline)) -char *xbt_strdup(const char *s) -{ +static XBT_ALWAYS_INLINE char *xbt_strdup(const char *s) { char *res = NULL; if (s) { res = strdup(s); @@ -89,9 +86,7 @@ XBT_PUBLIC(void) xbt_backtrace_display_current(void); /** @brief Like malloc, but xbt_die() on error @hideinitializer */ -static inline __attribute__ ((always_inline)) -void *xbt_malloc(size_t n) -{ +static XBT_ALWAYS_INLINE void *xbt_malloc(size_t n) { void *res; /* if (n==0) { xbt_backtrace_display_current(); @@ -106,9 +101,7 @@ void *xbt_malloc(size_t n) /** @brief like malloc, but xbt_die() on error and memset data to 0 @hideinitializer */ -static inline __attribute__ ((always_inline)) -void *xbt_malloc0(size_t n) -{ +static XBT_ALWAYS_INLINE void *xbt_malloc0(size_t n) { void *res; //if (n==0) xbt_die("calloc(0) is not portable"); res = calloc(n, 1); @@ -119,9 +112,7 @@ void *xbt_malloc0(size_t n) /** @brief like realloc, but xbt_die() on error @hideinitializer */ -static inline __attribute__ ((always_inline)) -void *xbt_realloc(void *p, size_t s) -{ +static XBT_ALWAYS_INLINE void *xbt_realloc(void *p, size_t s) { void *res = NULL; //if (s==0) xbt_die("realloc(0) is not portable"); if (s) { @@ -137,12 +128,6 @@ void *xbt_realloc(void *p, size_t s) } return res; } -#else /* non __GNUC__ */ -# define xbt_strdup(s) strdup(s) -# define xbt_malloc(n) malloc(n) -# define xbt_malloc0(n) calloc(n,1) -# define xbt_realloc(p,s) realloc(p,s) -#endif /* __GNUC__ ? */ /** @brief like free @hideinitializer */ diff --git a/src/simdag/sd_daxloader.c b/src/simdag/sd_daxloader.c index e2873cdc96..e48ca55e51 100644 --- a/src/simdag/sd_daxloader.c +++ b/src/simdag/sd_daxloader.c @@ -8,7 +8,6 @@ #include "simgrid/simdag.h" #include "xbt/misc.h" #include "xbt/log.h" -#include XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sd_daxparse, sd, "Parsing DAX files"); @@ -368,8 +367,7 @@ xbt_dynar_t SD_daxload(const char *filename) } if (!acyclic_graph_detail(result)){ - XBT_ERROR("The DAX described in %s is not a DAG. It contains a cycle.", - basename((char*)filename)); + XBT_ERROR("The DAX described in %s is not a DAG. It contains a cycle.", filename); xbt_dynar_foreach(result, cpt, file) SD_task_destroy(file); xbt_dynar_free_container(&result); diff --git a/src/simix/smx_context.c b/src/simix/smx_context.c index 9adeeac59e..e447ed3e98 100644 --- a/src/simix/smx_context.c +++ b/src/simix/smx_context.c @@ -18,6 +18,7 @@ #ifdef _WIN32 #include +#include #else #include #endif @@ -27,10 +28,6 @@ #define _aligned_free __mingw_aligned_free #endif //MINGW -#if defined(_XBT_WIN32) -#include -#endif - #ifdef HAVE_VALGRIND_VALGRIND_H # include #endif @@ -45,7 +42,7 @@ int smx_context_stack_size_was_set = 0; int smx_context_guard_size; int smx_context_guard_size_was_set = 0; #ifdef HAVE_THREAD_LOCAL_STORAGE -static __thread smx_context_t smx_current_context_parallel; +static XBT_THREAD_LOCAL smx_context_t smx_current_context_parallel; #else static xbt_os_thread_key_t smx_current_context_key = 0; #endif diff --git a/src/surf/surfxml_parse.c b/src/surf/surfxml_parse.c index ad461b9a56..c82a3070ec 100644 --- a/src/surf/surfxml_parse.c +++ b/src/surf/surfxml_parse.c @@ -7,7 +7,9 @@ #include #include #include /* va_arg */ +#ifndef _MSC_VER #include +#endif #include "xbt/misc.h" #include "xbt/log.h" @@ -1028,8 +1030,18 @@ void surf_parse_open(const char *file) if (!surf_parsed_filename_stack) surf_parsed_filename_stack = xbt_dynar_new(sizeof(char *), &xbt_free_ref); + +#ifdef _MSC_VER + /* There is no dirname on windows... */ + char drive[_MAX_DRIVE]; + char dir[_MAX_DIR]; + errno_t err; + err = _splitpath_s(file, drive, _MAX_DRIVE, dir, _MAX_DIR, NULL,0, NULL,0); + char *dir = bprintf("%s%s",drive,dir); +#else surf_parsed_filename = xbt_strdup(file); char *dir = dirname(surf_parsed_filename); +#endif xbt_dynar_push(surf_path, &dir); surf_file_to_parse = surf_fopen(file, "r"); diff --git a/src/xbt/parmap.c b/src/xbt/parmap.c index b5d9025ff2..a19ed045e6 100644 --- a/src/xbt/parmap.c +++ b/src/xbt/parmap.c @@ -5,7 +5,9 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "internal_config.h" +#ifdef HAVE_UNISTD_H #include +#endif #ifndef _XBT_WIN32 #include diff --git a/tools/cmake/CompleteInFiles.cmake b/tools/cmake/CompleteInFiles.cmake index 4e76d1f214..d4730daa72 100644 --- a/tools/cmake/CompleteInFiles.cmake +++ b/tools/cmake/CompleteInFiles.cmake @@ -17,7 +17,11 @@ IF(CMAKE_SYSTEM_PROCESSOR MATCHES ".86|AMD64|amd64") message(STATUS "System processor: x86_64 (${CMAKE_SYSTEM_PROCESSOR}, 64 bits)") set(PROCESSOR_x86_64 1) ENDIF() - set(HAVE_RAWCTX 1) + if (NOT MSVC) + message(STATUS "Disable fast raw contextes on Microsoft Visual.") + else() + set(HAVE_RAWCTX 1) + endif() ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^alpha") message(STATUS "System processor: alpha") diff --git a/tools/cmake/DefinePackages.cmake b/tools/cmake/DefinePackages.cmake index a3af7a0204..31d4066331 100644 --- a/tools/cmake/DefinePackages.cmake +++ b/tools/cmake/DefinePackages.cmake @@ -352,7 +352,6 @@ set(SIMIX_SRC src/simix/libsmx.c src/simix/smx_context.c src/simix/smx_context_base.c - src/simix/smx_context_raw.c src/simix/smx_deployment.c src/simix/smx_environment.c src/simix/smx_global.c @@ -367,6 +366,18 @@ set(SIMIX_SRC ${SIMIX_GENERATED_SRC} ) +# Don't try to compile our inline assembly with MSVC +if (MSVC) + set(EXTRA_DIST + ${EXTRA_DIST} + src/simix/smx_context_raw.c) +else() + set(SIMIX_SRC + ${SIMIX_SRC} + src/simix/smx_context_raw.c) +endif() + +# Boost context may not be available if (HAVE_BOOST_CONTEXT) set(SIMIX_SRC ${SIMIX_SRC} diff --git a/tools/cmake/test_prog/prog_thread_storage.c b/tools/cmake/test_prog/prog_thread_storage.c index 86d2940db7..edcab030ca 100644 --- a/tools/cmake/test_prog/prog_thread_storage.c +++ b/tools/cmake/test_prog/prog_thread_storage.c @@ -6,7 +6,12 @@ #include -__thread int thread_specific_variable = 0; +#ifdef _MSC_VER +__declspec(thread) +#else +__thread +#endif +int thread_specific_variable = 0; int main(void) {