Skip to content

Commit 21dfef4

Browse files
ParadoxV5vuvova
authored andcommitted
Reënable ATTRIBUTE_FORMAT on DBUG_PRINT & t/eprint
(Re)ënable the `ATTRIBUTE_FORMAT` on `my_dbug.h`’s `_db_doprnt_` (better known by its frontend `DBUG_PRINT`) and `ma_recovery_util.h`’s `tprint` & `eprint` to leverage GCC `-Wformat` checking c4bf4b7 introduced `WAITING_FOR_BUGFIX_TO_VSPRINTF` to conditionally (read: temporarily) disable their `ATTRIBUTE_FORMAT`s. Whatever that bug was aside, MDEV-21978 Zulip suggested that the preference for `%b` was probably intended, although c52e62a reverted the one in `storage/maria/ma_recovery.c` back to `%s`. All extension migrations (e.g., `%b` ➡ `%sB`) in this commit were on `DBUG_PRINT`.
1 parent d5ba6f7 commit 21dfef4

File tree

5 files changed

+7
-15
lines changed

5 files changed

+7
-15
lines changed

dbug/dbug.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,8 @@ static void Indent(CODE_STATE *cs, int indent);
298298
static void DbugFlush(CODE_STATE *);
299299
static void DbugExit(const char *why);
300300
static const char *DbugStrTok(const char *s);
301-
static void DbugVfprintf(FILE *stream, const char* format, va_list args);
301+
static void DbugVfprintf(FILE *stream, const char* format, va_list args)
302+
ATTRIBUTE_FORMAT(printf, 2, 0);
302303

303304
/*
304305
* Miscellaneous printf format strings.

include/my_dbug.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,7 @@ extern void _db_enter_(const char *_func_, const char *_file_, uint _line_,
5151
struct _db_stack_frame_ *_stack_frame_);
5252
extern void _db_return_(struct _db_stack_frame_ *_stack_frame_);
5353
extern int _db_pargs_(uint _line_,const char *keyword);
54-
extern void _db_doprnt_(const char *format,...)
55-
#ifdef WAITING_FOR_BUGFIX_TO_VSPRINTF
56-
ATTRIBUTE_FORMAT(printf, 1, 2)
57-
#endif
58-
;
54+
extern void _db_doprnt_(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
5955
extern void _db_dump_(uint _line_,const char *keyword,
6056
const unsigned char *memory, size_t length);
6157
extern void _db_end_(void);

sql/log_event.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3177,7 +3177,7 @@ Rows_log_event::Rows_log_event(const uchar *buf, uint event_len,
31773177
uchar *ptr_after_width= (uchar*) ptr_width;
31783178
DBUG_PRINT("debug", ("Reading from %p", ptr_after_width));
31793179
m_width= net_field_length(&ptr_after_width);
3180-
DBUG_PRINT("debug", ("m_width=%lu", m_width));
3180+
DBUG_PRINT("debug", ("m_width=%u", m_width));
31813181

31823182
/* Avoid reading out of buffer */
31833183
if (ptr_after_width + (m_width + 7) / 8 > (uchar*)buf + event_len)
@@ -3240,7 +3240,7 @@ Rows_log_event::Rows_log_event(const uchar *buf, uint event_len,
32403240
DBUG_VOID_RETURN;
32413241
}
32423242
size_t const data_size= event_len - read_size;
3243-
DBUG_PRINT("info",("m_table_id: %llu m_flags: %d m_width: %lu data_size: %lu",
3243+
DBUG_PRINT("info",("m_table_id: %llu m_flags: %d m_width: %u data_size: %lu",
32443244
m_table_id, m_flags, m_width, (ulong) data_size));
32453245

32463246
m_rows_buf= (uchar*) my_malloc(PSI_INSTRUMENT_ME, data_size, MYF(MY_WME));

sql/protocol.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1485,7 +1485,7 @@ bool Protocol_text::store_str(const char *from, size_t length,
14851485
CHARSET_INFO *fromcs, CHARSET_INFO *tocs)
14861486
{
14871487
#ifndef DBUG_OFF
1488-
DBUG_PRINT("info", ("Protocol_text::store field %u : %.*b", field_pos,
1488+
DBUG_PRINT("info", ("Protocol_text::store field %u : %.*sB", field_pos,
14891489
(int) length, (length == 0 ? "" : from)));
14901490
DBUG_ASSERT(field_handlers == 0 || field_pos < field_count);
14911491
DBUG_ASSERT(valid_handler(field_pos, PROTOCOL_SEND_STRING));
@@ -1501,7 +1501,7 @@ bool Protocol_text::store_numeric_zerofill_str(const char *from,
15011501
{
15021502
#ifndef DBUG_OFF
15031503
DBUG_PRINT("info",
1504-
("Protocol_text::store_numeric_zerofill_str field %u : %.*b",
1504+
("Protocol_text::store_numeric_zerofill_str field %u : %.*sB",
15051505
field_pos, (int) length, (length == 0 ? "" : from)));
15061506
DBUG_ASSERT(field_handlers == 0 || field_pos < field_count);
15071507
DBUG_ASSERT(valid_handler(field_pos, send_type));

storage/maria/ma_recovery_util.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,7 @@ extern FILE *tracef;
3131
my_bool _ma_redo_not_needed_for_page(uint16 shortid, LSN lsn,
3232
pgcache_page_no_t page,
3333
my_bool index);
34-
#ifdef WAITING_FOR_BUGFIX_TO_VSPRINTF
3534
void tprint(FILE *trace_file, const char *format, ...)
3635
ATTRIBUTE_FORMAT(printf, 2, 3);
3736
void eprint(FILE *trace_file, const char *format, ...)
3837
ATTRIBUTE_FORMAT(printf, 2, 3);
39-
#else
40-
void tprint(FILE *trace_file, const char *format, ...);
41-
void eprint(FILE *trace_file, const char *format, ...);
42-
#endif

0 commit comments

Comments
 (0)