1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

Use a macro variable PG_PRINTF_ATTRIBUTE for the style used for checking printf type functions.

The style is set to "printf" for backwards compatibility everywhere except
on Windows, where it is set to "gnu_printf", which eliminates hundreds of
false error messages from modern versions of gcc arising from  %m and %ll{d,u}
formats.
This commit is contained in:
Andrew Dunstan
2011-04-28 10:56:14 -04:00
parent 39850c7fdb
commit c02d5b7c27
16 changed files with 56 additions and 41 deletions

View File

@@ -197,20 +197,20 @@ extern int pg_vsnprintf(char *str, size_t count, const char *fmt, va_list args);
extern int
pg_snprintf(char *str, size_t count, const char *fmt,...)
/* This extension allows gcc to check the format string */
__attribute__((format(printf, 3, 4)));
__attribute__((format(PG_PRINTF_ATTRIBUTE, 3, 4)));
extern int
pg_sprintf(char *str, const char *fmt,...)
/* This extension allows gcc to check the format string */
__attribute__((format(printf, 2, 3)));
__attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3)));
extern int pg_vfprintf(FILE *stream, const char *fmt, va_list args);
extern int
pg_fprintf(FILE *stream, const char *fmt,...)
/* This extension allows gcc to check the format string */
__attribute__((format(printf, 2, 3)));
__attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3)));
extern int
pg_printf(const char *fmt,...)
/* This extension allows gcc to check the format string */
__attribute__((format(printf, 1, 2)));
__attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 2)));
/*
* The GCC-specific code below prevents the __attribute__(... 'printf')