1
0
mirror of https://github.com/MariaDB/server.git synced 2025-04-18 21:44:20 +03:00

Tag rest of my_vsnprintf users w/ ATTRIBUTE_FORMAT

This commit is the final batch of #3360’s `ATTRIBUTE_FORMAT` process,
covering various insignificant (as in, requires few-to-no
changes in addition to gaining this attribute) functions.

One of the main focus of this PR is to enable GCC `-Wformat` (by tagging
`ATTRIBUTE_FORMAT`) on ALL `my_snprintf` utilities. To be throughout,
functions that delegate to `my_vsnprintf` must also inherit this
attribute because `-Wformat` doesn’t trace argument across call stacks.
This commit is contained in:
ParadoxV5 2024-10-13 19:27:37 -06:00 committed by Sergei Golubchik
parent 63b0ee26f7
commit c8783757d6
6 changed files with 13 additions and 7 deletions

View File

@ -628,8 +628,10 @@ static const char *load_default_groups[]=
0 };
static void ensure_out_dir_exists(const char *db);
static void maybe_exit(int error);
static void die(int error, const char* reason, ...);
static void maybe_die(int error, const char* reason, ...);
static void die(int error, const char* reason, ...)
ATTRIBUTE_FORMAT(printf, 2, 3);
static void maybe_die(int error, const char* reason, ...)
ATTRIBUTE_FORMAT(printf, 2, 3);
static void write_header(FILE *sql_file, const char *db_name);
static void print_value(FILE *file, MYSQL_RES *result, MYSQL_ROW row,
const char *prefix,const char *name,
@ -656,7 +658,8 @@ static int dump_all_tablespaces();
static int dump_tablespaces_for_tables(char *db, char **table_names, int tables);
static int dump_tablespaces_for_databases(char** databases);
static int dump_tablespaces(char* ts_where);
static void print_comment(FILE *, my_bool, const char *, ...);
static void print_comment(FILE *, my_bool, const char *, ...)
ATTRIBUTE_FORMAT(printf, 3, 4);
static inline int cmp_database(const char *a, const char *b)

View File

@ -109,7 +109,8 @@ void set_stmt_error(MYSQL_STMT *stmt, int errcode, const char *sqlstate,
const char *err);
void set_mysql_error(MYSQL *mysql, int errcode, const char *sqlstate);
void set_mysql_extended_error(MYSQL *mysql, int errcode, const char *sqlstate,
const char *format, ...);
const char *format, ...)
ATTRIBUTE_FORMAT(printf, 4, 5);
/* client side of the pluggable authentication */
struct st_vio;

View File

@ -136,7 +136,7 @@ private:
ulonglong m_bound[OVERALL_POWER_COUNT];
};
static
ATTRIBUTE_FORMAT(printf, 3, 0) static
size_t print_time(char* buffer, std::size_t buffer_size, const char* format,
uint64 value)
{

View File

@ -431,6 +431,7 @@ public:
Proc_table_intact() : m_print_once(TRUE) { has_keys= TRUE; }
protected:
ATTRIBUTE_FORMAT(printf, 3, 4)
void report_error(uint code, const char *fmt, ...) override;
};

View File

@ -70,7 +70,8 @@ public:
federatedx_io_mysql(FEDERATEDX_SERVER *);
~federatedx_io_mysql() override;
int simple_query(const char *fmt, ...);
// 1st arg is the implicit `this`
int simple_query(const char *fmt, ...) ATTRIBUTE_FORMAT(printf, 2, 3);
int query(const char *buffer, size_t length) override;
FEDERATEDX_IO_RESULT *store_result() override;

View File

@ -401,7 +401,7 @@ static void _ma_check_print(HA_CHECK *param, const LEX_CSTRING *msg_type,
// collect errors printed by maria_check routines
ATTRIBUTE_FORMAT(printf, 3, 0)
static void _ma_check_print_msg(HA_CHECK *param, const LEX_CSTRING *msg_type,
const char *fmt, va_list args)
{