]> git.lizzy.rs Git - rust.git/commitdiff
rt: Clean up to build with cl.exe
authorAlex Crichton <alex@alexcrichton.com>
Mon, 11 May 2015 19:24:56 +0000 (12:24 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Tue, 19 May 2015 17:35:58 +0000 (10:35 -0700)
* 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.

src/rt/rust_builtin.c
src/rt/rust_test_helpers.c

index 362439c146912dae5f05ebcd51de749e8d90e22d..5939a5a3c90f5e5ea3df771387327c3240ce003a 100644 (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__)
index ac925e4260a5423ed98ab3a36ed604e0ef17fc43..8824cef2a816c153ea468796cebea190d99a91f6 100644 (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() {