From: hno <> Date: Tue, 23 Oct 2001 05:55:43 +0000 (+0000) Subject: Enable GCC to check printf style arguments X-Git-Tag: SQUID_3_0_PRE1~1330 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=392bbafe62331b5f9a4473294a79592891f6a049;p=thirdparty%2Fsquid.git Enable GCC to check printf style arguments --- diff --git a/include/config.h b/include/config.h index 18569f509e..9b30a77da8 100644 --- a/include/config.h +++ b/include/config.h @@ -1,5 +1,5 @@ /* - * $Id: config.h,v 1.2 2001/10/08 16:18:31 hno Exp $ + * $Id: config.h,v 1.3 2001/10/22 23:55:43 hno Exp $ * * AUTHOR: Duane Wessels * @@ -34,7 +34,7 @@ #ifndef SQUID_CONFIG_H #define SQUID_CONFIG_H -#include "autoconf.h" /* For GNU autoconf variables */ +#include "autoconf.h" /* For GNU autoconf variables */ #include "version.h" /**************************************************************************** @@ -50,40 +50,40 @@ #endif /* define the _SQUID_TYPE_ based on a guess of the OS */ -#if defined(__sun__) || defined(__sun) /* SUN */ +#if defined(__sun__) || defined(__sun) /* SUN */ #define _SQUID_SUN_ -#if defined(__SVR4) /* SOLARIS */ +#if defined(__SVR4) /* SOLARIS */ #define _SQUID_SOLARIS_ -#else /* SUNOS */ +#else /* SUNOS */ #define _SQUID_SUNOS_ #endif -#elif defined(__hpux) /* HP-UX - SysV-like? */ +#elif defined(__hpux) /* HP-UX - SysV-like? */ #define _SQUID_HPUX_ #define _SQUID_SYSV_ -#elif defined(__osf__) /* OSF/1 */ +#elif defined(__osf__) /* OSF/1 */ #define _SQUID_OSF_ -#elif defined(__ultrix) /* Ultrix */ +#elif defined(__ultrix) /* Ultrix */ #define _SQUID_ULTRIX_ -#elif defined(_AIX) /* AIX */ +#elif defined(_AIX) /* AIX */ #define _SQUID_AIX_ -#elif defined(__linux__) /* Linux */ +#elif defined(__linux__) /* Linux */ #define _SQUID_LINUX_ #if USE_ASYNC_IO #define _SQUID_LINUX_THREADS_ #endif -#elif defined(__FreeBSD__) /* FreeBSD */ +#elif defined(__FreeBSD__) /* FreeBSD */ #define _SQUID_FREEBSD_ #if USE_ASYNC_IO && defined(LINUXTHREADS) #define _SQUID_LINUX_THREADS_ #endif -#elif defined(__sgi__) || defined(sgi) || defined(__sgi) /* SGI */ +#elif defined(__sgi__) || defined(sgi) || defined(__sgi) /* SGI */ #define _SQUID_SGI_ #if !defined(_SVR4_SOURCE) #define _SVR4_SOURCE /* for tempnam(3) */ @@ -96,12 +96,12 @@ #define _SQUID_NEXT_ #elif defined(__bsdi__) -#define _SQUID_BSDI_ /* BSD/OS */ +#define _SQUID_BSDI_ /* BSD/OS */ #elif defined(__NetBSD__) #define _SQUID_NETBSD_ -#elif defined(__CYGWIN32__) || defined(__CYGWIN__) +#elif defined(__CYGWIN32__) || defined(__CYGWIN__) #define _SQUID_CYGWIN_ #elif defined(WIN32) || defined(WINNT) || defined(__WIN32__) || defined(__WIN32) @@ -175,4 +175,10 @@ #define squid_srandom srand #endif +#if __GNUC__ +#define PRINTF_FORMAT_ARG(pos) __attribute__ ((format (printf, pos, pos + 1))) +#else +#define PRINTF_FORMAT_ARG(pos) +#endif + #endif /* SQUID_CONFIG_H */ diff --git a/include/snmp_debug.h b/include/snmp_debug.h index 242091136c..03d937e211 100644 --- a/include/snmp_debug.h +++ b/include/snmp_debug.h @@ -1,10 +1,11 @@ /* - * $Id: snmp_debug.h,v 1.8 2001/10/17 19:05:37 hno Exp $ + * $Id: snmp_debug.h,v 1.9 2001/10/22 23:55:43 hno Exp $ */ #ifndef SQUID_SNMP_DEBUG_H #define SQUID_SNMP_DEBUG_H -extern void snmplib_debug(int, const char *,...); +extern void +snmplib_debug(int, const char *,...) PRINTF_FORMAT_ARG(2); #endif /* SQUID_SNMP_DEBUG_H */ diff --git a/src/protos.h b/src/protos.h index 0e0e88d6c9..6f7572288f 100644 --- a/src/protos.h +++ b/src/protos.h @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.418 2001/10/17 20:25:03 hno Exp $ + * $Id: protos.h,v 1.419 2001/10/22 23:55:43 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -194,7 +194,8 @@ extern void packerToMemInit(Packer * p, MemBuf * mb); extern void packerClean(Packer * p); extern void packerAppend(Packer * p, const char *buf, int size); #if STDC_HEADERS -extern void packerPrintf(Packer * p, const char *fmt,...); +extern void +packerPrintf(Packer * p, const char *fmt,...) PRINTF_FORMAT_ARG(2); #else extern void packerPrintf(); #endif @@ -208,7 +209,8 @@ extern void _db_init(const char *logfile, const char *options); extern void _db_rotate_log(void); #if STDC_HEADERS -extern void _db_print(const char *,...); +extern void +_db_print(const char *,...) PRINTF_FORMAT_ARG(1); #else extern void _db_print(); #endif @@ -409,7 +411,8 @@ extern int httpHeaderParseInt(const char *start, int *val); extern int httpHeaderParseSize(const char *start, ssize_t * sz); extern int httpHeaderReset(HttpHeader * hdr); #if STDC_HEADERS -extern void httpHeaderPutStrf(HttpHeader * hdr, http_hdr_type id, const char *fmt,...); +extern void +httpHeaderPutStrf(HttpHeader * hdr, http_hdr_type id, const char *fmt,...) PRINTF_FORMAT_ARG(3); #else extern void httpHeaderPutStrf(); #endif @@ -606,7 +609,8 @@ extern int memBufIsNull(MemBuf * mb); extern void memBufAppend(MemBuf * mb, const char *buf, mb_size_t size); /* calls snprintf, extends buffer if needed */ #if STDC_HEADERS -extern void memBufPrintf(MemBuf * mb, const char *fmt,...); +extern void +memBufPrintf(MemBuf * mb, const char *fmt,...) PRINTF_FORMAT_ARG(2); #else extern void memBufPrintf(); #endif @@ -913,7 +917,8 @@ extern void storeBufferFlush(StoreEntry *); extern void storeHashInsert(StoreEntry * e, const cache_key *); extern void storeSetMemStatus(StoreEntry * e, int); #if STDC_HEADERS -extern void storeAppendPrintf(StoreEntry *, const char *,...); +extern void +storeAppendPrintf(StoreEntry *, const char *,...) PRINTF_FORMAT_ARG(2); #else extern void storeAppendPrintf(); #endif @@ -1059,7 +1064,8 @@ extern void safeunlink(const char *path, int quiet); extern void death(int sig); extern void fatal(const char *message); #if STDC_HEADERS -extern void fatalf(const char *fmt,...); +extern void +fatalf(const char *fmt,...) PRINTF_FORMAT_ARG(1); #else extern void fatalf(); #endif @@ -1185,7 +1191,7 @@ extern String stringDup(const String * s); extern void stringClean(String * s); extern void stringReset(String * s, const char *str); extern void stringAppend(String * s, const char *buf, int len); -/* extern void stringAppendf(String *s, const char *fmt, ...); */ +/* extern void stringAppendf(String *s, const char *fmt, ...) PRINTF_FORMAT_ARG(2); */ /* * ipc.c @@ -1281,7 +1287,8 @@ extern void logfileRotate(Logfile * lf); extern void logfileWrite(Logfile * lf, void *buf, size_t len); extern void logfileFlush(Logfile * lf); #if STDC_HEADERS -extern void logfilePrintf(Logfile * lf, const char *fmt,...); +extern void +logfilePrintf(Logfile * lf, const char *fmt,...) PRINTF_FORMAT_ARG(2); #else extern void logfilePrintf(va_alist); #endif