Skip to content

Commit

Permalink
Fixes mpaland#129: Using the gnu_printf attribute when the compiler…
Browse files Browse the repository at this point in the history
… supports it, otherwise the `printf` attribute.

Fix due to karlsboeckda <[email protected]>.
  • Loading branch information
eyalroz committed Jun 3, 2022
1 parent 944a344 commit fb264f5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/printf/printf.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,13 @@ extern "C" {
#endif

#ifdef __GNUC__
# if ((__GNUC__ == 4 && __GNUC_MINOR__>= 4) || __GNUC__ > 4)
# define ATTR_PRINTF(one_based_format_index, first_arg) \
__attribute__((format(gnu_printf, (one_based_format_index), (first_arg))))
# else
# define ATTR_PRINTF(one_based_format_index, first_arg) \
__attribute__((format(__printf__, (one_based_format_index), (first_arg))))
__attribute__((format(printf, (one_based_format_index), (first_arg))))
# endif
# define ATTR_VPRINTF(one_based_format_index) ATTR_PRINTF((one_based_format_index), 0)
#else
# define ATTR_PRINTF(one_based_format_index, first_arg)
Expand Down

0 comments on commit fb264f5

Please sign in to comment.