From: Jason Dillaman Date: Thu, 30 Apr 2015 17:26:41 +0000 (-0400) Subject: common: add valgrind.h convenience wrapper X-Git-Tag: v9.0.2~46^2~18 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=650ad32d74a24d248dd8e19bff1bbd31f0bb224b;p=ceph.git common: add valgrind.h convenience wrapper Conditionally support helgrind annotations if valgrind support is enabled during the build. Signed-off-by: Jason Dillaman --- diff --git a/configure.ac b/configure.ac index f4ac2cd1c78c..5b98fb4e06f0 100644 --- a/configure.ac +++ b/configure.ac @@ -1154,11 +1154,14 @@ AC_ARG_ENABLE([valgrind], [AS_HELP_STRING([--enable-valgrind], [enable valgrind unit tests])], [enable_valgrind=$enableval], [enable_valgrind=]) AC_CHECK_PROG(HAVE_VALGRIND, valgrind, yes) -AS_IF([test "x$HAVE_VALGRIND" = "x"], - AS_IF([test "x$enable_valgrind" = "xyes"], [AC_MSG_ERROR([valgrind not found])]), +AS_IF( + [test "x$HAVE_VALGRIND" = "x"], AS_IF([test "x$enable_valgrind" = "xyes"], [AC_MSG_ERROR([valgrind not found])]), [test "x$enable_valgrind" = "x"], [enable_valgrind=yes]) AM_CONDITIONAL([VALGRIND_ENABLED], [test "x$enable_valgrind" = "xyes"]) +if test "x$enable_valgrind" = "xyes"; then + AC_CHECK_HEADERS([valgrind/helgrind.h]) +fi dnl systemd-libexec-dir AC_SUBST(systemd_libexec_dir) diff --git a/src/common/Makefile.am b/src/common/Makefile.am index 785b94ba6339..8c985c7c09d9 100644 --- a/src/common/Makefile.am +++ b/src/common/Makefile.am @@ -233,7 +233,8 @@ noinst_HEADERS += \ common/Initialize.h \ common/ContextCompletion.h \ common/bit_vector.hpp \ - common/SubProcess.h + common/SubProcess.h \ + common/valgrind.h if ENABLE_XIO noinst_HEADERS += \ diff --git a/src/common/valgrind.h b/src/common/valgrind.h new file mode 100644 index 000000000000..2aa3fb5380ac --- /dev/null +++ b/src/common/valgrind.h @@ -0,0 +1,15 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab + +#ifndef CEPH_VALGRIND_H +#define CEPH_VALGRIND_H + +#ifdef HAVE_VALGRIND_HELGRIND_H + #include +#else + #define ANNOTATE_HAPPENS_AFTER(x) do {} while (0) + #define ANNOTATE_HAPPENS_BEFORE_FORGET_ALL(x) ANNOTATE_HAPPENS_AFTER(x) + #define ANNOTATE_HAPPENS_BEFORE(x) ANNOTATE_HAPPENS_AFTER(x) +#endif + +#endif // CEPH_VALGRIND_H