From: Sascha Schumann Date: Thu, 28 Aug 2003 05:25:26 +0000 (+0000) Subject: MFH automatic format checks X-Git-Tag: php-4.3.4RC1~178 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0ea4d57d56386d5df702b90acb8a8423951ae1bb;p=php MFH automatic format checks --- diff --git a/main/php.h b/main/php.h index e199941915..e77c9c30bf 100644 --- a/main/php.h +++ b/main/php.h @@ -220,6 +220,12 @@ char *strerror(int); #define LONG_MIN (- LONG_MAX - 1) #endif +#ifdef __GNUC__ +# define PHP_ATTRIBUTE_FORMAT(type, idx, first) __attribute__ ((format(type, idx, first))) +#else +# define PHP_ATTRIBUTE_FORMAT(type, idx, first) +#endif + #if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) || PHP_BROKEN_SPRINTF || PHP_BROKEN_SNPRINTF || PHP_BROKEN_VSNPRINTF #include "snprintf.h" #endif diff --git a/main/snprintf.h b/main/snprintf.h index 4443a6cfc2..ff92a80a6b 100644 --- a/main/snprintf.h +++ b/main/snprintf.h @@ -63,17 +63,17 @@ Example: #define SNPRINTF_H #if !defined(HAVE_SNPRINTF) || PHP_BROKEN_SNPRINTF -extern int ap_php_snprintf(char *, size_t, const char *, ...); +int ap_php_snprintf(char *, size_t, const char *, ...) PHP_ATTRIBUTE_FORMAT(printf, 3, 4); #define snprintf ap_php_snprintf #endif #if !defined(HAVE_VSNPRINTF) || PHP_BROKEN_VSNPRINTF -extern int ap_php_vsnprintf(char *, size_t, const char *, va_list ap); +int ap_php_vsnprintf(char *, size_t, const char *, va_list ap) PHP_ATTRIBUTE_FORMAT(printf, 3, 0); #define vsnprintf ap_php_vsnprintf #endif #if PHP_BROKEN_SPRINTF -int php_sprintf (char* s, const char* format, ...); +int php_sprintf (char* s, const char* format, ...) PHP_ATTRIBUTE_FORMAT(printf, 2, 3); #define sprintf php_sprintf #endif diff --git a/main/spprintf.h b/main/spprintf.h index 23ecfddb54..54f2273679 100644 --- a/main/spprintf.h +++ b/main/spprintf.h @@ -35,9 +35,9 @@ There is also snprintf: See difference explained in snprintf.h #include "snprintf.h" BEGIN_EXTERN_C() -PHPAPI extern int spprintf( char **pbuf, size_t max_len, const char *format, ...); +PHPAPI int spprintf( char **pbuf, size_t max_len, const char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, 3, 4); -PHPAPI extern int vspprintf(char **pbuf, size_t max_len, const char *format, va_list ap); +PHPAPI int vspprintf(char **pbuf, size_t max_len, const char *format, va_list ap) PHP_ATTRIBUTE_FORMAT(printf, 3, 0); END_EXTERN_C() #endif /* SNPRINTF_H */