Skip to content

Commit

Permalink
Fixed that -DDBUG_ASSERT_AS_PRINTF works again
Browse files Browse the repository at this point in the history
Note that this option was only designed to work on binaries
compiled without DBUG.
  • Loading branch information
montywi committed Aug 16, 2018
1 parent 8716bb3 commit 34c7222
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 16 deletions.
8 changes: 5 additions & 3 deletions sql/field.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7274,7 +7274,9 @@ int Field_string::cmp(const uchar *a_ptr, const uchar *b_ptr)

void Field_string::sort_string(uchar *to,uint length)
{
IF_DBUG(size_t tmp= ,)
#ifdef DBUG_ASSERT_EXISTS
size_t tmp=
#endif
field_charset->coll->strnxfrm(field_charset,
to, length,
char_length() *
Expand Down Expand Up @@ -7679,7 +7681,7 @@ void Field_varstring::sort_string(uchar *to,uint length)
length-= length_bytes;
}

#ifndef DBUG_OFF
#ifdef DBUG_ASSERT_EXISTS
size_t rc=
#endif
field_charset->coll->strnxfrm(field_charset, to, length,
Expand Down Expand Up @@ -8547,7 +8549,7 @@ void Field_blob::sort_string(uchar *to,uint length)
store_bigendian(buf.length(), to + length, packlength);
}

#ifndef DBUG_OFF
#ifdef DBUG_ASSERT_EXISTS
size_t rc=
#endif
field_charset->coll->strnxfrm(field_charset, to, length, length,
Expand Down
4 changes: 3 additions & 1 deletion sql/filesort.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1010,7 +1010,9 @@ Type_handler_string_result::make_sort_key(uchar *to, Item *item,

if (use_strnxfrm(cs))
{
IF_DBUG(size_t tmp_length= ,)
#ifdef DBUG_ASSERT_EXISTS
size_t tmp_length=
#endif
cs->coll->strnxfrm(cs, to, sort_field->length,
item->max_char_length() *
cs->strxfrm_multiply,
Expand Down
4 changes: 2 additions & 2 deletions sql/handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ KEY_CREATE_INFO default_key_create_info=
ulong total_ha= 0;
/* number of storage engines (from handlertons[]) that support 2pc */
ulong total_ha_2pc= 0;
#ifndef DBUG_OFF
#ifdef DBUG_ASSERT_EXISTS
/*
Number of non-mandatory 2pc handlertons whose initialization failed
to estimate total_ha_2pc value under supposition of the failures
Expand Down Expand Up @@ -661,7 +661,7 @@ int ha_initialize_handlerton(st_plugin_int *plugin)
(void) plugin->plugin->deinit(NULL);

err:
#ifndef DBUG_OFF
#ifdef DBUG_ASSERT_EXISTS
if (hton->prepare && hton->state == SHOW_OPTION_YES)
failed_ha_2pc++;
#endif
Expand Down
2 changes: 1 addition & 1 deletion sql/sql_select.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3757,7 +3757,7 @@ bool JOIN::save_explain_data(Explain_query *output, bool can_overwrite,
If there is SELECT in this statement with the same number it must be the
same SELECT
*/
DBUG_ASSERT(select_lex->select_number == UINT_MAX ||
DBUG_SLOW_ASSERT(select_lex->select_number == UINT_MAX ||
select_lex->select_number == INT_MAX ||
!output ||
!output->get_select(select_lex->select_number) ||
Expand Down
4 changes: 2 additions & 2 deletions storage/innobase/handler/ha_innodb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16065,7 +16065,7 @@ static
int
innodb_show_mutex_status(
handlerton*
#ifndef DBUG_OFF
#ifdef DBUG_ASSERT_EXISTS
hton
#endif
,
Expand Down Expand Up @@ -16096,7 +16096,7 @@ static
int
innodb_show_rwlock_status(
handlerton*
#ifndef DBUG_OFF
#ifdef DBUG_ASSERT_EXISTS
hton
#endif
,
Expand Down
12 changes: 6 additions & 6 deletions storage/innobase/handler/handler0alter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5350,14 +5350,14 @@ prepare_inplace_alter_table_dict(
= dict_table_get_nth_col(user_table, i));
ut_d(const dict_index_t* index
= user_table->indexes.start);
DBUG_ASSERT(col->mtype == old_col->mtype);
DBUG_ASSERT(col->prtype == old_col->prtype);
DBUG_ASSERT(col->mbminlen
DBUG_SLOW_ASSERT(col->mtype == old_col->mtype);
DBUG_SLOW_ASSERT(col->prtype == old_col->prtype);
DBUG_SLOW_ASSERT(col->mbminlen
== old_col->mbminlen);
DBUG_ASSERT(col->mbmaxlen
DBUG_SLOW_ASSERT(col->mbmaxlen
== old_col->mbmaxlen);
DBUG_ASSERT(col->len >= old_col->len);
DBUG_ASSERT(old_col->is_instant()
DBUG_SLOW_ASSERT(col->len >= old_col->len);
DBUG_SLOW_ASSERT(old_col->is_instant()
== (dict_col_get_clust_pos(
old_col, index)
>= index->n_core_fields));
Expand Down
2 changes: 1 addition & 1 deletion storage/innobase/trx/trx0undo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1444,7 +1444,7 @@ buf_block_t*
trx_undo_assign_low(trx_t* trx, trx_rseg_t* rseg, trx_undo_t** undo,
dberr_t* err, mtr_t* mtr)
{
const bool is_temp = rseg == trx->rsegs.m_noredo.rseg;
const bool is_temp __attribute__((unused)) = rseg == trx->rsegs.m_noredo.rseg;

ut_ad(rseg == trx->rsegs.m_redo.rseg
|| rseg == trx->rsegs.m_noredo.rseg);
Expand Down

0 comments on commit 34c7222

Please sign in to comment.