#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
#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
#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 */