if(WIN32)
- #Need env INCLUDE
set(CMAKE_INCLUDE_WIN "${CMAKE_C_COMPILER}")
set(CMAKE_LIB_WIN "${CMAKE_C_COMPILER}")
string(REGEX REPLACE "/bin/gcc.*" "/include" CMAKE_INCLUDE_WIN "${CMAKE_INCLUDE_WIN}")
set(INCLUDES ${INCLUDES} ${CMAKE_INCLUDE_WIN})
unset(CMAKE_INCLUDE_WIN)
- set(_XBT_WIN32 1)
-
endif()
include_directories(${INCLUDES})
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
add_definitions(-D_XOPEN_SOURCE=700 -D_DARWIN_C_SOURCE)
endif()
-
-if(WIN32)
- # We always provide our own implementation of ucontext on Windows.
- try_compile(HAVE_UCONTEXT
- ${CMAKE_BINARY_DIR}
- ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_AC_CHECK_MCSC.c
- COMPILE_DEFINITIONS -D_XBT_WIN32 -I${CMAKE_HOME_DIRECTORY}/src/include -I${CMAKE_HOME_DIRECTORY}/src/xbt
- )
-else()
- # We always provide our own implementation of ucontext on Windows.
- try_compile(HAVE_UCONTEXT
+try_compile(HAVE_UCONTEXT
${CMAKE_BINARY_DIR}
${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_AC_CHECK_MCSC.c)
-endif()
#If can have both context
-
if(HAVE_UCONTEXT)
set(HAVE_UCONTEXT_CONTEXTS 1)
message("-- Support for ucontext factory")
set(makecontext_CPPFLAGS_2 "-D_XOPEN_SOURCE=700")
endif()
- if(WIN32)
- if(ARCH_32_BITS)
- set(makecontext_CPPFLAGS "-DTEST_makecontext -D_I_X86_")
- else()
- set(makecontext_CPPFLAGS "-DTEST_makecontext -D_AMD64_")
- endif()
- set(makecontext_CPPFLAGS_2 "-D_XBT_WIN32 -I${CMAKE_HOME_DIRECTORY}/src/include -I${CMAKE_HOME_DIRECTORY}/src/xbt")
- endif()
-
file(REMOVE ${CMAKE_BINARY_DIR}/conftestval)
if(CMAKE_CROSSCOMPILING)
string(REPLACE "," "" makecontext_size "${MAKECONTEXT_SIZE}")
set(pth_skaddr_makecontext "#define pth_skaddr_makecontext(skaddr,sksize) (${makecontext_addr})")
set(pth_sksize_makecontext "#define pth_sksize_makecontext(skaddr,sksize) (${makecontext_size})")
- else()
- # message(FATAL_ERROR "makecontext is not compilable")
endif()
endif()
SIMGRID_VERSION_MINOR, \
SIMGRID_VERSION_PATCH)
-#cmakedefine _XBT_WIN32 @_XBT_WIN32@ /*this variable is set if it is a windows platform*/
-#cmakedefine _WIN32 @_WIN32@ /*this variable is set if it is a 32 bits windows platform*/
-#cmakedefine _WIN64 @_WIN64@ /*this variable is set if it is a 64 bits windows platform*/
-
/* Define to 1 if you have the <unistd.h> header file. */
#cmakedefine HAVE_UNISTD_H @HAVE_UNISTD_H@
// Use rejection in order to avoid skew
unsigned long x;
do {
-#ifndef _XBT_WIN32
+#ifndef _WIN32
x = (unsigned long) random();
#else
x = (unsigned long) rand();
#include "mc/mc.h"
-#ifndef _XBT_WIN32
+#ifndef _WIN32
#include <unistd.h>
#include <sys/wait.h>
#include <sys/time.h>
#include "xbt/base.h"
#include "xbt/misc.h"
-#ifdef _XBT_WIN32
+#ifdef _WIN32
# include <windows.h>
#endif
#include <fcntl.h>
-#ifdef _XBT_WIN32
+#ifdef _WIN32
#ifndef EWOULDBLOCK
#define EWOULDBLOCK WSAEWOULDBLOCK
#endif
#include <stdarg.h>
#include <ctype.h>
-#if defined(_XBT_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__TOS_WIN__)
+#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__TOS_WIN__)
# ifndef __STRICT_ANSI__
# include <io.h>
# include <process.h>
* down here because we want the user's section 1 to have been scanned first.
* The user has a chance to override it with an option.
*/
-#if defined(_XBT_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__TOS_WIN__)
+#if defined(_WIN32)
# ifndef __STRICT_ANSI__
# include <io.h>
# include <process.h>
xbt_cfg_register(&_sg_cfg_set, "contexts/guard_size",
"Guard size for contexts stacks in memory pages",
xbt_cfgelm_int, 1, 1, _sg_cfg_cb_context_guard_size);
-#if defined(_XBT_WIN32) || (PTH_STACKGROWTH != -1)
+#if defined(_WIN32) || (PTH_STACKGROWTH != -1)
xbt_cfg_setdefault_int(_sg_cfg_set, "contexts/guard_size", 0);
#else
xbt_cfg_setdefault_int(_sg_cfg_set, "contexts/guard_size", 1);
".text\n"
".globl _raw_makecontext\n"
"_raw_makecontext:\n"
-#elif defined(_XBT_WIN32)
+#elif defined(_WIN32)
".text\n"
".globl raw_makecontext\n"
"raw_makecontext:\n"
".text\n"
".globl _raw_swapcontext\n"
"_raw_swapcontext:\n"
-#elif defined(_XBT_WIN32)
+#elif defined(_WIN32)
".text\n"
".globl raw_swapcontext\n"
"raw_swapcontext:\n"
);
#elif PROCESSOR_i686
__asm__ (
-#if defined(APPLE) || defined(_XBT_WIN32)
+#if defined(APPLE) || defined(_WIN32)
".text\n"
".globl _raw_makecontext\n"
"_raw_makecontext:\n"
);
__asm__ (
-#if defined(APPLE) || defined(_XBT_WIN32)
+#if defined(APPLE) || defined(_WIN32)
".text\n"
".globl _raw_swapcontext\n"
"_raw_swapcontext:\n"
#include "simgrid/modelchecker.h"
-#ifdef _XBT_WIN32
+#ifdef _WIN32
#include <windows.h>
#include <malloc.h>
#else
if (smx_context_guard_size > 0 && !MC_is_active()) {
-#if defined(_XBT_WIN32) || (PTH_STACKGROWTH != -1)
+#if defined(_WIN32) || (PTH_STACKGROWTH != -1)
static int warned_once = 0;
if (!warned_once) {
XBT_WARN("Stack overflow protection is known to be broken on your system. Either you're on Windows or PTH_STACKGROWTH != -1 (current value is %d).",
char *alloc = (char*)xbt_malloc0(size + xbt_pagesize);
stack = alloc - ((uintptr_t)alloc & (xbt_pagesize - 1)) + xbt_pagesize;
*((void **)stack - 1) = alloc;
-#elif !defined(_XBT_WIN32)
+#elif !defined(_WIN32)
if (posix_memalign(&stack, xbt_pagesize, size) != 0)
xbt_die("Failed to allocate stack.");
#else
stack = _aligned_malloc(size, xbt_pagesize);
#endif
-#ifndef _XBT_WIN32
+#ifndef _WIN32
if (mprotect(stack, smx_context_guard_size, PROT_NONE) == -1) {
xbt_die("Failed to protect stack: %s", strerror(errno));
/* This is fatal. We are going to fail at some point when
VALGRIND_STACK_DEREGISTER(valgrind_stack_id);
#endif
-#ifndef WIN32
+#ifndef _WIN32
if (smx_context_guard_size > 0 && !MC_is_active()) {
stack = (char *)stack - smx_context_guard_size;
if (mprotect(stack, smx_context_guard_size,
#include <stdarg.h>
#include <ctype.h>
-#if defined(_XBT_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__TOS_WIN__)
+#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__TOS_WIN__)
# ifndef __STRICT_ANSI__
# include <io.h>
# include <process.h>
* down here because we want the user's section 1 to have been scanned first.
* The user has a chance to override it with an option.
*/
-#if defined(_XBT_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__TOS_WIN__)
+#if defined(_WIN32)
# ifndef __STRICT_ANSI__
# include <io.h>
# include <process.h>
if (!AX_surfxml_ASroute_src) FAIL("Required attribute `src' not set for `ASroute' element.");
LEAVE; STag_surfxml_ASroute(); surfxml_pcdata_ix = 0; ETag_surfxml_ASroute(); popbuffer(); /* attribute */
switch (YY_START) {
- case S_surfxml_AS: case S_surfxml_AS_3: case S_surfxml_AS_5: SET(S_surfxml_AS_6); break;
- case S_surfxml_AS_1: case S_surfxml_AS_4: case S_surfxml_AS_6: case S_surfxml_AS_7: case S_surfxml_AS_8: SET(S_surfxml_AS_8); break;
+ case S_surfxml_AS: case S_surfxml_AS_5: case S_surfxml_AS_6: SET(S_surfxml_AS_6); break;
+ case S_surfxml_AS_1: case S_surfxml_AS_3: case S_surfxml_AS_4: case S_surfxml_AS_7: case S_surfxml_AS_8: SET(S_surfxml_AS_8); break;
}
}
YY_BREAK
ETag_surfxml_ASroute();
popbuffer(); /* attribute */
switch (YY_START) {
- case S_surfxml_AS: case S_surfxml_AS_3: case S_surfxml_AS_5: SET(S_surfxml_AS_6); break;
- case S_surfxml_AS_1: case S_surfxml_AS_4: case S_surfxml_AS_6: case S_surfxml_AS_7: case S_surfxml_AS_8: SET(S_surfxml_AS_8); break;
+ case S_surfxml_AS: case S_surfxml_AS_5: case S_surfxml_AS_6: SET(S_surfxml_AS_6); break;
+ case S_surfxml_AS_1: case S_surfxml_AS_3: case S_surfxml_AS_4: case S_surfxml_AS_7: case S_surfxml_AS_8: SET(S_surfxml_AS_8); break;
}
}
YY_BREAK
# define HAVE_BACKTRACE 1 /* Hello linux box */
#endif
-#if defined(_XBT_WIN32) && defined(_M_IX86) && !defined(__GNUC__)
+#if defined(_WIN32) && defined(_M_IX86) && !defined(__GNUC__)
# define HAVE_BACKTRACE 1 /* Hello x86 windows box */
#endif
#if defined(HAVE_EXECINFO_H) && defined(HAVE_POPEN) && defined(ADDR2LINE)
# include "src/xbt/backtrace_linux.c"
-#elif (defined(_XBT_WIN32) && defined (_M_IX86)) && !defined(__GNUC__)
+#elif (defined(_WIN32) && defined (_M_IX86)) && !defined(__GNUC__)
# include "src/xbt/backtrace_windows.c"
#else
# include "src/xbt/backtrace_dummy.c"
#include <unistd.h>
#endif
-#ifndef _XBT_WIN32
+#ifndef _WIN32
#include <sys/syscall.h>
#endif
#define XBT_LOG_LOCALLY_DEFINE_XBT_CHANNEL /* MSVC don't want it to be declared extern in headers and local here */
#include "xbt/misc.h"
-#include "simgrid_config.h" /* _XBT_WIN32 */
+#include "simgrid_config.h"
#include "src/internal_config.h" /* MMALLOC_WANT_OVERRIDE_LEGACY */
#include "src/portable.h"
#include "xbt/sysdep.h"
#include "simgrid/sg_config.h"
#include <stdio.h>
-#ifdef _XBT_WIN32
-#include <signal.h>
+#ifdef _WIN32
+#include <signal.h> /* To silence MSVC on abort() */
#endif
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(module, xbt, "module handling");
static void xbt_preinit(void) _XBT_GNUC_CONSTRUCTOR(200);
static void xbt_postexit(void);
-#ifdef _XBT_WIN32
+#ifdef _WIN32
# undef _XBT_NEED_INIT_PRAGMA
#endif
#pragma init (xbt_preinit)
#endif
-#ifdef _XBT_WIN32
+#ifdef _WIN32
#include <windows.h>
#ifndef __GNUC__
-/* Dummy prototype to make gcc happy */
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason,
- LPVOID lpvReserved);
-
/* Should not be necessary but for some reason,
* DllMain is called twice at attachment and
* at detachment.*/
/* see also http://msdn.microsoft.com/en-us/library/ms682583%28VS.85%29.aspx */
/* and http://www.microsoft.com/whdc/driver/kernel/DLL_bestprac.mspx */
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason,
- LPVOID lpvReserved)
+static BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
if (fdwReason == DLL_PROCESS_ATTACH
&& xbt_dll_process_is_attached == 0) {
static void xbt_preinit(void) {
unsigned int seed = 2147483647;
-#ifndef _XBT_WIN32
+#ifndef _WIN32
xbt_pagesize = sysconf(_SC_PAGESIZE);
#else
SYSTEM_INFO si;
xbt_dict_preinit();
srand(seed);
-#ifndef _XBT_WIN32
+#ifndef _WIN32
srand48(seed);
#endif
atexit(xbt_postexit);
extern void __gcov_flush(void);
__gcov_flush();
#endif
-#ifdef _XBT_WIN32
+#ifdef _WIN32
/* It was said *in silence*. We don't want to see the error message printed
* by the Microsoft's implementation of abort(). */
raise(SIGABRT);
/* 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. */
-#ifndef _XBT_WIN32
+#include "src/internal_config.h"
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
set(string1 "'s/extern *\\([^(]*\\)\\( \\|\\( \\*\\)\\)/XBT_PUBLIC_DATA(\\1\\3) /'")
set(string2 "'s/XBT_PUBLIC_DATA(\\([^)]*\\)) *\\([^(]*\\)(/XBT_PUBLIC(\\1) \\2(/'")
set(string5 "'s/SET(DOCTYPE)/SET(ROOT_dax__adag)/'")
- set(string8 "'s/#if defined(_WIN32)/#if defined(_XBT_WIN32)/g'")
- set(string9 "'s/#include <unistd.h>/#if defined(_XBT_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__TOS_WIN__)\\n# ifndef __STRICT_ANSI__\\n# include <io.h>\\n# include <process.h>\\n# endif\\n#else\\n# include <unistd.h>\\n#endif/g'")
+ set(string9 "'s/#include <unistd.h>/#if defined(_WIN32)\\n# ifndef __STRICT_ANSI__\\n# include <io.h>\\n# include <process.h>\\n# endif\\n#else\\n# include <unistd.h>\\n#endif/g'")
set(string14 "'\\!^ \\* Generated [0-9/]\\{10\\} [0-9:]\\{8\\}\\.$$!d'")
set(string15 "'s/FAIL(\"Premature EOF/if(!ETag_surfxml_include_state()) FAIL(\"Premature EOF/'")
#surf/xml/simgrid_dtd.c: surf/xml/simgrid_dtd.l
COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_HOME_DIRECTORY}/src/surf/xml/simgrid_dtd.c
- COMMAND ${SED_EXE} -i ${string8} src/surf/xml/simgrid_dtd.l
COMMAND ${FLEX_EXE} -o src/surf/xml/simgrid_dtd.c -Psurf_parse_ --noline src/surf/xml/simgrid_dtd.l
COMMAND ${SED_EXE} -i ${string9} src/surf/xml/simgrid_dtd.c
COMMAND ${SED_EXE} -i ${string15} src/surf/xml/simgrid_dtd.c
#simdag/dax_dtd.c: simdag/dax_dtd.l
COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_HOME_DIRECTORY}/src/simdag/dax_dtd.c
- COMMAND ${SED_EXE} -i ${string8} src/simdag/dax_dtd.l
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_HOME_DIRECTORY}/src/simdag
COMMAND ${FLEX_EXE} -o src/simdag/dax_dtd.c -Pdax_ --noline src/simdag/dax_dtd.l
COMMAND ${SED_EXE} -i ${string9} src/simdag/dax_dtd.c
#ifndef _M_IX86
#cmakedefine _M_IX86 @_M_IX86@
#endif
-#cmakedefine _XBT_WIN32 @_XBT_WIN32@ // this variable is set if it is a windows platform
-#cmakedefine _WIN32 @_WIN32@ // this variable is set if it is a 32 bits windows platform
-#cmakedefine _WIN64 @_WIN64@ // this variable is set if it is a 64 bits windows platform
#cmakedefine APPLE @APPLE@
/* Set to true if enable_model-checking is true */
#cmakedefine MMALLOC_WANT_OVERRIDE_LEGACY @MMALLOC_WANT_OVERRIDE_LEGACY@
/* 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. */
-#ifndef _XBT_WIN32
-#include <unistd.h>
-#endif
-
#include "simgrid/msg.h"
#include "xbt/graph.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(graphicator,
- "Graphicator Logging System");
+XBT_LOG_NEW_DEFAULT_CATEGORY(graphicator, "Graphicator Logging System");
int main(int argc, char **argv)
{