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

Tag my_vsnprintf.c with ATTRIBUTE_FORMAT

[Breaking]
Good news:
GCC now checks your `my_snprintf` (direct) calls (`-Wformat` was on);
Bad news:
The build process no longer lets your incorrect
formats/arguments sneak past (`-Werror` was also on).

As such, this commit also migrates all direct `my_snprintf` calls from
the old specifiers to MDEV-21978’s new `-Wformat`-compatible suffixes.
The next commits will cover non-direct calls to `my_snprintf`.
(I call them “`my_snprintf` descendants”.)

This commit does not update the ABI records because
there’re more ABI “changes” to come – half a dozen
`include/mysql/plugin_*.h.pp`s are now missing the new `__attribute__`s.
This commit is contained in:
ParadoxV5
2024-06-28 20:48:51 -06:00
committed by Sergei Golubchik
parent f3617981ad
commit 5100773ab9
10 changed files with 36 additions and 27 deletions

View File

@@ -93,10 +93,13 @@ extern "C" {
#include <stdarg.h>
#include <stdlib.h>
#endif
#include <my_attribute.h>
extern struct my_snprintf_service_st {
size_t (*my_snprintf_type)(char*, size_t, const char*, ...);
size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list);
size_t (*my_snprintf_type)(char*, size_t, const char*, ...)
ATTRIBUTE_FORMAT_FPTR(printf, 3, 4);
size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list)
ATTRIBUTE_FORMAT_FPTR(printf, 3, 0);
} *my_snprintf_service;
#ifdef MYSQL_DYNAMIC_PLUGIN
@@ -106,8 +109,10 @@ extern struct my_snprintf_service_st {
#else
size_t my_snprintf(char* to, size_t n, const char* fmt, ...);
size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap);
size_t my_snprintf(char* to, size_t n, const char* fmt, ...)
ATTRIBUTE_FORMAT(printf, 3, 4);
size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap)
ATTRIBUTE_FORMAT(printf, 3, 0);
#endif