Skip to content

Commit fb264f5

Browse files
committed
Fixes mpaland#129: Using the gnu_printf attribute when the compiler supports it, otherwise the printf attribute.
Fix due to karlsboeckda <[email protected]>.
1 parent 944a344 commit fb264f5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Diff for: src/printf/printf.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,13 @@ extern "C" {
4949
#endif
5050

5151
#ifdef __GNUC__
52+
# if ((__GNUC__ == 4 && __GNUC_MINOR__>= 4) || __GNUC__ > 4)
53+
# define ATTR_PRINTF(one_based_format_index, first_arg) \
54+
__attribute__((format(gnu_printf, (one_based_format_index), (first_arg))))
55+
# else
5256
# define ATTR_PRINTF(one_based_format_index, first_arg) \
53-
__attribute__((format(__printf__, (one_based_format_index), (first_arg))))
57+
__attribute__((format(printf, (one_based_format_index), (first_arg))))
58+
# endif
5459
# define ATTR_VPRINTF(one_based_format_index) ATTR_PRINTF((one_based_format_index), 0)
5560
#else
5661
# define ATTR_PRINTF(one_based_format_index, first_arg)

0 commit comments

Comments
 (0)