diff options
author | Sascha Schumann <sas@php.net> | 2003-08-28 15:52:15 +0000 |
---|---|---|
committer | Sascha Schumann <sas@php.net> | 2003-08-28 15:52:15 +0000 |
commit | e98926be3fdc7bd891630cf0185fbe5d3fda5cdf (patch) | |
tree | e2ba1c6c1a0702fc7a7e52e7c9ed3d7100eef5f3 | |
parent | 488f26359a6b43cc85cf0a354530c83daecb36b7 (diff) | |
download | php-git-e98926be3fdc7bd891630cf0185fbe5d3fda5cdf.tar.gz |
add PHP_ATTRIBUTE_FORMAT to more functions
# uncovers a nice number of incorrect format strings
-rw-r--r-- | main/php.h | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/main/php.h b/main/php.h index 7797904d96..787f125095 100644 --- a/main/php.h +++ b/main/php.h @@ -222,12 +222,7 @@ char *strerror(int); #define PHP_GCC_VERSION ZEND_GCC_VERSION #define PHP_ATTRIBUTE_MALLOC ZEND_ATTRIBUTE_MALLOC - -#if PHP_GCC_VERSION >= 2007 -# define PHP_ATTRIBUTE_FORMAT(type, idx, first) __attribute__ ((format(type, idx, first))) -#else -# define PHP_ATTRIBUTE_FORMAT(type, idx, first) -#endif +#define PHP_ATTRIBUTE_FORMAT ZEND_ATTRIBUTE_FORMAT #if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) || PHP_BROKEN_SPRINTF || PHP_BROKEN_SNPRINTF || PHP_BROKEN_VSNPRINTF #include "snprintf.h" @@ -278,19 +273,28 @@ ssize_t pread(int, void *, size_t, off64_t); void phperror(char *error); PHPAPI int php_write(void *buf, uint size TSRMLS_DC); -PHPAPI int php_printf(const char *format, ...); +PHPAPI int php_printf(const char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, 1, 2); PHPAPI void php_log_err(char *log_message TSRMLS_DC); -int Debug(char *format, ...); +int Debug(char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, 1, 2); int cfgparse(void); #define php_error zend_error -PHPAPI void php_verror(const char *docref, const char *params, int type, const char *format, va_list args TSRMLS_DC) ; +PHPAPI void php_verror(const char *docref, const char *params, int type, const char *format, va_list args TSRMLS_DC) PHP_ATTRIBUTE_FORMAT(printf, 4, 0); + +#ifdef ZTS +#define PHP_ATTR_FMT_OFFSET 1 +#else +#define PHP_ATTR_FMT_OFFSET 0 +#endif /* PHPAPI void php_error(int type, const char *format, ...); */ -PHPAPI void php_error_docref0(const char *docref TSRMLS_DC, int type, const char *format, ...); -PHPAPI void php_error_docref1(const char *docref TSRMLS_DC, const char *param1, int type, const char *format, ...); -PHPAPI void php_error_docref2(const char *docref TSRMLS_DC, const char *param1, const char *param2, int type, const char *format, ...); +PHPAPI void php_error_docref0(const char *docref TSRMLS_DC, int type, const char *format, ...) + PHP_ATTRIBUTE_FORMAT(printf, PHP_ATTR_FMT_OFFSET + 3, PHP_ATTR_FMT_OFFSET + 4); +PHPAPI void php_error_docref1(const char *docref TSRMLS_DC, const char *param1, int type, const char *format, ...) + PHP_ATTRIBUTE_FORMAT(printf, PHP_ATTR_FMT_OFFSET + 4, PHP_ATTR_FMT_OFFSET + 5); +PHPAPI void php_error_docref2(const char *docref TSRMLS_DC, const char *param1, const char *param2, int type, const char *format, ...) + PHP_ATTRIBUTE_FORMAT(printf, PHP_ATTR_FMT_OFFSET + 5, PHP_ATTR_FMT_OFFSET + 6); #define php_error_docref php_error_docref0 |