diff options
author | Tony Cook <tony@develop-help.com> | 2014-11-12 13:53:48 +1100 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2014-12-03 11:30:45 +1100 |
commit | 11f9ab1a291e36ad40cb66d0bd0aedce897c06c3 (patch) | |
tree | a5a82eeb88d43702a2a43f7dffbcfd1eb4da4819 /perl.h | |
parent | 679f225298d1387d98096620b81b27724e70766c (diff) | |
download | perl-11f9ab1a291e36ad40cb66d0bd0aedce897c06c3.tar.gz |
[perl #123063] allow assert() to be used as an expression
In non-DEBUGGING builds it would be replaced with nothing, producing
a syntax error
Diffstat (limited to 'perl.h')
-rw-r--r-- | perl.h | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -4035,6 +4035,7 @@ Gid_t getegid (void); # define DEBUG_Pv_TEST DEBUG_Pv_TEST_ # define PERL_DEB(a) a +# define PERL_DEB2(a,b) a # define PERL_DEBUG(a) if (PL_debug) a # define DEBUG_p(a) if (DEBUG_p_TEST) a # define DEBUG_s(a) if (DEBUG_s_TEST) a @@ -4117,6 +4118,7 @@ Gid_t getegid (void); # define DEBUG_Pv_TEST (0) # define PERL_DEB(a) +# define PERL_DEB2(a,b) b # define PERL_DEBUG(a) # define DEBUG_p(a) # define DEBUG_s(a) @@ -4159,11 +4161,11 @@ Gid_t getegid (void); /* Keep the old croak based assert for those who want it, and as a fallback if the platform is so heretically non-ANSI that it can't assert. */ -#define Perl_assert(what) PERL_DEB( \ +#define Perl_assert(what) PERL_DEB2( \ ((what) ? ((void) 0) : \ (Perl_croak_nocontext("Assertion %s failed: file \"" __FILE__ \ "\", line %d", STRINGIFY(what), __LINE__), \ - (void) 0))) + (void) 0)), ((void)0)) /* assert() gets defined if DEBUGGING (and I_ASSERT). * If no DEBUGGING, the <assert.h> has not been included. */ |