mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Detect PG_PRINTF_ATTRIBUTE automatically.
This eliminates gobs of "unrecognized format function type" warnings under MinGW compilers predating GCC 4.4.
This commit is contained in:
@ -51,6 +51,27 @@ fi
|
||||
])# PGAC_C_INLINE
|
||||
|
||||
|
||||
# PGAC_C_PRINTF_ARCHETYPE
|
||||
# -----------------------
|
||||
# Set the format archetype used by gcc to check printf type functions. We
|
||||
# prefer "gnu_printf", which includes what glibc uses, such as %m for error
|
||||
# strings and %lld for 64 bit long longs. GCC 4.4 introduced it. It makes a
|
||||
# dramatic difference on Windows.
|
||||
AC_DEFUN([PGAC_PRINTF_ARCHETYPE],
|
||||
[AC_CACHE_CHECK([for printf format archetype], pgac_cv_printf_archetype,
|
||||
[ac_save_c_werror_flag=$ac_c_werror_flag
|
||||
ac_c_werror_flag=yes
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
|
||||
[extern int
|
||||
pgac_write(int ignore, const char *fmt,...)
|
||||
__attribute__((format(gnu_printf, 2, 3)));], [])],
|
||||
[pgac_cv_printf_archetype=gnu_printf],
|
||||
[pgac_cv_printf_archetype=printf])
|
||||
ac_c_werror_flag=$ac_save_c_werror_flag])
|
||||
AC_DEFINE_UNQUOTED([PG_PRINTF_ATTRIBUTE], [$pgac_cv_printf_archetype],
|
||||
[Define to gnu_printf if compiler supports it, else printf.])
|
||||
])# PGAC_PRINTF_ARCHETYPE
|
||||
|
||||
|
||||
# PGAC_TYPE_64BIT_INT(TYPE)
|
||||
# -------------------------
|
||||
|
Reference in New Issue
Block a user