提交 76898cd3 编写于 作者: T Tom Lane

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...
上级 095d83e1
此差异已折叠。
...@@ -720,6 +720,16 @@ AC_CHECK_FUNC(vsnprintf, ...@@ -720,6 +720,16 @@ AC_CHECK_FUNC(vsnprintf,
AC_DEFINE(HAVE_VSNPRINTF), AC_DEFINE(HAVE_VSNPRINTF),
SNPRINTF='snprintf.o') SNPRINTF='snprintf.o')
AC_SUBST(SNPRINTF) 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 dnl do this one the hard way in case isinf() is a macro
AC_MSG_CHECKING(for isinf) AC_MSG_CHECKING(for isinf)
AC_CACHE_VAL(ac_cv_func_or_macro_isinf, AC_CACHE_VAL(ac_cv_func_or_macro_isinf,
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * 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,...); ...@@ -789,11 +789,11 @@ extern char *vararg_format(const char *fmt,...);
* in config.h we haven't yet included anything that defines size_t... * 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,...); extern int snprintf(char *str, size_t count, const char *fmt,...);
#endif #endif
#ifndef HAVE_VSNPRINTF #ifndef HAVE_VSNPRINTF_DECL
extern int vsnprintf(char *str, size_t count, const char *fmt, va_list args); extern int vsnprintf(char *str, size_t count, const char *fmt, va_list args);
#endif #endif
......
...@@ -310,18 +310,24 @@ ...@@ -310,18 +310,24 @@
# define gettimeofday(a,b) gettimeofday(a) # define gettimeofday(a,b) gettimeofday(a)
#endif #endif
/* Set to 1 if you have snprintf() */ /* Set to 1 if you have snprintf() in the C library */
#undef HAVE_SNPRINTF #undef HAVE_SNPRINTF
/* Set to 1 if you have strerror() */ /* Set to 1 if your standard system headers declare snprintf() */
#undef HAVE_STRERROR #undef HAVE_SNPRINTF_DECL
/* Set to 1 if you have vsnprintf() */ /* Set to 1 if you have vsnprintf() in the C library */
#undef HAVE_VSNPRINTF #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 isinf(). * 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_FPCLASS
#undef HAVE_FP_CLASS #undef HAVE_FP_CLASS
......
...@@ -6,14 +6,6 @@ typedef struct ...@@ -6,14 +6,6 @@ typedef struct
int sema[4]; int sema[4];
} slock_t; } 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 #ifndef BIG_ENDIAN
#define BIG_ENDIAN 4321 #define BIG_ENDIAN 4321
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册