1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

Tag the logger service with ATTRIBUTE_FORMAT

[Breaking]
The `logger` service passes formats and args directly to `my_vsnprintf`.
Just like the `my_snprintf` service,
I increased this service’s major version because:
* Custom suffixes are now a thing
  (and custom specifiers will soon no longer be).
* GCC `-Wformat` now checks formats sent to them.
This commit is contained in:
ParadoxV5
2024-08-12 17:34:04 -06:00
committed by Sergei Golubchik
parent 2392bd02d8
commit 302caa9549
3 changed files with 11 additions and 6 deletions

View File

@@ -19,6 +19,7 @@
#ifndef MYSQL_ABI_CHECK
#include <stdarg.h>
#endif
#include <my_attribute.h>
/**
@file
@@ -65,8 +66,10 @@ extern struct logger_service_st {
unsigned long long size_limit,
unsigned int rotations);
int (*close)(LOGGER_HANDLE *log);
int (*vprintf)(LOGGER_HANDLE *log, const char *fmt, va_list argptr);
int (*printf)(LOGGER_HANDLE *log, const char *fmt, ...);
int (*vprintf)(LOGGER_HANDLE *log, const char *fmt, va_list argptr)
ATTRIBUTE_FORMAT_FPTR(printf, 2, 0);
int (*printf)(LOGGER_HANDLE *log, const char *fmt, ...)
ATTRIBUTE_FORMAT_FPTR(printf, 2, 3);
int (*write)(LOGGER_HANDLE *log, const char *buffer, size_t size);
int (*rotate)(LOGGER_HANDLE *log);
} *logger_service;
@@ -90,8 +93,10 @@ extern struct logger_service_st {
unsigned long long size_limit,
unsigned int rotations);
int logger_close(LOGGER_HANDLE *log);
int logger_vprintf(LOGGER_HANDLE *log, const char *fmt, va_list argptr);
int logger_printf(LOGGER_HANDLE *log, const char *fmt, ...);
int logger_vprintf(LOGGER_HANDLE *log, const char *fmt, va_list argptr)
ATTRIBUTE_FORMAT(printf, 2, 0);
int logger_printf(LOGGER_HANDLE *log, const char *fmt, ...)
ATTRIBUTE_FORMAT(printf, 2, 3);
int logger_write(LOGGER_HANDLE *log, const char *buffer, size_t size);
int logger_rotate(LOGGER_HANDLE *log);
#endif