move the Valgrind doc-comments to Rust-land, where they actually matter

This commit is contained in:
edef 2015-04-15 22:41:34 -04:00
parent 14887b4dd0
commit 476a63b817
2 changed files with 10 additions and 10 deletions

View File

@ -1,22 +1,12 @@
#include <stdint.h> #include <stdint.h>
#include "valgrind/valgrind.h" #include "valgrind/valgrind.h"
// In order for Valgrind to keep track of stack overflows and such, it needs
// a little help. That help unfortunately comes in the form of a pair of C
// macros. Calling out to un-inlineable C code for this is pointlessly slow,
// but that's the way it is for now.
typedef uint32_t valgrind_stack_id_t; typedef uint32_t valgrind_stack_id_t;
// Register a stack with Valgrind. Returns an integer ID that can
// be used to deregister the stack when it's deallocated.
// `start < end`, though Valgrind will happily accept either.
valgrind_stack_id_t valgrind_stack_register(const void *start, const void *end) { valgrind_stack_id_t valgrind_stack_register(const void *start, const void *end) {
return VALGRIND_STACK_REGISTER(start, end); return VALGRIND_STACK_REGISTER(start, end);
} }
// Deregister a stack from Valgrind. Takes the integer ID that was returned
// on registration.
void valgrind_stack_deregister(valgrind_stack_id_t id) { void valgrind_stack_deregister(valgrind_stack_id_t id) {
VALGRIND_STACK_DEREGISTER(id); VALGRIND_STACK_DEREGISTER(id);
} }

View File

@ -1,9 +1,19 @@
#![allow(non_camel_case_types)] #![allow(non_camel_case_types)]
//! In order for Valgrind to keep track of stack overflows and such, it needs
//! a little help. That help unfortunately comes in the form of a pair of C
//! macros. Calling out to un-inlineable C code for this is pointlessly slow,
//! but that's the way it is for now.
pub type stack_id_t = u32; pub type stack_id_t = u32;
extern "C" { extern "C" {
#[link_name = "valgrind_stack_register"] #[link_name = "valgrind_stack_register"]
/// Register a stack with Valgrind. Returns an integer ID that can
/// be used to deregister the stack when it's deallocated.
/// `start < end`, though Valgrind will happily accept either.
pub fn stack_register(start: *const u8, end: *const u8) -> stack_id_t; pub fn stack_register(start: *const u8, end: *const u8) -> stack_id_t;
#[link_name = "valgrind_stack_deregister"] #[link_name = "valgrind_stack_deregister"]
/// Deregister a stack from Valgrind. Takes the integer ID that was returned
/// on registration.
pub fn stack_deregister(id: stack_id_t); pub fn stack_deregister(id: stack_id_t);
} }