WITH_THR and WITH_THX

[email protected] (Nicholas Clark)
Newsgroups perl.perl5.porters
Message-ID <[email protected]>
There are currently exactly two uses of WITH_THR/WITH_THX in core.

#define WITH_THX(s) STMT_START { dTHX; s; } STMT_END
#define WITH_THR(s) WITH_THX(s)


As far as I can tell, neither is needed. If I do the following, it still
builds and passes all tests:

diff --git a/cop.h b/cop.h
index 98478ae..e5370c4 100644
--- a/cop.h
+++ b/cop.h
@@ -569,14 +569,14 @@ struct block {
 #define blk_givwhen	cx_u.cx_blk.blk_u.blku_givwhen
 
 #define DEBUG_CX(action)						\
-    DEBUG_l(WITH_THX(							\
+    DEBUG_l(								\
 	Perl_deb(aTHX_ "CX %ld %s %s (scope %ld,%ld) at %s:%d\n",	\
 		    (long)cxstack_ix,					\
 		    action,						\
 		    PL_block_type[CxTYPE(&cxstack[cxstack_ix])],	\
 		    (long)PL_scopestack_ix,				\
 		    (long)(cxstack[cxstack_ix].blk_oldscopesp),		\
-		    __FILE__, __LINE__)));
+		    __FILE__, __LINE__));
 
 /* Enter a block. */
 #define PUSHBLOCK(cx,t,sp) CXINC, cx = &cxstack[cxstack_ix],		\
diff --git a/perl.h b/perl.h
index 673a19e..b551f4b 100644
--- a/perl.h
+++ b/perl.h
@@ -3811,10 +3811,10 @@ Gid_t getegid (void);
 
 
 #define DEBUG_SCOPE(where) \
-    DEBUG_l(WITH_THR( \
+    DEBUG_l( \
     Perl_deb(aTHX_ "%s scope %ld (savestack=%ld) at %s:%d\n",	\
 		    where, (long)PL_scopestack_ix, (long)PL_savestack_ix, \
-		    __FILE__, __LINE__)));
+		    __FILE__, __LINE__));
 
 
 


Is there a reason why they're actually needed? I can't work it out for sure,
and I didn't really want to remove something on the basis of "works on my
machine" without understanding it.

Nicholas Clark
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.