diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2017-11-16 12:29:27 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2017-11-16 21:15:36 +0100 |
commit | 26f8fc833b9668a8b8e14ecd7d94930146019adb (patch) | |
tree | bd94fe2e87a8f1da483d7644b1d3a3f0091e1637 /sapi/phpdbg/phpdbg_out.h | |
parent | b8a4225a5f9d2bbe7aeb4cabce659bc903f162f6 (diff) | |
download | php-git-26f8fc833b9668a8b8e14ecd7d94930146019adb.tar.gz |
Enable and fix printf() format warnings
Add _unchecked() variants of zend_spprintf and zend_strpprintf for
cases where we specifically want to disable these checks, such as
use of %H.
Diffstat (limited to 'sapi/phpdbg/phpdbg_out.h')
-rw-r--r-- | sapi/phpdbg/phpdbg_out.h | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/sapi/phpdbg/phpdbg_out.h b/sapi/phpdbg/phpdbg_out.h index fe0bbe99ba..000a81f3d8 100644 --- a/sapi/phpdbg/phpdbg_out.h +++ b/sapi/phpdbg/phpdbg_out.h @@ -34,11 +34,18 @@ enum { P_LOG }; -PHPDBG_API int phpdbg_print(int severity, int fd, const char *tag, const char *xmlfmt, const char *strfmt, ...) PHP_ATTRIBUTE_FORMAT(printf, 5, 6); -PHPDBG_API int phpdbg_xml_internal(int fd, const char *fmt, ...) PHP_ATTRIBUTE_FORMAT(printf, 2, 3); -PHPDBG_API int phpdbg_log_internal(int fd, const char *fmt, ...) PHP_ATTRIBUTE_FORMAT(printf, 2, 3); -PHPDBG_API int phpdbg_out_internal(int fd, const char *fmt, ...) PHP_ATTRIBUTE_FORMAT(printf, 2, 3); -PHPDBG_API int phpdbg_rlog_internal(int fd, const char *fmt, ...) PHP_ATTRIBUTE_FORMAT(printf, 2, 3); +/* phpdbg uses lots of custom format specifiers, so we disable format checks by default. */ +#if defined(PHPDBG_CHECK_FORMAT_STRINGS) +# define PHPDBG_ATTRIBUTE_FORMAT(type, idx, first) PHP_ATTRIBUTE_FORMAT(type, idx, first) +#else +# define PHPDBG_ATTRIBUTE_FORMAT(type, idx, first) +#endif + +PHPDBG_API int phpdbg_print(int severity, int fd, const char *tag, const char *xmlfmt, const char *strfmt, ...) PHPDBG_ATTRIBUTE_FORMAT(printf, 5, 6); +PHPDBG_API int phpdbg_xml_internal(int fd, const char *fmt, ...) PHPDBG_ATTRIBUTE_FORMAT(printf, 2, 3); +PHPDBG_API int phpdbg_log_internal(int fd, const char *fmt, ...) PHPDBG_ATTRIBUTE_FORMAT(printf, 2, 3); +PHPDBG_API int phpdbg_out_internal(int fd, const char *fmt, ...) PHPDBG_ATTRIBUTE_FORMAT(printf, 2, 3); +PHPDBG_API int phpdbg_rlog_internal(int fd, const char *fmt, ...) PHPDBG_ATTRIBUTE_FORMAT(printf, 2, 3); #define phpdbg_error(tag, xmlfmt, strfmt, ...) phpdbg_print(P_ERROR , PHPDBG_G(io)[PHPDBG_STDOUT].fd, tag, xmlfmt, strfmt, ##__VA_ARGS__) #define phpdbg_notice(tag, xmlfmt, strfmt, ...) phpdbg_print(P_NOTICE , PHPDBG_G(io)[PHPDBG_STDOUT].fd, tag, xmlfmt, strfmt, ##__VA_ARGS__) |