diff --git a/src/rt/rust_builtin.c b/src/rt/rust_builtin.c index 362439c1469..5939a5a3c90 100644 --- a/src/rt/rust_builtin.c +++ b/src/rt/rust_builtin.c @@ -14,7 +14,8 @@ #include #include -#if !defined(__WIN32__) + +#if !defined(_WIN32) #include #include #include @@ -40,7 +41,9 @@ /* Foreign builtins. */ //include valgrind.h after stdint.h so that uintptr_t is defined for msys2 w64 +#ifndef _WIN32 #include "valgrind/valgrind.h" +#endif #ifndef _WIN32 char* @@ -84,12 +87,7 @@ rust_dirent_t_size() { } #endif -uintptr_t -rust_running_on_valgrind() { - return RUNNING_ON_VALGRIND; -} - -#if defined(__WIN32__) +#if defined(_WIN32) int get_num_cpus() { SYSTEM_INFO sysinfo; @@ -136,14 +134,13 @@ rust_get_num_cpus() { return get_num_cpus(); } -unsigned int -rust_valgrind_stack_register(void *start, void *end) { - return VALGRIND_STACK_REGISTER(start, end); -} - -void -rust_valgrind_stack_deregister(unsigned int id) { - VALGRIND_STACK_DEREGISTER(id); +uintptr_t +rust_running_on_valgrind() { +#ifdef _WIN32 + return 0; +#else + return RUNNING_ON_VALGRIND; +#endif } #if defined(__DragonFly__) diff --git a/src/rt/rust_test_helpers.c b/src/rt/rust_test_helpers.c index ac925e4260a..8824cef2a81 100644 --- a/src/rt/rust_test_helpers.c +++ b/src/rt/rust_test_helpers.c @@ -135,6 +135,8 @@ struct ManyInts { struct TwoU8s arg6; }; +// MSVC doesn't allow empty structs or unions +#ifndef _MSC_VER struct Empty { }; @@ -148,6 +150,7 @@ rust_dbg_extern_empty_struct(struct ManyInts v1, struct Empty e, struct ManyInts assert(v1.arg6.one == v2.arg6.one + 1); assert(v1.arg6.two == v2.arg6.two + 1); } +#endif intptr_t rust_get_test_int() {