Skip to content
Snippets Groups Projects
Commit b4082436 authored by Martin Stjernholm's avatar Martin Stjernholm
Browse files

Fixed case when valgrind is available but its header files aren't.

Rev: src/pike_memory.h:1.52
parent 1bf4198e
Branches
Tags
No related merge requests found
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
|| This file is part of Pike. For copyright information see COPYRIGHT. || This file is part of Pike. For copyright information see COPYRIGHT.
|| Pike is distributed under GPL, LGPL and MPL. See the file COPYING || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
|| for more information. || for more information.
|| $Id: pike_memory.h,v 1.51 2005/05/25 16:59:39 grubba Exp $ || $Id: pike_memory.h,v 1.52 2006/07/02 00:05:45 mast Exp $
*/ */
#ifndef MEMORY_H #ifndef MEMORY_H
...@@ -13,14 +13,24 @@ ...@@ -13,14 +13,24 @@
#ifdef USE_VALGRIND #ifdef USE_VALGRIND
#define HAVE_VALGRIND_MACROS
/* Assume that any of the following header files have the macros we
* need. Haven't checked if it's true or not. */
#ifdef HAVE_MEMCHECK_H #ifdef HAVE_MEMCHECK_H
#include <memcheck.h> #include <memcheck.h>
#elif defined(HAVE_VALGRIND_MEMCHECK_H) #elif defined(HAVE_VALGRIND_MEMCHECK_H)
#include <valgrind/memcheck.h> #include <valgrind/memcheck.h>
#elif defined(HAVE_VALGRIND_H) #elif defined(HAVE_VALGRIND_H)
#include <valgrind.h> #include <valgrind.h>
#else
#undef HAVE_VALGRIND_MACROS
#endif #endif
#endif /* USE_VALGRIND */
#ifdef HAVE_VALGRIND_MACROS
/* No Access */ /* No Access */
#define PIKE_MEM_NA(lvalue) do { \ #define PIKE_MEM_NA(lvalue) do { \
PIKE_MEM_NA_RANGE(&(lvalue), sizeof (lvalue)); \ PIKE_MEM_NA_RANGE(&(lvalue), sizeof (lvalue)); \
...@@ -56,7 +66,7 @@ ...@@ -56,7 +66,7 @@
/* Return true if a memchecker is in use. */ /* Return true if a memchecker is in use. */
#define PIKE_MEM_CHECKER() RUNNING_ON_VALGRIND #define PIKE_MEM_CHECKER() RUNNING_ON_VALGRIND
#else #else /* !HAVE_VALGRIND_MACROS */
#define PIKE_MEM_NA(lvalue) do {} while (0) #define PIKE_MEM_NA(lvalue) do {} while (0)
#define PIKE_MEM_NA_RANGE(addr, bytes) do {} while (0) #define PIKE_MEM_NA_RANGE(addr, bytes) do {} while (0)
...@@ -68,7 +78,7 @@ ...@@ -68,7 +78,7 @@
#define PIKE_MEM_RO_RANGE(addr, bytes) do {} while (0) #define PIKE_MEM_RO_RANGE(addr, bytes) do {} while (0)
#define PIKE_MEM_CHECKER() 0 #define PIKE_MEM_CHECKER() 0
#endif /* USE_VALGRIND */ #endif /* !HAVE_VALGRIND_MACROS */
#define MEMSEARCH_LINKS 512 #define MEMSEARCH_LINKS 512
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment