summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYasuo Ohgaki <yohgaki@php.net>2002-03-14 02:17:23 +0000
committerYasuo Ohgaki <yohgaki@php.net>2002-03-14 02:17:23 +0000
commitcbc1cd802cccddef0ee86533ee08dc730b4e27f4 (patch)
treec57ea2cfcfabdd75ef041162d276c7a4ff357f26
parentaba912e66fb382a31afa63c41a56f9765820d84c (diff)
downloadphp-git-cbc1cd802cccddef0ee86533ee08dc730b4e27f4.tar.gz
Include/enable assert.h/assert() when it is available
-rw-r--r--CODING_STANDARDS3
-rw-r--r--configure.in1
-rw-r--r--main/php.h11
3 files changed, 14 insertions, 1 deletions
diff --git a/CODING_STANDARDS b/CODING_STANDARDS
index cf6455bf7d..e200f1e1a2 100644
--- a/CODING_STANDARDS
+++ b/CODING_STANDARDS
@@ -64,6 +64,9 @@ Exceptions:
not recommended. Since most of PHP_* macros are ZEND_* macro alias, use of
PHP_* macro makes browsing source with tag search harder.
+[8] Use assert(). assert.h is included in php.h if it is available.
+ Not only good assertion catch bugs, but also it makes easier to read code.
+
Naming Conventions
------------------
diff --git a/configure.in b/configure.in
index 9001db916f..4412440ba0 100644
--- a/configure.in
+++ b/configure.in
@@ -363,6 +363,7 @@ ApplicationServices/ApplicationServices.h \
alloca.h \
arpa/inet.h \
arpa/nameser.h \
+assert.h \
crypt.h \
fcntl.h \
grp.h \
diff --git a/main/php.h b/main/php.h
index e17d6d886a..131ac7819e 100644
--- a/main/php.h
+++ b/main/php.h
@@ -63,7 +63,16 @@
#include "php_regex.h"
-
+#if HAVE_ASSERT_H
+#if PHP_DEBUG
+#undef NDEBUG
+#else
+#define NDEBUG
+#endif
+#include <assert.h>
+#else /* HAVE_ASSERT_H */
+#define assert(expr) ((void) (0))
+#endif /* HAVE_ASSERT_H */
#define APACHE 0