Skip to content

Commit 34c7222

Browse files
committed
Fixed that -DDBUG_ASSERT_AS_PRINTF works again
Note that this option was only designed to work on binaries compiled without DBUG.
1 parent 8716bb3 commit 34c7222

File tree

7 files changed

+20
-16
lines changed

7 files changed

+20
-16
lines changed

sql/field.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7274,7 +7274,9 @@ int Field_string::cmp(const uchar *a_ptr, const uchar *b_ptr)
72747274

72757275
void Field_string::sort_string(uchar *to,uint length)
72767276
{
7277-
IF_DBUG(size_t tmp= ,)
7277+
#ifdef DBUG_ASSERT_EXISTS
7278+
size_t tmp=
7279+
#endif
72787280
field_charset->coll->strnxfrm(field_charset,
72797281
to, length,
72807282
char_length() *
@@ -7679,7 +7681,7 @@ void Field_varstring::sort_string(uchar *to,uint length)
76797681
length-= length_bytes;
76807682
}
76817683

7682-
#ifndef DBUG_OFF
7684+
#ifdef DBUG_ASSERT_EXISTS
76837685
size_t rc=
76847686
#endif
76857687
field_charset->coll->strnxfrm(field_charset, to, length,
@@ -8547,7 +8549,7 @@ void Field_blob::sort_string(uchar *to,uint length)
85478549
store_bigendian(buf.length(), to + length, packlength);
85488550
}
85498551

8550-
#ifndef DBUG_OFF
8552+
#ifdef DBUG_ASSERT_EXISTS
85518553
size_t rc=
85528554
#endif
85538555
field_charset->coll->strnxfrm(field_charset, to, length, length,

sql/filesort.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,9 @@ Type_handler_string_result::make_sort_key(uchar *to, Item *item,
10101010

10111011
if (use_strnxfrm(cs))
10121012
{
1013-
IF_DBUG(size_t tmp_length= ,)
1013+
#ifdef DBUG_ASSERT_EXISTS
1014+
size_t tmp_length=
1015+
#endif
10141016
cs->coll->strnxfrm(cs, to, sort_field->length,
10151017
item->max_char_length() *
10161018
cs->strxfrm_multiply,

sql/handler.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ KEY_CREATE_INFO default_key_create_info=
7474
ulong total_ha= 0;
7575
/* number of storage engines (from handlertons[]) that support 2pc */
7676
ulong total_ha_2pc= 0;
77-
#ifndef DBUG_OFF
77+
#ifdef DBUG_ASSERT_EXISTS
7878
/*
7979
Number of non-mandatory 2pc handlertons whose initialization failed
8080
to estimate total_ha_2pc value under supposition of the failures
@@ -661,7 +661,7 @@ int ha_initialize_handlerton(st_plugin_int *plugin)
661661
(void) plugin->plugin->deinit(NULL);
662662

663663
err:
664-
#ifndef DBUG_OFF
664+
#ifdef DBUG_ASSERT_EXISTS
665665
if (hton->prepare && hton->state == SHOW_OPTION_YES)
666666
failed_ha_2pc++;
667667
#endif

sql/sql_select.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3757,7 +3757,7 @@ bool JOIN::save_explain_data(Explain_query *output, bool can_overwrite,
37573757
If there is SELECT in this statement with the same number it must be the
37583758
same SELECT
37593759
*/
3760-
DBUG_ASSERT(select_lex->select_number == UINT_MAX ||
3760+
DBUG_SLOW_ASSERT(select_lex->select_number == UINT_MAX ||
37613761
select_lex->select_number == INT_MAX ||
37623762
!output ||
37633763
!output->get_select(select_lex->select_number) ||

storage/innobase/handler/ha_innodb.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16065,7 +16065,7 @@ static
1606516065
int
1606616066
innodb_show_mutex_status(
1606716067
handlerton*
16068-
#ifndef DBUG_OFF
16068+
#ifdef DBUG_ASSERT_EXISTS
1606916069
hton
1607016070
#endif
1607116071
,
@@ -16096,7 +16096,7 @@ static
1609616096
int
1609716097
innodb_show_rwlock_status(
1609816098
handlerton*
16099-
#ifndef DBUG_OFF
16099+
#ifdef DBUG_ASSERT_EXISTS
1610016100
hton
1610116101
#endif
1610216102
,

storage/innobase/handler/handler0alter.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5350,14 +5350,14 @@ prepare_inplace_alter_table_dict(
53505350
= dict_table_get_nth_col(user_table, i));
53515351
ut_d(const dict_index_t* index
53525352
= user_table->indexes.start);
5353-
DBUG_ASSERT(col->mtype == old_col->mtype);
5354-
DBUG_ASSERT(col->prtype == old_col->prtype);
5355-
DBUG_ASSERT(col->mbminlen
5353+
DBUG_SLOW_ASSERT(col->mtype == old_col->mtype);
5354+
DBUG_SLOW_ASSERT(col->prtype == old_col->prtype);
5355+
DBUG_SLOW_ASSERT(col->mbminlen
53565356
== old_col->mbminlen);
5357-
DBUG_ASSERT(col->mbmaxlen
5357+
DBUG_SLOW_ASSERT(col->mbmaxlen
53585358
== old_col->mbmaxlen);
5359-
DBUG_ASSERT(col->len >= old_col->len);
5360-
DBUG_ASSERT(old_col->is_instant()
5359+
DBUG_SLOW_ASSERT(col->len >= old_col->len);
5360+
DBUG_SLOW_ASSERT(old_col->is_instant()
53615361
== (dict_col_get_clust_pos(
53625362
old_col, index)
53635363
>= index->n_core_fields));

storage/innobase/trx/trx0undo.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1444,7 +1444,7 @@ buf_block_t*
14441444
trx_undo_assign_low(trx_t* trx, trx_rseg_t* rseg, trx_undo_t** undo,
14451445
dberr_t* err, mtr_t* mtr)
14461446
{
1447-
const bool is_temp = rseg == trx->rsegs.m_noredo.rseg;
1447+
const bool is_temp __attribute__((unused)) = rseg == trx->rsegs.m_noredo.rseg;
14481448

14491449
ut_ad(rseg == trx->rsegs.m_redo.rseg
14501450
|| rseg == trx->rsegs.m_noredo.rseg);

0 commit comments

Comments
 (0)