mirror of
https://github.com/MariaDB/server.git
synced 2026-05-09 16:44:29 +02:00
Tag mysqltest formatters with ATTRIBUTE_FORMAT
Let GCC `-Wformat` check the formats sent to these `my_vsnprintf` users and migrate them from the old `%b` to the new `%sB`
This commit is contained in:
parent
5100773ab9
commit
618afa32ce
1 changed files with 19 additions and 18 deletions
|
|
@ -634,8 +634,9 @@ static void cleanup_and_exit(int exit_code, bool called_from_die);
|
|||
ATTRIBUTE_NORETURN
|
||||
static void really_die(const char *msg);
|
||||
void report_or_die(const char *fmt, ...);
|
||||
ATTRIBUTE_NORETURN
|
||||
ATTRIBUTE_NORETURN ATTRIBUTE_FORMAT(printf, 1, 2)
|
||||
static void die(const char *fmt, ...);
|
||||
ATTRIBUTE_FORMAT(printf, 3, 0)
|
||||
static void make_error_message(char *buf, size_t len, const char *fmt, va_list args);
|
||||
ATTRIBUTE_NORETURN ATTRIBUTE_FORMAT(printf, 1, 2)
|
||||
void abort_not_supported_test(const char *fmt, ...);
|
||||
|
|
@ -1371,7 +1372,7 @@ void check_command_args(struct st_command *command,
|
|||
|
||||
/* Check required arg */
|
||||
if (arg->ds->length == 0 && arg->required)
|
||||
die("Missing required argument '%s' to command '%.*b'", arg->argname,
|
||||
die("Missing required argument '%s' to command '%.*sB'", arg->argname,
|
||||
command->first_word_len, command->query);
|
||||
|
||||
}
|
||||
|
|
@ -1380,7 +1381,7 @@ void check_command_args(struct st_command *command,
|
|||
while(ptr <= command->end && *ptr != '#')
|
||||
{
|
||||
if (*ptr && *ptr != ' ')
|
||||
die("Extra argument '%s' passed to '%.*b'",
|
||||
die("Extra argument '%s' passed to '%.*sB'",
|
||||
ptr, command->first_word_len, command->query);
|
||||
ptr++;
|
||||
}
|
||||
|
|
@ -1400,7 +1401,7 @@ void handle_command_error(struct st_command *command, uint error,
|
|||
|
||||
if (command->abort_on_error)
|
||||
{
|
||||
report_or_die("command \"%.*b\" failed with error: %u my_errno: %d "
|
||||
report_or_die("command \"%.*sB\" failed with error: %u my_errno: %d "
|
||||
"errno: %d",
|
||||
command->first_word_len, command->query, error, my_errno,
|
||||
sys_errno);
|
||||
|
|
@ -1418,7 +1419,7 @@ void handle_command_error(struct st_command *command, uint error,
|
|||
DBUG_VOID_RETURN;
|
||||
}
|
||||
if (command->expected_errors.count > 0)
|
||||
report_or_die("command \"%.*b\" failed with wrong error: %u "
|
||||
report_or_die("command \"%.*sB\" failed with wrong error: %u "
|
||||
"my_errno: %d errno: %d",
|
||||
command->first_word_len, command->query, error, my_errno,
|
||||
sys_errno);
|
||||
|
|
@ -1427,7 +1428,7 @@ void handle_command_error(struct st_command *command, uint error,
|
|||
command->expected_errors.err[0].code.errnum != 0)
|
||||
{
|
||||
/* Error code we wanted was != 0, i.e. not an expected success */
|
||||
report_or_die("command \"%.*b\" succeeded - should have failed with "
|
||||
report_or_die("command \"%.*sB\" succeeded - should have failed with "
|
||||
"errno %d...",
|
||||
command->first_word_len, command->query,
|
||||
command->expected_errors.err[0].code.errnum);
|
||||
|
|
@ -2402,7 +2403,7 @@ static int strip_surrounding(char* str, char c1, char c2)
|
|||
static void strip_parentheses(struct st_command *command)
|
||||
{
|
||||
if (strip_surrounding(command->first_argument, '(', ')'))
|
||||
die("%.*b - argument list started with '%c' must be ended with '%c'",
|
||||
die("%.*sB - argument list started with '%c' must be ended with '%c'",
|
||||
command->first_word_len, command->query, '(', ')');
|
||||
}
|
||||
|
||||
|
|
@ -3060,7 +3061,7 @@ void eval_expr(VAR *v, const char *p, const char **p_end,
|
|||
/* Make sure there was just a $variable and nothing else */
|
||||
const char* end= *p_end + 1;
|
||||
if (end < expected_end && !open_end)
|
||||
die("Found junk '%.*b' after $variable in expression",
|
||||
die("Found junk '%.*sB' after $variable in expression",
|
||||
(int)(expected_end - end - 1), end);
|
||||
|
||||
DBUG_VOID_RETURN;
|
||||
|
|
@ -3580,10 +3581,10 @@ int do_modify_var(struct st_command *command,
|
|||
const char *p= command->first_argument;
|
||||
VAR* v;
|
||||
if (!*p)
|
||||
die("Missing argument to %.*b", command->first_word_len,
|
||||
die("Missing argument to %.*sB", command->first_word_len,
|
||||
command->query);
|
||||
if (*p != '$')
|
||||
die("The argument to %.*b must be a variable (start with $)",
|
||||
die("The argument to %.*sB must be a variable (start with $)",
|
||||
command->first_word_len, command->query);
|
||||
v= var_get(p, &p, 1, 0);
|
||||
if (! v->is_int)
|
||||
|
|
@ -4934,17 +4935,17 @@ void do_sync_with_master2(struct st_command *command, long offset,
|
|||
information is not initialized, the arguments are
|
||||
incorrect, or an error has occurred
|
||||
*/
|
||||
die("%.*b failed: '%s' returned NULL " \
|
||||
die("%.*sB failed: '%s' returned NULL " \
|
||||
"indicating slave SQL thread failure",
|
||||
command->first_word_len, command->query, query_buf);
|
||||
}
|
||||
|
||||
if (result == -1)
|
||||
die("%.*b failed: '%s' returned -1 " \
|
||||
die("%.*sB failed: '%s' returned -1 " \
|
||||
"indicating timeout after %d seconds",
|
||||
command->first_word_len, command->query, query_buf, timeout);
|
||||
else
|
||||
die("%.*b failed: '%s' returned unknown result :%d",
|
||||
die("%.*sB failed: '%s' returned unknown result :%d",
|
||||
command->first_word_len, command->query, query_buf, result);
|
||||
}
|
||||
|
||||
|
|
@ -5110,17 +5111,17 @@ int do_sleep(struct st_command *command, my_bool real_sleep)
|
|||
while (my_isspace(charset_info, *p))
|
||||
p++;
|
||||
if (!*p)
|
||||
die("Missing argument to %.*b", command->first_word_len,
|
||||
die("Missing argument to %.*sB", command->first_word_len,
|
||||
command->query);
|
||||
sleep_start= p;
|
||||
/* Check that arg starts with a digit, not handled by my_strtod */
|
||||
if (!my_isdigit(charset_info, *sleep_start))
|
||||
die("Invalid argument to %.*b \"%s\"", command->first_word_len,
|
||||
die("Invalid argument to %.*sB \"%s\"", command->first_word_len,
|
||||
command->query, sleep_start);
|
||||
sleep_val= my_strtod(sleep_start, &sleep_end, &error);
|
||||
check_eol_junk_line(sleep_end);
|
||||
if (error)
|
||||
die("Invalid argument to %.*b \"%s\"", command->first_word_len,
|
||||
die("Invalid argument to %.*sB \"%s\"", command->first_word_len,
|
||||
command->query, command->first_argument);
|
||||
dynstr_free(&ds_sleep);
|
||||
|
||||
|
|
@ -6240,7 +6241,7 @@ void do_connect(struct st_command *command)
|
|||
rauth= strdup(con_options + sizeof("auth=") - 1);
|
||||
}
|
||||
else
|
||||
die("Illegal option to connect: %.*b",
|
||||
die("Illegal option to connect: %.*sB",
|
||||
(int) (end - con_options), con_options);
|
||||
/* Process next option */
|
||||
con_options= end;
|
||||
|
|
@ -6562,7 +6563,7 @@ void do_block(enum block_cmd cmd, struct st_command* command)
|
|||
|
||||
enum block_op operand= find_operand(curr_ptr);
|
||||
if (operand == ILLEG_OP)
|
||||
die("Found junk '%.*b' after $variable in condition",
|
||||
die("Found junk '%.*sB' after $variable in condition",
|
||||
(int)(expr_end - curr_ptr), curr_ptr);
|
||||
|
||||
/* We could silently allow this, but may be confusing */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue