simplify the valgrind client request helpers

the macros where used to make the influence of the valgrind calls zero
even for debug builds if valgrind client requests were
unavailable. Since this resulted in some inconsistencies, and the
performance hit is not terribly large, we now always use the same
inlined functions. For optimized builds the impact of those is still
zero...
This commit is contained in:
Andreas Lauser
2013-12-14 12:03:44 +01:00
parent 249592a57d
commit 78a30208d8

View File

@@ -20,29 +20,16 @@
*/
/*!
* \file
* \brief Some templates to wrap the valgrind macros
* \brief Some templates to wrap the valgrind client request macros
*/
#ifndef OPM_VALGRIND_HPP
#define OPM_VALGRIND_HPP
#include <opm/core/utility/Unused.hpp>
#if ! HAVE_VALGRIND && ! defined(DOXYGEN)
namespace Valgrind
{
inline bool boolBlubb(bool value) { return value; }
inline void voidBlubb() { }
#define SetUndefined(t) voidBlubb()
#define SetDefined(t) voidBlubb()
#define CheckDefined(t) boolBlubb(true)
#define SetNoAccess(t) voidBlubb()
#define IsRunning() boolBlubb(false)
} // namespace Valgrind
#else
#if HAVE_VALGRIND
#include <valgrind/memcheck.h>
#endif
namespace Valgrind
{
@@ -59,7 +46,6 @@ inline bool IsRunning()
#endif
}
/*!
* \ingroup Valgrind
* \brief Make valgrind complain if any of the memory occupied by an object
@@ -94,10 +80,10 @@ inline bool CheckDefined(const T &value)
return true;
#endif
}
/*!
* \ingroup Valgrind
*
* * \brief Make valgrind complain if any of the the memory occupied
* \brief Make valgrind complain if any of the the memory occupied
* by a C-style array objects is undefined.
*
* Please note that this does not check whether the destinations of an
@@ -285,5 +271,3 @@ inline void SetNoAccess(const T *value, int size)
} // namespace Valgrind
#endif
#endif