mirror of https://git.tukaani.org/xz.git
tuklib_mbstr_wrap: Add printf format attribute
It's supported by GCC 3.x already.
This commit is contained in:
parent
a7313c01d9
commit
63b246c90e
|
@ -56,6 +56,13 @@
|
||||||
# define TUKLIB_GNUC_REQ(major, minor) 0
|
# define TUKLIB_GNUC_REQ(major, minor) 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__GNUC__) || defined(__clang__)
|
||||||
|
# define tuklib_attr_format_printf(fmt_index, args_index) \
|
||||||
|
__attribute__((__format__(__printf__, fmt_index, args_index)))
|
||||||
|
#else
|
||||||
|
# define tuklib_attr_format_printf(fmt_index, args_index)
|
||||||
|
#endif
|
||||||
|
|
||||||
// tuklib_attr_noreturn attribute is used to mark functions as non-returning.
|
// tuklib_attr_noreturn attribute is used to mark functions as non-returning.
|
||||||
// We cannot use "noreturn" as the macro name because then C23 code that
|
// We cannot use "noreturn" as the macro name because then C23 code that
|
||||||
// uses [[noreturn]] would break as it would expand to [[ [[noreturn]] ]].
|
// uses [[noreturn]] would break as it would expand to [[ [[noreturn]] ]].
|
||||||
|
|
|
@ -186,6 +186,7 @@ extern int tuklib_wraps(FILE *stream, const struct tuklib_wrap_opt *opt,
|
||||||
/// all strings have (hopefully) been printed.
|
/// all strings have (hopefully) been printed.
|
||||||
|
|
||||||
#define tuklib_wrapf TUKLIB_SYMBOL(tuklib_wrapf)
|
#define tuklib_wrapf TUKLIB_SYMBOL(tuklib_wrapf)
|
||||||
|
tuklib_attr_format_printf(3, 4)
|
||||||
extern int tuklib_wrapf(FILE *stream, const struct tuklib_wrap_opt *opt,
|
extern int tuklib_wrapf(FILE *stream, const struct tuklib_wrap_opt *opt,
|
||||||
const char *fmt, ...);
|
const char *fmt, ...);
|
||||||
///<
|
///<
|
||||||
|
|
Loading…
Reference in New Issue