mirror of
https://github.com/postgres/postgres.git
synced 2025-04-27 22:56:53 +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:
parent
b62f94c603
commit
b779168ffe
@ -51,6 +51,27 @@ fi
|
|||||||
])# PGAC_C_INLINE
|
])# 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)
|
# PGAC_TYPE_64BIT_INT(TYPE)
|
||||||
# -------------------------
|
# -------------------------
|
||||||
|
36
configure
vendored
36
configure
vendored
@ -10094,6 +10094,42 @@ _ACEOF
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for printf format archetype" >&5
|
||||||
|
$as_echo_n "checking for printf format archetype... " >&6; }
|
||||||
|
if ${pgac_cv_printf_archetype+:} false; then :
|
||||||
|
$as_echo_n "(cached) " >&6
|
||||||
|
else
|
||||||
|
ac_save_c_werror_flag=$ac_c_werror_flag
|
||||||
|
ac_c_werror_flag=yes
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
/* end confdefs.h. */
|
||||||
|
extern int
|
||||||
|
pgac_write(int ignore, const char *fmt,...)
|
||||||
|
__attribute__((format(gnu_printf, 2, 3)));
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
if ac_fn_c_try_compile "$LINENO"; then :
|
||||||
|
pgac_cv_printf_archetype=gnu_printf
|
||||||
|
else
|
||||||
|
pgac_cv_printf_archetype=printf
|
||||||
|
fi
|
||||||
|
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||||
|
ac_c_werror_flag=$ac_save_c_werror_flag
|
||||||
|
fi
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_printf_archetype" >&5
|
||||||
|
$as_echo "$pgac_cv_printf_archetype" >&6; }
|
||||||
|
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define PG_PRINTF_ATTRIBUTE $pgac_cv_printf_archetype
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for flexible array members" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for flexible array members" >&5
|
||||||
$as_echo_n "checking for flexible array members... " >&6; }
|
$as_echo_n "checking for flexible array members... " >&6; }
|
||||||
|
@ -1170,6 +1170,7 @@ fi
|
|||||||
m4_defun([AC_PROG_CC_STDC], []) dnl We don't want that.
|
m4_defun([AC_PROG_CC_STDC], []) dnl We don't want that.
|
||||||
AC_C_BIGENDIAN
|
AC_C_BIGENDIAN
|
||||||
PGAC_C_INLINE
|
PGAC_C_INLINE
|
||||||
|
PGAC_PRINTF_ARCHETYPE
|
||||||
AC_C_FLEXIBLE_ARRAY_MEMBER
|
AC_C_FLEXIBLE_ARRAY_MEMBER
|
||||||
PGAC_C_SIGNED
|
PGAC_C_SIGNED
|
||||||
PGAC_C_FUNCNAME_SUPPORT
|
PGAC_C_FUNCNAME_SUPPORT
|
||||||
|
@ -718,6 +718,9 @@
|
|||||||
/* PostgreSQL major version as a string */
|
/* PostgreSQL major version as a string */
|
||||||
#undef PG_MAJORVERSION
|
#undef PG_MAJORVERSION
|
||||||
|
|
||||||
|
/* Define to gnu_printf if compiler supports it, else printf. */
|
||||||
|
#undef PG_PRINTF_ATTRIBUTE
|
||||||
|
|
||||||
/* Define to 1 if "static inline" works without unwanted warnings from
|
/* Define to 1 if "static inline" works without unwanted warnings from
|
||||||
compilations where static inline functions are defined but not called. */
|
compilations where static inline functions are defined but not called. */
|
||||||
#undef PG_USE_INLINE
|
#undef PG_USE_INLINE
|
||||||
|
@ -187,22 +187,6 @@
|
|||||||
*/
|
*/
|
||||||
#define MAX_RANDOM_VALUE (0x7FFFFFFF)
|
#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
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* On PPC machines, decide whether to use the mutex hint bit in LWARX
|
* On PPC machines, decide whether to use the mutex hint bit in LWARX
|
||||||
* instructions. Setting the hint bit will slightly improve spinlock
|
* instructions. Setting the hint bit will slightly improve spinlock
|
||||||
|
Loading…
x
Reference in New Issue
Block a user