1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-24 09:27:52 +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

@@ -154,6 +154,21 @@
*/
#define MAX_RANDOM_VALUE (0x7FFFFFFF)
/*
* Set the format style used by gcc to check printf type functions. We really
* want the "gnu_printf" style set, which includes what glibc uses, such
* as %m for error strings and %lld for 64 bit long longs. But not all gcc
* compilers are known to support it, so we just use "printf" which all
* gcc versions alive are known to support, except on Windows where
* using "gnu_printf" style makes a dramatic difference. Maybe someday
* we'll have a configure test for this, if we ever discover use of more
* variants to be necessary.
*/
#ifdef WIN32
#define PG_PRINTF_ATTRIBUTE gnu_printf
#else
#define PG_PRINTF_ATTRIBUTE printf
#endif
/*
*------------------------------------------------------------------------