It seems that our assert() macro wasn't good enough.
Nicholas Clark [Tue, 15 Jun 2004 09:21:22 +0000 (09:21 +0000)]
Changed to one that that is an expression, rather than a statement.
Fix new macros definitions in sv.h to be clean enough C to keep the
AIX compiler happy.

p4raw-id: //depot/perl@22937

perl.h
sv.h

diff --git a/perl.h b/perl.h
index ba7e3dc..9303419 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -2966,21 +2966,12 @@ Gid_t getegid (void);
 
 
 #ifndef assert  /* <assert.h> might have been included somehow */
-#ifdef DEBUGGING
-#define assert(what)   PERL_DEB( {                                     \
-       if (!(what)) {                                                  \
-           Perl_croak(aTHX_ "Assertion " STRINGIFY(what) " failed: file \"%s\", line %d",      \
-               __FILE__, __LINE__);                                    \
-           PerlProc_exit(1);                                           \
-       }})
-#else
-#define assert(what)   PERL_DEB( {                                     \
-       if (!(what)) {                                                  \
-           Perl_croak(aTHX_ "Assertion failed: file \"%s\", line %d",  \
-               __FILE__, __LINE__);                                    \
-           PerlProc_exit(1);                                           \
-       }})
-#endif
+#define assert(what)   PERL_DEB(                                       \
+       ((what) ? ((void) 0) :                                          \
+           (Perl_croak(aTHX_ "Assertion " STRINGIFY(what) " failed: file \"%s\", line %d",     \
+               __FILE__, __LINE__),                                    \
+           PerlProc_exit(1),                                           \
+           (void) 0)))
 #endif
 
 struct ufuncs {
diff --git a/sv.h b/sv.h
index 229690c..f05df1c 100644 (file)
--- a/sv.h
+++ b/sv.h
@@ -741,8 +741,8 @@ and leaves the UTF-8 status as it was.
 #define SvENDx(sv) ((PL_Sv = (sv)), SvEND(PL_Sv))
 
 #ifdef DEBUGGING
-#define SvMAGIC(sv)    ((assert(SvTYPE(sv) >= SVt_PVMG)), ((XPVMG*)  SvANY(sv))->xmg_magic)
-#define SvSTASH(sv)    ((assert(SvTYPE(sv) >= SVt_PVMG)), (XPVMG*)  SvANY(sv))->xmg_stash
+#define SvMAGIC(sv)    (*(assert(SvTYPE(sv) >= SVt_PVMG), &((XPVMG*)  SvANY(sv))->xmg_magic))
+#define SvSTASH(sv)    (*(assert(SvTYPE(sv) >= SVt_PVMG), &((XPVMG*)  SvANY(sv))->xmg_stash))
 #else
 #define SvMAGIC(sv)    ((XPVMG*)  SvANY(sv))->xmg_magic
 #define SvSTASH(sv)    ((XPVMG*)  SvANY(sv))->xmg_stash