valgrind.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <ivorium_config.hpp>
4 #include <cassert>
5 
6 #if IV_ENABLE_VALGRIND
7  #include <valgrind/memcheck.h>
8  #define IV_MEMCHECK( X ) VALGRIND_CHECK_VALUE_IS_DEFINED( X )
9  #define IV_NULLCHECK( X ) IV_NullcheckFn( (void*)X )
10 #else
11  #define IV_MEMCHECK( X )
12  #define IV_NULLCHECK( X ) do{}while(0)
13 #endif
14 
15 
16 inline void IV_NullcheckFn( void * x )
17 {
18  assert( x != nullptr );
19 }