summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Zend/zend.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/Zend/zend.h b/Zend/zend.h
index 9e8f9a62d6..a0d8ba9e0c 100644
--- a/Zend/zend.h
+++ b/Zend/zend.h
@@ -159,13 +159,17 @@ char *alloca ();
# define ZEND_ATTRIBUTE_ALLOC_SIZE2(X,Y)
#endif
-#if ZEND_GCC_VERSION >= 2007
+/* Format string checks are disabled by default, because we use custom format modifiers (like %p),
+ * which cause a large amount of false positives. You can enable format checks by adding
+ * -DZEND_CHECK_FORMAT_STRINGS to CFLAGS. */
+
+#if ZEND_GCC_VERSION >= 2007 && defined(ZEND_CHECK_FORMAT_STRINGS)
# define ZEND_ATTRIBUTE_FORMAT(type, idx, first) __attribute__ ((format(type, idx, first)))
#else
# define ZEND_ATTRIBUTE_FORMAT(type, idx, first)
#endif
-#if ZEND_GCC_VERSION >= 3001 && !defined(__INTEL_COMPILER)
+#if ZEND_GCC_VERSION >= 3001 && !defined(__INTEL_COMPILER) && defined(ZEND_CHECK_FORMAT_STRINGS)
# define ZEND_ATTRIBUTE_PTR_FORMAT(type, idx, first) __attribute__ ((format(type, idx, first)))
#else
# define ZEND_ATTRIBUTE_PTR_FORMAT(type, idx, first)