mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
MEM_CHECK_DEFINED: replace HAVE_valgrind
HAVE_valgrind_or_MSAN to HAVE_valgrind was incorrect inaf784385b4
. In my_valgrind.h when clang exists (hence no __has_feature(memory_sanitizer), and -DWITH_VALGRIND=1, but without memcheck.h, we end up with a MEM_CHECK_DEFINED being empty. If we are also doing a CMAKE_BUILD_TYPE=Debug this results a number of [-Werror,-Wunused-variable] errors because MEM_CHECK_DEFINED is empty. With MEM_CHECK_DEFINED empty, there becomes no uses of this of the fixed field and innodb variables in this patch. So we stop using HAVE_valgrind as catchall and use the name HAVE_CHECK_MEM to indicate that a CHECK_MEM_DEFINED function exists. Reviewer: Monty Corrects:af784385b4
This commit is contained in:
parent
e731a28394
commit
bcb9ca4105
5 changed files with 12 additions and 10 deletions
|
@ -27,6 +27,7 @@
|
|||
#if __has_feature(memory_sanitizer)
|
||||
# include <sanitizer/msan_interface.h>
|
||||
# define HAVE_valgrind
|
||||
# define HAVE_MEM_CHECK
|
||||
# define MEM_UNDEFINED(a,len) __msan_allocated_memory(a,len)
|
||||
# define MEM_MAKE_ADDRESSABLE(a,len) MEM_UNDEFINED(a,len)
|
||||
# define MEM_MAKE_DEFINED(a,len) __msan_unpoison(a,len)
|
||||
|
@ -38,6 +39,7 @@
|
|||
# define REDZONE_SIZE 8
|
||||
#elif defined(HAVE_VALGRIND_MEMCHECK_H) && defined(HAVE_valgrind)
|
||||
# include <valgrind/memcheck.h>
|
||||
# define HAVE_MEM_CHECK
|
||||
# define MEM_UNDEFINED(a,len) VALGRIND_MAKE_MEM_UNDEFINED(a,len)
|
||||
# define MEM_MAKE_ADDRESSABLE(a,len) MEM_UNDEFINED(a,len)
|
||||
# define MEM_MAKE_DEFINED(a,len) VALGRIND_MAKE_MEM_DEFINED(a,len)
|
||||
|
|
|
@ -7854,7 +7854,7 @@ bool Field_varstring::send(Protocol *protocol)
|
|||
}
|
||||
|
||||
|
||||
#ifdef HAVE_valgrind
|
||||
#ifdef HAVE_MEM_CHECK
|
||||
void Field_varstring::mark_unused_memory_as_defined()
|
||||
{
|
||||
uint used_length= get_length();
|
||||
|
|
|
@ -998,7 +998,7 @@ public:
|
|||
*/
|
||||
virtual int store_from_statistical_minmax_field(Field *field, String *str);
|
||||
|
||||
#ifdef HAVE_valgrind
|
||||
#ifdef HAVE_MEM_CHECK
|
||||
/**
|
||||
Mark unused memory in the field as defined. Mainly used to ensure
|
||||
that if we write full field to disk (for example in
|
||||
|
@ -4161,7 +4161,7 @@ public:
|
|||
}
|
||||
int store(const char *to,size_t length,CHARSET_INFO *charset) override;
|
||||
using Field_str::store;
|
||||
#ifdef HAVE_valgrind
|
||||
#ifdef HAVE_MEM_CHECK
|
||||
void mark_unused_memory_as_defined() override;
|
||||
#endif
|
||||
double val_real() override;
|
||||
|
|
|
@ -637,14 +637,14 @@ Use MONITOR_DEC if appropriate mutex protection exists.
|
|||
} \
|
||||
}
|
||||
|
||||
#ifdef HAVE_valgrind
|
||||
#ifdef HAVE_MEM_CHECK
|
||||
# define MONITOR_CHECK_DEFINED(value) do { \
|
||||
mon_type_t m = value; \
|
||||
MEM_CHECK_DEFINED(&m, sizeof m); \
|
||||
} while (0)
|
||||
#else /* HAVE_valgrind */
|
||||
#else /* HAVE_MEM_CHECK */
|
||||
# define MONITOR_CHECK_DEFINED(value) (void) 0
|
||||
#endif /* HAVE_valgrind */
|
||||
#endif /* HAVE_MEM_CHECK */
|
||||
|
||||
#define MONITOR_INC_VALUE(monitor, value) \
|
||||
MONITOR_CHECK_DEFINED(value); \
|
||||
|
|
|
@ -1311,7 +1311,7 @@ page_cur_insert_rec_low(
|
|||
/* 1. Get the size of the physical record in the page */
|
||||
const ulint rec_size= rec_offs_size(offsets);
|
||||
|
||||
#ifdef HAVE_valgrind
|
||||
#ifdef HAVE_MEM_CHECK
|
||||
{
|
||||
const void *rec_start= rec - rec_offs_extra_size(offsets);
|
||||
ulint extra_size= rec_offs_extra_size(offsets) -
|
||||
|
@ -1323,7 +1323,7 @@ page_cur_insert_rec_low(
|
|||
/* The variable-length header must be valid. */
|
||||
MEM_CHECK_DEFINED(rec_start, extra_size);
|
||||
}
|
||||
#endif /* HAVE_valgrind */
|
||||
#endif /* HAVE_MEM_CHECK */
|
||||
|
||||
/* 2. Try to find suitable space from page memory management */
|
||||
bool reuse= false;
|
||||
|
@ -1717,7 +1717,7 @@ page_cur_insert_rec_zip(
|
|||
/* 1. Get the size of the physical record in the page */
|
||||
const ulint rec_size= rec_offs_size(offsets);
|
||||
|
||||
#ifdef HAVE_valgrind
|
||||
#ifdef HAVE_MEM_CHECK
|
||||
{
|
||||
const void *rec_start= rec - rec_offs_extra_size(offsets);
|
||||
ulint extra_size= rec_offs_extra_size(offsets) - REC_N_NEW_EXTRA_BYTES;
|
||||
|
@ -1726,7 +1726,7 @@ page_cur_insert_rec_zip(
|
|||
/* The variable-length header must be valid. */
|
||||
MEM_CHECK_DEFINED(rec_start, extra_size);
|
||||
}
|
||||
#endif /* HAVE_valgrind */
|
||||
#endif /* HAVE_MEM_CHECK */
|
||||
const bool reorg_before_insert= page_has_garbage(cursor->block->frame) &&
|
||||
rec_size > page_get_max_insert_size(cursor->block->frame, 1) &&
|
||||
rec_size <= page_get_max_insert_size_after_reorganize(cursor->block->frame,
|
||||
|
|
Loading…
Reference in a new issue