summaryrefslogtreecommitdiff
path: root/perl.h
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2007-12-22 19:22:48 +0000
committerNicholas Clark <nick@ccl4.org>2007-12-22 19:22:48 +0000
commitde84dc04df54774a9a36117a3e6233130e44a9a3 (patch)
tree01bbb20a0f522250da455b6cf0659b87dbe1c03d /perl.h
parent24792b8dabd61fb81a064d275b67bc65123a8d4c (diff)
downloadperl-de84dc04df54774a9a36117a3e6233130e44a9a3.tar.gz
Replace our assert-which-can-be-caught-by-eval with the real deal from
the standard C library. Make ours available as Perl_assert(), if you really want that. assert() is only #include'd if you compile with -DDEBUGGING. p4raw-id: //depot/perl@32708
Diffstat (limited to 'perl.h')
-rw-r--r--perl.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/perl.h b/perl.h
index bf4db2410e..79259ce4b4 100644
--- a/perl.h
+++ b/perl.h
@@ -3760,13 +3760,21 @@ Gid_t getegid (void);
#define PERL_MAGIC_arylen_p '@' /* to move arylen out of XPVAV */
#define PERL_MAGIC_ext '~' /* Available for use by extensions */
+#if defined(DEBUGGING) && defined(I_ASSERT)
+# include <assert.h>
+#endif
+
+/* Keep the old croak based assert for those who want it, and as a fallback if
+ the platform is so hertically non-ANSI that it can't assert. */
-#ifndef assert /* <assert.h> might have been included somehow */
-#define assert(what) PERL_DEB( \
+#define Perl_assert(what) PERL_DEB( \
((what) ? ((void) 0) : \
(Perl_croak_nocontext("Assertion %s failed: file \"" __FILE__ \
"\", line %d", STRINGIFY(what), __LINE__), \
(void) 0)))
+
+#ifndef assert
+# define assert(what) Perl_assert(what)
#endif
struct ufuncs {