Commit db39910f authored by Sergei Golubchik's avatar Sergei Golubchik

disable safemalloc for valgrind builds.

always try to use valgrind headers in debug builds.
define HAVE_valgrind for --with-valgrind
fix valgrind check in my_valgrind.h
parent 925942e7
...@@ -148,7 +148,6 @@ fi ...@@ -148,7 +148,6 @@ fi
# Override -DFORCE_INIT_OF_VARS from debug_cflags. It enables the macro # Override -DFORCE_INIT_OF_VARS from debug_cflags. It enables the macro
# LINT_INIT(), which is only useful for silencing spurious warnings # LINT_INIT(), which is only useful for silencing spurious warnings
# of static analysis tools. We want LINT_INIT() to be a no-op in Valgrind. # of static analysis tools. We want LINT_INIT() to be a no-op in Valgrind.
valgrind_flags="-DHAVE_valgrind -DHAVE_purify -USAFEMALLOC"
valgrind_flags="$valgrind_flags -UFORCE_INIT_OF_VARS -Wno-uninitialized" valgrind_flags="$valgrind_flags -UFORCE_INIT_OF_VARS -Wno-uninitialized"
valgrind_flags="$valgrind_flags -DMYSQL_SERVER_SUFFIX=-valgrind-max" valgrind_flags="$valgrind_flags -DMYSQL_SERVER_SUFFIX=-valgrind-max"
valgrind_configs="--with-valgrind" valgrind_configs="--with-valgrind"
......
...@@ -197,7 +197,7 @@ ENDIF() ...@@ -197,7 +197,7 @@ ENDIF()
IF(WITH_SAFEMALLOC MATCHES "ON") IF(WITH_SAFEMALLOC MATCHES "ON")
ADD_DEFINITIONS( -DSAFEMALLOC ${DUSE_MYSYS_NEW}) ADD_DEFINITIONS( -DSAFEMALLOC ${DUSE_MYSYS_NEW})
ELSEIF(WITH_SAFEMALLOC MATCHES "AUTO" AND NOT WIN32) ELSEIF(WITH_SAFEMALLOC MATCHES "AUTO" AND NOT WIN32 AND NOT WITH_VALGRIND)
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC ${DUSE_MYSYS_NEW}") SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC ${DUSE_MYSYS_NEW}")
ENDIF() ENDIF()
......
...@@ -313,7 +313,11 @@ ...@@ -313,7 +313,11 @@
#define USE_MB 1 #define USE_MB 1
#define USE_MB_IDENT 1 #define USE_MB_IDENT 1
#cmakedefine HAVE_VALGRIND /* this means that valgrind headers and macros are available */
#cmakedefine HAVE_VALGRIND 1
/* this means WITH_VALGRIND - we change some code paths for valgrind */
#cmakedefine HAVE_valgrind 1
/* Types we may use */ /* Types we may use */
#ifdef __APPLE__ #ifdef __APPLE__
......
...@@ -1024,13 +1024,12 @@ if available and 'smp' configuration otherwise.") ...@@ -1024,13 +1024,12 @@ if available and 'smp' configuration otherwise.")
MARK_AS_ADVANCED(WITH_ATOMIC_LOCKS MY_ATOMIC_MODE_RWLOCK MY_ATOMIC_MODE_DUMMY) MARK_AS_ADVANCED(WITH_ATOMIC_LOCKS MY_ATOMIC_MODE_RWLOCK MY_ATOMIC_MODE_DUMMY)
IF(WITH_VALGRIND) IF(WITH_VALGRIND)
CHECK_INCLUDE_FILES("valgrind/memcheck.h;valgrind/valgrind.h" SET(HAVE_valgrind 1)
HAVE_VALGRIND_HEADERS)
IF(HAVE_VALGRIND_HEADERS)
SET(HAVE_VALGRIND 1)
ENDIF()
ENDIF() ENDIF()
CHECK_INCLUDE_FILES("valgrind/memcheck.h;valgrind/valgrind.h"
HAVE_VALGRIND)
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Check for IPv6 support # Check for IPv6 support
#-------------------------------------------------------------------- #--------------------------------------------------------------------
......
...@@ -89,12 +89,6 @@ ...@@ -89,12 +89,6 @@
#define IF_WIN(A,B) B #define IF_WIN(A,B) B
#endif #endif
#ifdef HAVE_purify
#define IF_PURIFY(A,B) A
#else
#define IF_PURIFY(A,B) B
#endif
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
#ifdef WITH_NDB_BINLOG #ifdef WITH_NDB_BINLOG
#define HAVE_NDB_BINLOG 1 #define HAVE_NDB_BINLOG 1
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#define IF_VALGRIND(A,B) B #define IF_VALGRIND(A,B) B
#endif #endif
#if defined(HAVE_VALGRIND) && defined(HAVE_VALGRIND_MEMCHECK_H) #if defined(HAVE_VALGRIND)
# include <valgrind/memcheck.h> # include <valgrind/memcheck.h>
# define MEM_UNDEFINED(a,len) VALGRIND_MAKE_MEM_UNDEFINED(a,len) # define MEM_UNDEFINED(a,len) VALGRIND_MAKE_MEM_UNDEFINED(a,len)
# define MEM_NOACCESS(a,len) VALGRIND_MAKE_MEM_NOACCESS(a,len) # define MEM_NOACCESS(a,len) VALGRIND_MAKE_MEM_NOACCESS(a,len)
......
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