Skip to content

Commit

Permalink
Use ATTRIBUTE_FORMAT whereëver available
Browse files Browse the repository at this point in the history
Use `my_attribute.h` in `service_my_snprintf.h` for compatibility with non-GCC.
  • Loading branch information
ParadoxV5 committed Jul 9, 2024
1 parent c0a44f6 commit dc990a8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
9 changes: 5 additions & 4 deletions include/mysql/service_my_snprintf.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,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*, ...)
__attribute__((format(printf, 3, 4)));
ATTRIBUTE_FORMAT_FPTR(printf, 3, 4);
size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list)
__attribute__((format(printf, 3, 0)));
ATTRIBUTE_FORMAT_FPTR(printf, 3, 0);
} *my_snprintf_service;

#ifdef MYSQL_DYNAMIC_PLUGIN
Expand All @@ -108,9 +109,9 @@ extern struct my_snprintf_service_st {
#else

size_t my_snprintf(char* to, size_t n, const char* fmt, ...)
__attribute__((format(printf, 3, 4)));
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)));
ATTRIBUTE_FORMAT(printf, 3, 0);

#endif

Expand Down
10 changes: 5 additions & 5 deletions unittest/mytap/tap.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ void plan(int count);
*/

void ok(int pass, char const *fmt, ...)
__attribute__((format(printf,2,3)));
ATTRIBUTE_FORMAT(printf, 2, 3);


/**
Expand Down Expand Up @@ -169,7 +169,7 @@ void ok1(int const pass);
*/

void skip(int how_many, char const *const reason, ...)
__attribute__((format(printf,2,3)));
ATTRIBUTE_FORMAT(printf, 2, 3);


/**
Expand Down Expand Up @@ -218,7 +218,7 @@ void skip(int how_many, char const *const reason, ...)
*/

void diag(char const *fmt, ...)
__attribute__((format(printf,1,2)));
ATTRIBUTE_FORMAT(printf, 1, 2);


/**
Expand All @@ -240,7 +240,7 @@ void diag(char const *fmt, ...)
*/

void BAIL_OUT(char const *fmt, ...)
__attribute__((noreturn, format(printf,1,2)));
ATTRIBUTE_FORMAT(printf, 1, 2);


/**
Expand Down Expand Up @@ -296,7 +296,7 @@ void skip_all(char const *reason, ...)
*/

void todo_start(char const *message, ...)
__attribute__((format(printf, 1, 2)));
ATTRIBUTE_FORMAT(printf, 1, 2);


/**
Expand Down

0 comments on commit dc990a8

Please sign in to comment.