com php-src: Disable format string checking by default: Zend/zend.h
| From: | Nikita Popov | Date: | Wed, 03 Sep 2014 13:38:06 +0000 |
| Subject: | com php-src: Disable format string checking by default: Zend/zend.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-81405@lists.php.net to get a copy of this message | ||
Commit: 979058d4ffee024255dc12b8bc94df88235bf45d
Author: Nikita Popov <nikic@php.net> Wed, 3 Sep 2014 15:36:04 +0200
Parents: fdd1e96f3e90895134c4082bde8cad475378deac
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=979058d4ffee024255dc12b8bc94df88235bf45d
Log:
Disable format string checking by default
Instead of removing format attributes altogether, disable the checks
by default. This allows you to do a build with format string checks
and filter out the false positives (basically anything mentioning
%p).
Changed paths:
M Zend/zend.h
Diff:
diff --git a/Zend/zend..h b/Zend/zend.h
index 9e8f9a6..a0d8ba9 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)