Skip to content

Commit 25f5ba9

Browse files
committed
remove a few gcc format attributes from some printf-like functions
Since now PHP's printf-like functions have many custom specifiers, the amount of false-positives wasnt worth it
1 parent 51ce4bd commit 25f5ba9

File tree

4 files changed

+11
-17
lines changed

4 files changed

+11
-17
lines changed

Diff for: main/php.h

+4-10
Original file line numberDiff line numberDiff line change
@@ -281,12 +281,9 @@ ssize_t pread(int, void *, size_t, off64_t);
281281
BEGIN_EXTERN_C()
282282
void phperror(char *error);
283283
PHPAPI size_t php_write(void *buf, size_t size TSRMLS_DC);
284-
PHPAPI size_t php_printf(const char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, 1,
285-
2);
284+
PHPAPI size_t php_printf(const char *format, ...);
286285
PHPAPI int php_get_module_initialized(void);
287286
PHPAPI void php_log_err(char *log_message TSRMLS_DC);
288-
int Debug(char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, 1, 2);
289-
int cfgparse(void);
290287
END_EXTERN_C()
291288

292289
#define php_error zend_error
@@ -308,12 +305,9 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c
308305
#endif
309306

310307
/* PHPAPI void php_error(int type, const char *format, ...); */
311-
PHPAPI void php_error_docref0(const char *docref TSRMLS_DC, int type, const char *format, ...)
312-
PHP_ATTRIBUTE_FORMAT(printf, PHP_ATTR_FMT_OFFSET + 3, PHP_ATTR_FMT_OFFSET + 4);
313-
PHPAPI void php_error_docref1(const char *docref TSRMLS_DC, const char *param1, int type, const char *format, ...)
314-
PHP_ATTRIBUTE_FORMAT(printf, PHP_ATTR_FMT_OFFSET + 4, PHP_ATTR_FMT_OFFSET + 5);
315-
PHPAPI void php_error_docref2(const char *docref TSRMLS_DC, const char *param1, const char *param2, int type, const char *format, ...)
316-
PHP_ATTRIBUTE_FORMAT(printf, PHP_ATTR_FMT_OFFSET + 5, PHP_ATTR_FMT_OFFSET + 6);
308+
PHPAPI void php_error_docref0(const char *docref TSRMLS_DC, int type, const char *format, ...);
309+
PHPAPI void php_error_docref1(const char *docref TSRMLS_DC, const char *param1, int type, const char *format, ...);
310+
PHPAPI void php_error_docref2(const char *docref TSRMLS_DC, const char *param1, const char *param2, int type, const char *format, ...);
317311
#ifdef PHP_WIN32
318312
PHPAPI void php_win32_docref2_from_error(DWORD error, const char *param1, const char *param2 TSRMLS_DC);
319313
#endif

Diff for: main/php_streams.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,9 @@ PHPAPI void _php_stream_fill_read_buffer(php_stream *stream, size_t size TSRMLS_
299299
#define php_stream_fill_read_buffer(stream, size) _php_stream_fill_read_buffer((stream), (size) TSRMLS_CC)
300300

301301
#ifdef ZTS
302-
PHPAPI size_t _php_stream_printf(php_stream *stream TSRMLS_DC, const char *fmt, ...) PHP_ATTRIBUTE_FORMAT(printf, 3, 4);
302+
PHPAPI size_t _php_stream_printf(php_stream *stream TSRMLS_DC, const char *fmt, ...);
303303
#else
304-
PHPAPI size_t _php_stream_printf(php_stream *stream TSRMLS_DC, const char *fmt, ...) PHP_ATTRIBUTE_FORMAT(printf, 2, 3);
304+
PHPAPI size_t _php_stream_printf(php_stream *stream TSRMLS_DC, const char *fmt, ...);
305305
#endif
306306

307307
/* php_stream_printf macro & function require TSRMLS_CC */
@@ -560,9 +560,9 @@ PHPAPI const char *php_stream_locate_eol(php_stream *stream, zend_string *buf TS
560560

561561
/* pushes an error message onto the stack for a wrapper instance */
562562
#ifdef ZTS
563-
PHPAPI void php_stream_wrapper_log_error(php_stream_wrapper *wrapper, int options TSRMLS_DC, const char *fmt, ...) PHP_ATTRIBUTE_FORMAT(printf, 4, 5);
563+
PHPAPI void php_stream_wrapper_log_error(php_stream_wrapper *wrapper, int options TSRMLS_DC, const char *fmt, ...);
564564
#else
565-
PHPAPI void php_stream_wrapper_log_error(php_stream_wrapper *wrapper, int options TSRMLS_DC, const char *fmt, ...) PHP_ATTRIBUTE_FORMAT(printf, 3, 4);
565+
PHPAPI void php_stream_wrapper_log_error(php_stream_wrapper *wrapper, int options TSRMLS_DC, const char *fmt, ...);
566566
#endif
567567

568568
#define PHP_STREAM_UNCHANGED 0 /* orig stream was seekable anyway */

Diff for: main/snprintf.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ PHPAPI int ap_php_snprintf(char *, size_t, const char *, ...);
8484
PHPAPI int ap_php_vsnprintf(char *, size_t, const char *, va_list ap);
8585
PHPAPI int ap_php_vasprintf(char **buf, const char *format, va_list ap);
8686
PHPAPI int ap_php_asprintf(char **buf, const char *format, ...);
87-
PHPAPI int php_sprintf (char* s, const char* format, ...) PHP_ATTRIBUTE_FORMAT(printf, 2, 3);
87+
PHPAPI int php_sprintf (char* s, const char* format, ...);
8888
PHPAPI char * php_gcvt(double value, int ndigit, char dec_point, char exponent, char *buf);
8989
PHPAPI char * php_conv_fp(register char format, register double num,
9090
boolean_e add_dp, int precision, char dec_point, bool_int * is_negative, char *buf, size_t *len);

Diff for: main/spprintf.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ There is also snprintf: See difference explained in snprintf.h
3737
#include "snprintf.h"
3838

3939
BEGIN_EXTERN_C()
40-
PHPAPI size_t spprintf( char **pbuf, size_t max_len, const char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, 3, 4);
40+
PHPAPI size_t spprintf( char **pbuf, size_t max_len, const char *format, ...);
4141

42-
PHPAPI size_t vspprintf(char **pbuf, size_t max_len, const char *format, va_list ap) PHP_ATTRIBUTE_FORMAT(printf, 3, 0);
42+
PHPAPI size_t vspprintf(char **pbuf, size_t max_len, const char *format, va_list ap);
4343

4444
PHPAPI zend_string *vstrpprintf(size_t max_len, const char *format, va_list ap);
4545

0 commit comments

Comments
 (0)