rt: Clean up to build with cl.exe

* Detect the #define _MSC_VER in addition to __WIN32__
* Don't include valgrind.h for windows
* Remove unused `rust_valgrind_stack_{un,}register` functions
* Add stub definition for `rust_running_on_valgrind` for windows
* Conditionally define `rust_dbg_extern_empty_struct` as empty structures are
  not allowed by cl.exe apparently.
This commit is contained in:
Alex Crichton 2015-05-11 12:24:56 -07:00
parent 40570eb49e
commit cb513c7b46
2 changed files with 15 additions and 15 deletions

View File

@ -14,7 +14,8 @@
#include <assert.h>
#include <stdlib.h>
#if !defined(__WIN32__)
#if !defined(_WIN32)
#include <dirent.h>
#include <pthread.h>
#include <signal.h>
@ -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__)

View File

@ -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() {