1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 09:27:59 +00:00

Tweak __attribute__((format)) for MinGW.

This silences a bunch of spurious format warnings on a Ubuntu 14.04
mingw-w64 cross-compilation.
This commit is contained in:
Jacob Nevins 2019-04-21 12:54:18 +01:00
parent 134dc0bcaf
commit 81be535f67
2 changed files with 18 additions and 2 deletions

18
misc.h
View File

@ -24,11 +24,27 @@ char *host_strchr(const char *s, int c);
char *host_strrchr(const char *s, int c);
char *host_strduptrim(const char *s);
#ifdef __GNUC__
/*
* On MinGW, the correct compiler format checking for vsnprintf() etc
* can depend on compile-time flags; these control whether you get
* ISO C or Microsoft's non-standard format strings.
* We sometimes use __attribute__ ((format)) for our own printf-like
* functions, which are ultimately interpreted by the toolchain-chosen
* printf, so we need to take that into account to get correct warnings.
*/
#ifdef __MINGW_PRINTF_FORMAT
#define PUTTY_PRINTF_ARCHETYPE __MINGW_PRINTF_FORMAT
#else
#define PUTTY_PRINTF_ARCHETYPE printf
#endif
#endif /* __GNUC__ */
char *dupstr(const char *s);
char *dupcat(const char *s1, ...);
char *dupprintf(const char *fmt, ...)
#ifdef __GNUC__
__attribute__ ((format (printf, 1, 2)))
__attribute__ ((format (PUTTY_PRINTF_ARCHETYPE, 1, 2)))
#endif
;
char *dupvprintf(const char *fmt, va_list ap);

View File

@ -131,7 +131,7 @@ void pageant_make_keylist2(BinarySink *bs)
static void plog(void *logctx, pageant_logfn_t logfn, const char *fmt, ...)
#ifdef __GNUC__
__attribute__ ((format (printf, 3, 4)))
__attribute__ ((format (PUTTY_PRINTF_ARCHETYPE, 3, 4)))
#endif
;