From ff94a688e3a789eaa7ea20b41f27805d6c1970d2 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Mon, 26 Oct 2020 19:35:09 -0700 Subject: [PATCH] Use gnu_printf in attribute(()) to indicate GNU printf extension support. By writing ordinary printf (or __printf__) inside __attribute__((format)), one indicates that the system's typical format specifiers are supported. This is OK for building for glibc, but it falls down for building for mingw, since PSPP actually supports GNU format specifiers there via gnulib. By writing gnu_printf instead, we avoid some incorrect warnings on mingw. --- src/libpspp/compiler.h | 2 +- src/output/pivot-table.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libpspp/compiler.h b/src/libpspp/compiler.h index b5d02466dc..fb85a553e7 100644 --- a/src/libpspp/compiler.h +++ b/src/libpspp/compiler.h @@ -38,7 +38,7 @@ /* Mark a function as taking a printf- or scanf-like format string as its FMT'th argument and that the FIRST'th argument is the first one to be checked against the format string. */ -#define PRINTF_FORMAT(FMT, FIRST) ATTRIBUTE ((format (__printf__, FMT, FIRST))) +#define PRINTF_FORMAT(FMT, FIRST) ATTRIBUTE ((format (gnu_printf, FMT, FIRST))) #define SCANF_FORMAT(FMT, FIRST) ATTRIBUTE ((format (__scanf__, FMT, FIRST))) /* Tells the compiler that a function may be treated as if any diff --git a/src/output/pivot-table.h b/src/output/pivot-table.h index 377579a013..c4c9bb778f 100644 --- a/src/output/pivot-table.h +++ b/src/output/pivot-table.h @@ -683,7 +683,7 @@ struct pivot_value *pivot_value_new_variable (const struct variable *); /* Values from text strings. */ struct pivot_value *pivot_value_new_text (const char *); struct pivot_value *pivot_value_new_text_format (const char *, ...) - PRINTF_FORMAT (1, 2); + __attribute__((format(gnu_printf, 1, 2))); struct pivot_value *pivot_value_new_user_text (const char *, size_t length); struct pivot_value *pivot_value_new_user_text_nocopy (char *); -- 2.30.2