Commit 14011ca4 by Andreas Jaeger

configure.in: Check for <memcheck.h>.

	* configure.in: Check for <memcheck.h>.
        * configure: Regenerated.

	* config.in: Define HAVE_MEMCHECK_H.

	* ggc-common.c: Use <memcheck.h> if available instead of
	<valgrind.h>.
	* ggc-page.c: Likewise.
	* cppfiles.c: Likewise.

From-SVN: r63788
parent 6b919a8a
...@@ -347,6 +347,9 @@ ...@@ -347,6 +347,9 @@
through valgrind (a memory checker). This is extremely expensive. */ through valgrind (a memory checker). This is extremely expensive. */
#undef ENABLE_VALGRIND_CHECKING #undef ENABLE_VALGRIND_CHECKING
/* Define if valgrind's memcheck.h header is installed. */
#undef HAVE_MEMCHECK_H
/* Define if you want to use __cxa_atexit, rather than atexit, to /* Define if you want to use __cxa_atexit, rather than atexit, to
register C++ destructors for local statics and global objects. register C++ destructors for local statics and global objects.
This is essential for fully standards-compliant handling of This is essential for fully standards-compliant handling of
......
...@@ -389,6 +389,15 @@ valgrind_command= ...@@ -389,6 +389,15 @@ valgrind_command=
if test x$ac_checking_valgrind != x ; then if test x$ac_checking_valgrind != x ; then
# It is certainly possible that there's valgrind but no valgrind.h. # It is certainly possible that there's valgrind but no valgrind.h.
# GCC relies on making annotations so we must have both. # GCC relies on making annotations so we must have both.
AC_MSG_CHECKING(for VALGRIND_DISCARD in <memcheck.h>)
AC_TRY_CPP(
[#include <memcheck.h>
#ifndef VALGRIND_DISCARD
#error VALGRIND_DISCARD not defined
#endif],
[gcc_cv_header_memcheck_h=yes],
gcc_cv_header_memcheck_h=no)
AC_MSG_RESULT($gcc_cv_header_memcheck_h)
AC_CHECK_HEADER(valgrind.h, have_valgrind_h=yes, have_valgrind_h=no) AC_CHECK_HEADER(valgrind.h, have_valgrind_h=yes, have_valgrind_h=no)
AM_PATH_PROG_WITH_TEST(valgrind_path, valgrind, AM_PATH_PROG_WITH_TEST(valgrind_path, valgrind,
[$ac_dir/$ac_word --version | grep valgrind- >/dev/null 2>&1]) [$ac_dir/$ac_word --version | grep valgrind- >/dev/null 2>&1])
...@@ -400,6 +409,10 @@ if test x$ac_checking_valgrind != x ; then ...@@ -400,6 +409,10 @@ if test x$ac_checking_valgrind != x ; then
AC_DEFINE(ENABLE_VALGRIND_CHECKING, 1, AC_DEFINE(ENABLE_VALGRIND_CHECKING, 1,
[Define if you want to run subprograms and generated programs [Define if you want to run subprograms and generated programs
through valgrind (a memory checker). This is extremely expensive.]) through valgrind (a memory checker). This is extremely expensive.])
if test $gcc_cv_header_memcheck_h = yes; then
AC_DEFINE(HAVE_MEMCHECK_H, 1,
[Define if valgrind's memcheck.h header is installed.])
fi
fi fi
AC_SUBST(valgrind_path_defines) AC_SUBST(valgrind_path_defines)
AC_SUBST(valgrind_command) AC_SUBST(valgrind_command)
......
...@@ -31,7 +31,11 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ ...@@ -31,7 +31,11 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "mkdeps.h" #include "mkdeps.h"
#include "splay-tree.h" #include "splay-tree.h"
#ifdef ENABLE_VALGRIND_CHECKING #ifdef ENABLE_VALGRIND_CHECKING
#include <valgrind.h> # ifdef HAVE_MEMCHECK_H
# include <memcheck.h>
# else
# include <valgrind.h>
# endif
#else #else
/* Avoid #ifdef:s when we can help it. */ /* Avoid #ifdef:s when we can help it. */
#define VALGRIND_DISCARD(x) #define VALGRIND_DISCARD(x)
......
/* Simple garbage collection for the GNU compiler. /* Simple garbage collection for the GNU compiler.
Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. Copyright (C) 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
This file is part of GCC. This file is part of GCC.
...@@ -38,7 +39,11 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -38,7 +39,11 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#endif #endif
#ifdef ENABLE_VALGRIND_CHECKING #ifdef ENABLE_VALGRIND_CHECKING
#include <valgrind.h> # ifdef HAVE_MEMCHECK_H
# include <memcheck.h>
# else
# include <valgrind.h>
# endif
#else #else
/* Avoid #ifdef:s when we can help it. */ /* Avoid #ifdef:s when we can help it. */
#define VALGRIND_DISCARD(x) #define VALGRIND_DISCARD(x)
......
...@@ -32,7 +32,11 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -32,7 +32,11 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "timevar.h" #include "timevar.h"
#include "params.h" #include "params.h"
#ifdef ENABLE_VALGRIND_CHECKING #ifdef ENABLE_VALGRIND_CHECKING
#include <valgrind.h> # ifdef HAVE_MEMCHECK_H
# include <memcheck.h>
# else
# include <valgrind.h>
# endif
#else #else
/* Avoid #ifdef:s when we can help it. */ /* Avoid #ifdef:s when we can help it. */
#define VALGRIND_DISCARD(x) #define VALGRIND_DISCARD(x)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment