summary refs log tree commit diff
path: root/src/rt/arch
diff options
context:
space:
mode:
authorAustin Seipp <as@hacks.yi.org>2011-12-06 01:11:11 -0600
committerAustin Seipp <as@hacks.yi.org>2011-12-06 01:15:29 -0600
commitb513a5a5001b850a153db12d9621d00a70ff929a (patch)
tree83f22cf7a06a30d827ddea7e9b537aeabfc8d7de /src/rt/arch
parent8d8148f1f740ce80a07a19830cfae8a1851a7c4f (diff)
downloadrust-b513a5a5001b850a153db12d9621d00a70ff929a.tar.gz
rust-b513a5a5001b850a153db12d9621d00a70ff929a.zip
Make valgrind usage more consistent and less error prone.
I was still having issues with the build system somehow getting confused
as to which set of valgrind headers to use when compiling rt.

This commit moves all the valgrind headers into their own directory
under rt and makes the usage more consistent. The compiler is now passed
the -DNVALGRIND flag when valgrind is not installed, as opposed to
passing -DHAVE_VALGRIND.

We also pass -I src/rt to the compiler when building rt so you can more
easily import what you want. I also cleaned up some erroneous #includes
along the way.

It should be safe to always just import the local valgrind headers and use
them without question. NVALGRIND turns the operations to no-ops when it
is active, and the build and tests run cleanly with or without.
Diffstat (limited to 'src/rt/arch')
-rw-r--r--src/rt/arch/i386/context.h4
-rw-r--r--src/rt/arch/x86_64/context.h6
2 files changed, 2 insertions, 8 deletions
diff --git a/src/rt/arch/i386/context.h b/src/rt/arch/i386/context.h
index fc5eb900a5c..03b97fa7b51 100644
--- a/src/rt/arch/i386/context.h
+++ b/src/rt/arch/i386/context.h
@@ -7,7 +7,7 @@
 #include <inttypes.h>
 #include <stdint.h>
 
-#include "../../memcheck.h"
+#include "vg/memcheck.h"
 
 template<typename T>
 T align_down(T sp)
@@ -51,9 +51,7 @@ public:
     uint32_t bot = regs.esp;
     uint32_t top = align_down(bot - nbytes);
 
-#ifdef HAVE_VALGRIND
     (void)VALGRIND_MAKE_MEM_UNDEFINED(top - 4, bot - top + 4);
-#endif
 
     return reinterpret_cast<void *>(top);
   }
diff --git a/src/rt/arch/x86_64/context.h b/src/rt/arch/x86_64/context.h
index 11c85092747..59d7bfa51f3 100644
--- a/src/rt/arch/x86_64/context.h
+++ b/src/rt/arch/x86_64/context.h
@@ -8,9 +8,7 @@
 #include <stdint.h>
 #include <xmmintrin.h>
 
-#ifdef HAVE_VALGRIND
-#include <valgrind/memcheck.h>
-#endif
+#include "vg/memcheck.h"
 
 template<typename T>
 T align_down(T sp)
@@ -51,9 +49,7 @@ public:
         uint64_t bot = regs.data[RUSTRT_RSP];
         uint64_t top = align_down(bot - nbytes);
 
-#ifdef HAVE_VALGRIND
         (void)VALGRIND_MAKE_MEM_UNDEFINED(top - 4, bot - top + 4);
-#endif
 
         return reinterpret_cast<void *>(top);
     }