Avoid compiler warnings on systems that have snprintf and/or vsnprintf

but do not bother to declare them in <stdio.h>.  Seems to be a more
common omission than you'd think...
This commit is contained in:
Tom Lane 1999-12-20 00:51:25 +00:00
parent 095d83e129
commit 76898cd330
5 changed files with 189 additions and 151 deletions

300
src/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -720,6 +720,16 @@ AC_CHECK_FUNC(vsnprintf,
AC_DEFINE(HAVE_VSNPRINTF),
SNPRINTF='snprintf.o')
AC_SUBST(SNPRINTF)
dnl Check whether <stdio.h> declares snprintf() and vsnprintf(); if not,
dnl include/c.h will provide declarations. Note this is a separate test
dnl from whether the functions exist in the C library --- there are systems
dnl that have the functions but don't bother to declare them :-(
dnl Note: simple-minded pattern here will do wrong thing if stdio.h
dnl declares vsnprintf() but not snprintf(). Hopefully there are no
dnl systems that are *that* brain-damaged...
AC_EGREP_HEADER(snprintf, stdio.h, AC_DEFINE(HAVE_SNPRINTF_DECL))
AC_EGREP_HEADER(vsnprintf, stdio.h, AC_DEFINE(HAVE_VSNPRINTF_DECL))
dnl
dnl do this one the hard way in case isinf() is a macro
AC_MSG_CHECKING(for isinf)
AC_CACHE_VAL(ac_cv_func_or_macro_isinf,

View File

@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: c.h,v 1.61 1999/07/17 20:18:25 momjian Exp $
* $Id: c.h,v 1.62 1999/12/20 00:51:21 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -789,11 +789,11 @@ extern char *vararg_format(const char *fmt,...);
* in config.h we haven't yet included anything that defines size_t...
*/
#ifndef HAVE_SNPRINTF
#ifndef HAVE_SNPRINTF_DECL
extern int snprintf(char *str, size_t count, const char *fmt,...);
#endif
#ifndef HAVE_VSNPRINTF
#ifndef HAVE_VSNPRINTF_DECL
extern int vsnprintf(char *str, size_t count, const char *fmt, va_list args);
#endif

View File

@ -310,18 +310,24 @@
# define gettimeofday(a,b) gettimeofday(a)
#endif
/* Set to 1 if you have snprintf() */
/* Set to 1 if you have snprintf() in the C library */
#undef HAVE_SNPRINTF
/* Set to 1 if your standard system headers declare snprintf() */
#undef HAVE_SNPRINTF_DECL
/* Set to 1 if you have vsnprintf() in the C library */
#undef HAVE_VSNPRINTF
/* Set to 1 if your standard system headers declare vsnprintf() */
#undef HAVE_VSNPRINTF_DECL
/* Set to 1 if you have strerror() */
#undef HAVE_STRERROR
/* Set to 1 if you have vsnprintf() */
#undef HAVE_VSNPRINTF
/*
* Set to 1 if you have isinf().
* These are all realated to port/isinf.c
* These are all related to port/isinf.c
*/
#undef HAVE_FPCLASS
#undef HAVE_FP_CLASS

View File

@ -6,14 +6,6 @@ typedef struct
int sema[4];
} slock_t;
/* HPUX 9 has snprintf in the library, so configure will set HAVE_SNPRINTF;
* but it doesn't provide a prototype for it. To suppress warning messages
* from gcc, do this to make c.h provide the prototype:
*/
#ifndef HAVE_VSNPRINTF
#undef HAVE_SNPRINTF
#endif
#ifndef BIG_ENDIAN
#define BIG_ENDIAN 4321
#endif