mirror of
https://github.com/MariaDB/server.git
synced 2025-04-18 21:44:20 +03:00
Tag push_warning_printf
with ATTRIBUTE_FORMAT
* Let GCC `-Wformat` check formats sent to these `my_vsnprintf_ex` users * Migrate them from the old extension specifiers to the new `-Wformat`-compatible suffixes
This commit is contained in:
parent
2047483417
commit
d5ba6f71b9
16
sql/field.cc
16
sql/field.cc
@ -11490,9 +11490,9 @@ void Field::raise_note_cannot_use_key_part(THD *thd,
|
||||
const LEX_CSTRING colv(op_collation->coll_name);
|
||||
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
|
||||
ER_UNKNOWN_ERROR,
|
||||
"Cannot use key %`.*s part[%u] for lookup: "
|
||||
"%`.*s.%`.*s.%`.*s of collation %`.*s "
|
||||
"%.*s \"%.*T\" of collation %`.*s",
|
||||
"Cannot use key %.*sQ part[%u] for lookup: "
|
||||
"%.*sQ.%.*sQ.%.*sQ of collation %.*sQ "
|
||||
"%.*s \"%.*sT\" of collation %.*sQ",
|
||||
(int) keyname.length, keyname.str,
|
||||
part,
|
||||
(int) table->s->db.length, table->s->db.str,
|
||||
@ -11514,9 +11514,9 @@ void Field::raise_note_cannot_use_key_part(THD *thd,
|
||||
const LEX_CSTRING dtypev(value->type_handler()->name().lex_cstring());
|
||||
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
|
||||
ER_UNKNOWN_ERROR,
|
||||
"Cannot use key %`.*s part[%u] for lookup: "
|
||||
"%`.*s.%`.*s.%`.*s of type %`.*s "
|
||||
"%.*s \"%.*T\" of type %`.*s",
|
||||
"Cannot use key %.*sQ part[%u] for lookup: "
|
||||
"%.*sQ.%.*sQ.%.*sQ of type %.*sQ "
|
||||
"%.*s \"%.*sT\" of type %.*sQ",
|
||||
(int) keyname.length, keyname.str,
|
||||
part,
|
||||
(int) table->s->db.length, table->s->db.str,
|
||||
@ -11544,8 +11544,8 @@ void Field::raise_note_key_become_unused(THD *thd, const String &expr) const
|
||||
{
|
||||
push_warning_printf(thd,
|
||||
Sql_condition::WARN_LEVEL_NOTE, ER_UNKNOWN_ERROR,
|
||||
"Cannot use key parts with %`.*s.%`.*s.%`.*s "
|
||||
"in the rewritten condition: %`.*s",
|
||||
"Cannot use key parts with %.*sQ.%.*sQ.%.*sQ "
|
||||
"in the rewritten condition: %.*sQ",
|
||||
(int) table->s->db.length, table->s->db.str,
|
||||
(int) table->s->table_name.length, table->s->table_name.str,
|
||||
(int) field_name.length, field_name.str,
|
||||
|
@ -793,7 +793,7 @@ bool Item_subselect::exec()
|
||||
QT_WITHOUT_INTRODUCERS));
|
||||
|
||||
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
|
||||
ER_UNKNOWN_ERROR, "DBUG: Item_subselect::exec %.*b",
|
||||
ER_UNKNOWN_ERROR, "DBUG: Item_subselect::exec %.*sB",
|
||||
print.length(),print.ptr());
|
||||
);
|
||||
/*
|
||||
|
@ -131,9 +131,9 @@ String *Item_func_vec_totext::val_str_ascii(String *str)
|
||||
if (r1->length() % 4)
|
||||
{
|
||||
THD *thd= current_thd;
|
||||
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
|
||||
ER_VECTOR_BINARY_FORMAT_INVALID,
|
||||
ER_THD(thd, ER_VECTOR_BINARY_FORMAT_INVALID));
|
||||
push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
|
||||
ER_VECTOR_BINARY_FORMAT_INVALID,
|
||||
ER_THD(thd, ER_VECTOR_BINARY_FORMAT_INVALID));
|
||||
null_value= true;
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -287,7 +287,7 @@ void print_vcol_subst_warning(THD *thd, Field *field, Item *expr,
|
||||
ER_UNKNOWN_ERROR,
|
||||
"Cannot substitute virtual column expression %*s -> %*s "
|
||||
"due to %s",
|
||||
expr_length, expr_buffer.c_ptr_safe(),
|
||||
(int) expr_length, expr_buffer.c_ptr_safe(),
|
||||
(int) field->field_name.length, field->field_name.str,
|
||||
cause);
|
||||
}
|
||||
|
@ -1884,7 +1884,7 @@ bool Sql_cmd_delete::prepare_inner(THD *thd)
|
||||
{
|
||||
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
|
||||
WARN_INDEX_HINTS_IGNORED,
|
||||
ER_THD(thd, WARN_INDEX_HINTS_IGNORED));
|
||||
"%s", ER_THD(thd, WARN_INDEX_HINTS_IGNORED));
|
||||
}
|
||||
}
|
||||
if (table_list->vers_conditions.is_set() && table_list->is_view_or_derived())
|
||||
|
@ -1332,7 +1332,8 @@ void push_warning(THD *thd, Sql_condition::enum_warning_level level,
|
||||
uint code, const char *msg);
|
||||
|
||||
void push_warning_printf(THD *thd, Sql_condition::enum_warning_level level,
|
||||
uint code, const char *format, ...);
|
||||
uint code, const char *format, ...)
|
||||
ATTRIBUTE_FORMAT(printf, 4, 5);
|
||||
|
||||
bool mysqld_show_warnings(THD *thd, ulong levels_to_show);
|
||||
|
||||
|
@ -320,7 +320,7 @@ static inline int open_stat_table_for_ddl(THD *thd, TABLE_LIST *table,
|
||||
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
|
||||
ER_CHECK_NO_SUCH_TABLE,
|
||||
"Got error %d when trying to open statistics "
|
||||
"table %`s for updating statistics",
|
||||
"table %sQ for updating statistics",
|
||||
error_handler.got_error(), stat_table_name->str);
|
||||
}
|
||||
return res;
|
||||
|
@ -970,7 +970,7 @@ ha_example::check_if_supported_inplace_alter(TABLE* altered_table,
|
||||
if (f_new)
|
||||
{
|
||||
push_warning_printf(ha_thd(), Sql_condition::WARN_LEVEL_NOTE,
|
||||
ER_UNKNOWN_ERROR, "EXAMPLE DEBUG: Field %`s COMPLEX '%s' -> '%s'",
|
||||
ER_UNKNOWN_ERROR, "EXAMPLE DEBUG: Field %sQ COMPLEX '%s' -> '%s'",
|
||||
table->s->field[i]->field_name.str,
|
||||
f_old->complex_param_to_parse_it_in_engine,
|
||||
f_new->complex_param_to_parse_it_in_engine);
|
||||
|
@ -11166,7 +11166,7 @@ create_table_info_t::create_options_are_invalid()
|
||||
}
|
||||
|
||||
switch (m_create_info->key_block_size) {
|
||||
ulint kbs_max;
|
||||
ulong kbs_max;
|
||||
case 1:
|
||||
case 2:
|
||||
case 4:
|
||||
@ -11183,8 +11183,8 @@ create_table_info_t::create_options_are_invalid()
|
||||
push_warning_printf(
|
||||
m_thd, Sql_condition::WARN_LEVEL_WARN,
|
||||
ER_ILLEGAL_HA_CREATE_OPTION,
|
||||
"InnoDB: KEY_BLOCK_SIZE=%ld"
|
||||
" cannot be larger than %ld.",
|
||||
"InnoDB: KEY_BLOCK_SIZE=%lu"
|
||||
" cannot be larger than %lu.",
|
||||
m_create_info->key_block_size,
|
||||
kbs_max);
|
||||
ret = "KEY_BLOCK_SIZE";
|
||||
@ -21175,7 +21175,7 @@ dberr_t innodb_decryption_failed(THD *thd, dict_table_t *table)
|
||||
const int dblen= int(table->name.dblen());
|
||||
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
|
||||
HA_ERR_DECRYPTION_FAILED,
|
||||
"Table %`.*s.%`s in tablespace " UINT32PF
|
||||
"Table %.*sQ.%sQ in tablespace " UINT32PF
|
||||
" (file %s) cannot be decrypted.",
|
||||
dblen, table->name.m_name,
|
||||
table->name.m_name + dblen + 1,
|
||||
@ -21197,7 +21197,7 @@ void innodb_fk_error(const trx_t *trx, dberr_t err, const char *name,
|
||||
(trx, &foreign, false);
|
||||
push_warning_printf(trx->mysql_thd, Sql_condition::WARN_LEVEL_WARN,
|
||||
convert_error_code_to_mysql(err, 0, nullptr),
|
||||
"CREATE or ALTER TABLE %`.*s.%`s failed%s%.*s",
|
||||
"CREATE or ALTER TABLE %.*sQ.%sQ failed%s%.*s",
|
||||
dblen, name, name + dblen + 1,
|
||||
err == DB_DUPLICATE_KEY
|
||||
? ": duplicate name" : "",
|
||||
|
Loading…
x
Reference in New Issue
Block a user